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

Exclude computer generated code (e.g. minified JS/CSS) from PHPCS #63

Open
gabesullice opened this issue Feb 24, 2020 · 5 comments
Open
Labels
enhancement New feature or request

Comments

@gabesullice
Copy link

gabesullice commented Feb 24, 2020

In https://github.com/acquia/acquia_migrate we're using webpack to build minified CSS and JS files. These files often have (practically) unfixable PHP_CodeSniffer violations. Since these files are computer-generated, I would like a way to exclude them. They all live in a dist directory so it'd be okay to exclude that directory completely, but it'd also be fine if we had to exclude each generated file explicitly. I guess it doesn't necessarily have to be configurable. ORCA could hardcode the dist directory as excluded (just like it excludes vendor).

@kaynenh
Copy link

kaynenh commented Mar 31, 2020

I just want to mention that the Content Hub module is also running into this issue (minified css and js files from package build which phpcs is failing). I'm going to submit a separate feature request to allow warnings to still pass phpcs.

@TravisCarden
Copy link
Contributor

Since ORCA's purpose is to enforce company standards, allowing unlimited configurability is undesirable. Implementers could just suppress legitimate errors they didn't want to fix. Some limited configurability might be appropriate, though. Of course, they can already choose between a predefined set of PHPCS standards of varying strictness. If it seems appropriate after further consideration, we could also do something like letting them choose between failing on warnings or errors only. But I would assume that any specific sniffs that were problematic for one implementer would be (at least potentially) for all. So I would like to fix those centrally--either in ORCA, Acquia Coding Standards, or further upstream. Would you like to create issues for specific problems we can solve across the board? The compiled files problem, in particular, seems like a slam dunk. If you still feel a need for configurability as such, we can continue discussion of that here.

@TravisCarden TravisCarden added the enhancement New feature or request label Apr 1, 2020
@TravisCarden TravisCarden changed the title [Feature Request] Make phpcs exclude-patterns somewhat configurable Make PHPCS more configurable Apr 1, 2020
@gabesullice
Copy link
Author

gabesullice commented Apr 1, 2020

The compiled files problem, in particular, seems like a slam dunk.

IMO, this is the heart of what this ticket is about. Perhaps just retitling this issue would be more efficient than creating new tickets.

Proposed title: Exclude computer generated code (e.g. minified JS/CSS) from PHPCS

@TravisCarden
Copy link
Contributor

Sounds good to me, @gabesullice! May I have a link to a failed build so I can identify the offending sniff?

@TravisCarden TravisCarden changed the title Make PHPCS more configurable Exclude computer generated code (e.g. minified JS/CSS) from PHPCS Apr 1, 2020
@kaynenh
Copy link

kaynenh commented Apr 2, 2020

Here's a link to the same issue in our build... minified css in this one: https://travis-ci.com/github/acquia/acquia_contenthub/jobs/311770019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants