Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Initial ECS setup according to current rules #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
OndraM merged 3 commits into master from feature/current
Mar 19, 2018
Merged

Conversation

@OndraM
Copy link
Contributor

@OndraM OndraM commented Mar 17, 2018
edited
Loading

This is just an initial import of rules currently defined in lmc/jobs-meta for both php-cs-fixer and PHP_CodeSniffer into Symfon-DI-like yml format which is used by (alpha) version 4 of Symplify/EasyCodingStandard (ECS).

The plan is now to make use of lmc/jobs-meta for sharing codestyle rules obsolete and switch to ECS instead. As the integration is pretty straightforward, this will make reuse of the codestyle quite easy. ECS support excluding files and/or specific fixers, so it will also be easy to adjust the configuration for edgecases, but still benefit from the standard, well known and unified configuration format.

Codebases currenly using rulesets from lmc/jobs-meta should be 99 % compatible with this configuration - attached configuration was tested on few of them (I tried eg. Jobs, ApiBundle, Consentor, Footer API, ApplyFeedback, CompanyProfiles, matej-client-php, Steward...), so this set of rules is already battle-tested.

However what needs to be resolved:

  1. Will we sort and/or structure the rules anyhow? Until now we had php-cs-fixer rules sorted alphabetically according to their name (like "array_syntax", "phpdoc_no_empty_return" etc.), which is the current order in easy-coding-standard.yml in this PR. But it does not make any sense now, and will be hard to maintain. Maybe we can sort them now by their FQCN. Yes or no? (Or null? 🙃 )
  2. Should the phpcs/PHP_CodeSniffer rules be separated in the configuration like now, or we will simply sort all the services alphabetically by their FQCN?
  3. Do we want to use comments explaining each of the rule? (We had them in phpcs-ruleset.xml of lmc/jobs-meta, but not in php-cs-fixer-ruleset.php - so for not I kept them in the PHP_CodeSniffer section, until we decide if we want to have them or not).
  4. (削除) PHP 7-specific rules were not yet part of jobs-meta so they are not part of this (yet). But I will add them directly in the main file - if there is anyone still on PHP 5.6, they can simply skip them. Ok? (削除ここまで) ECS requires PHP ^7.1. So we don't plan using this on PHP ^5.6 projects.

Your thoughts?

Copy link
Contributor

  1. and 2. - Sorting of any kind is IMHO good for nothing really. Or do you have any example of some benefit. I cant see one now.
  2. Comments of any kind are for commenting unclear facts, so if the rule is unclear and should be commented, it should be commented, otherwise the rule is self-explaining, so it does not need any other explanation.
  3. PHP 7 is present, not the future.. 56 (or older :trollface: ) are obsolete.

phpinfo: null
eval: null
sizeof: count
printf: null
Copy link
Contributor

@MortalFlesh MortalFlesh Mar 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about join: implode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its already part of NoAliasFunctionsFixer. Also this means sizeof is redundant as well, I will remove it.

Copy link
Contributor Author

OndraM commented Mar 19, 2018
edited
Loading

Ad 1. & 2. So I sorted it by namespace. And thanks to it I found one duplicate definition. ̄\_(ツ)_/ ̄
Ad 3. So keep them where they are ̄\_(ツ)_/ ̄
Ad 4. So ECS requires PHP ^7.1, so I consider this is answered now :)

OndraM added 2 commits March 19, 2018 17:09
fixup! Setup ECS according to currently used rules for php-cs-fixer
fixup! fixup! Setup ECS according to currently used rules for php-cs-fixer
@OndraM OndraM merged commit f0fb333 into master Mar 19, 2018
@OndraM OndraM deleted the feature/current branch March 26, 2018 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@MortalFlesh MortalFlesh MortalFlesh approved these changes

@jirinovak jirinovak Awaiting requested review from jirinovak

@davidkmenta davidkmenta Awaiting requested review from davidkmenta

@kdosiodjinud kdosiodjinud Awaiting requested review from kdosiodjinud

@MartinKristof MartinKristof Awaiting requested review from MartinKristof

@MarketaSebkova MarketaSebkova Awaiting requested review from MarketaSebkova

@kubasimon kubasimon Awaiting requested review from kubasimon

@dudla dudla Awaiting requested review from dudla

@hokypierce hokypierce Awaiting requested review from hokypierce

@florianjiri florianjiri Awaiting requested review from florianjiri

+1 more reviewer

@legendik legendik legendik approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /