Feedback requested: php-cs-fixer alignment rules

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Feedback requested: php-cs-fixer alignment rules

Demian Katz

As discussed on today’s developers call, I am working on updating VuFind to use the major new version of the php-cs-fixer tool for style normalization. See this pull request:

 

https://github.com/vufind-org/vufind/pull/897

 

Unfortunately, there is one change in behavior that will have some impact on VuFind’s codebase. Old behavior ensured that every binary operator had at least one space before and after it, but did not force either whitespace-collapsing or operator alignment. The new behavior can be configured to either always collapse or always align whitespace around double arrow (=>) and assignment (=) operators. This means that developers can no longer use discretion about when to align, and when not to align, code.

 

We have a few options:

 

1.)    Turn off the binary operators rule, which means we may end up with some inconsistent styling in the code.

2.)    Always align one or both operators.

3.)    Always collapse one or both operators.

4.)    Submit a PR to the php-cs-fixer community to make the old behavior a configurable option in the new version.

 

Does anyone have strong feelings about this? If we decide to enforce one value, I think we’re better off choosing “always collapse” over “always align” since alignment may cause a chain reaction of “line too long” style errors. However, always collapsing means that we will lose readability in at least some files where alignment is currently used to good effect.

 

- Demian

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Vufind-tech mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-tech
Reply | Threaded
Open this post in threaded view
|

Re: Feedback requested: php-cs-fixer alignment rules

Ere Maijala
Unofortunatelu I missed the dev call. But quickly thinking I'd go for
option 4 with option 3 coming second.

--Ere

31.1.2017, 16.29, Demian Katz kirjoitti:

> As discussed on today’s developers call, I am working on updating VuFind
> to use the major new version of the php-cs-fixer tool for style
> normalization. See this pull request:
>
>
>
> https://github.com/vufind-org/vufind/pull/897
>
>
>
> Unfortunately, there is one change in behavior that will have some
> impact on VuFind’s codebase. Old behavior ensured that every binary
> operator had at least one space before and after it, but did not force
> either whitespace-collapsing or operator alignment. The new behavior can
> be configured to either always collapse or always align whitespace
> around double arrow (=>) and assignment (=) operators. This means that
> developers can no longer use discretion about when to align, and when
> not to align, code.
>
>
>
> We have a few options:
>
>
>
> 1.)    Turn off the binary operators rule, which means we may end up
> with some inconsistent styling in the code.
>
> 2.)    Always align one or both operators.
>
> 3.)    Always collapse one or both operators.
>
> 4.)    Submit a PR to the php-cs-fixer community to make the old
> behavior a configurable option in the new version.
>
>
>
> Does anyone have strong feelings about this? If we decide to enforce one
> value, I think we’re better off choosing “always collapse” over “always
> align” since alignment may cause a chain reaction of “line too long”
> style errors. However, always collapsing means that we will lose
> readability in at least some files where alignment is currently used to
> good effect.
>
>
>
> - Demian
>
>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Vufind-tech mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/vufind-tech
>

--
Ere Maijala
Kansalliskirjasto / The National Library of Finland

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Vufind-tech mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-tech