Skip to content
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

Use extension list instead of ignore for phpcs #148

Merged
merged 4 commits into from
Jan 27, 2020
Merged

Use extension list instead of ignore for phpcs #148

merged 4 commits into from
Jan 27, 2020

Conversation

byrond
Copy link
Contributor

@byrond byrond commented Jan 22, 2020

Due to https://www.drupal.org/project/coder/issues/3074176 ("Allow extensions to be overridden in contrib phpcs.xml file") included in Coder 8.37, the default list of extensions checked by phpcs has changed.

This removes the ignore configuration option and replaces it with extensions with a default that matches the original list in Coder.

Note: This will require re-installing The Build or manually updating build.xml on projects.

Open questions

Should we add js to the list of extensions? The default behavior of Coder 8.3.7 checking JS files generated a lot of errors on one project where it was used, but it could be useful to have in the list.

Should we remove ignore from the defaults? This would cause projects that don't update their build.xml to start checking .md files, so it might be best to leave it in? Depending on the answer to the first question above, we could also add *.js to the list of ignored extensions to avoid checking files that weren't previously checked.

@@ -228,9 +228,8 @@ phpcs:
# Space-separated list of directories to review.
directories: "${drupal.root}/modules/custom ${drupal.root}/themes/custom ${drupal.root}/profiles/custom"

# Comma-separated list of patterns for files and directories to exclude from the
Copy link
Member

Choose a reason for hiding this comment

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

Existing build.xml files use this property -- so we should keep it, but add a comment saying it will be deprecated in 3.0 (which... we don't have a roadmap really so who knows when that would be...)

@@ -132,7 +132,7 @@
</phplint>

<!-- Run PHP Code Sniffer. -->
<property name="phpcs.command" value="vendor/bin/phpcs --standard=${phpcs.standard} --ignore=${phpcs.ignore} ${phpcs.directories}" />
<property name="phpcs.command" value="vendor/bin/phpcs --standard=${phpcs.standard} --extensions=${phpcs.extensions} ${phpcs.directories}" />
Copy link
Member

Choose a reason for hiding this comment

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

👍

@becw
Copy link
Member

becw commented Jan 23, 2020

Re: your questions...

Including js files in code reviews - I think we should go ahead and add this. Existing projects will need to change their build.xml file to get this change anyway, and we should have this as a default on new projects

Removing the ignore property from defaults - We should keep this, again because of existing build.xml files, but add a deprecation warning.

@byrond
Copy link
Contributor Author

byrond commented Jan 27, 2020

@becw I restored the default value for phpcs.ignore, added a deprecation warning and note about not using the option with Coder >=8.3.7, and added js to the default list of extensions that are checked.

@becw becw merged commit 6b42c47 into develop Jan 27, 2020
@becw becw deleted the coder-8-3-7 branch January 27, 2020 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants