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

PHPCS exclusion list #2242

Open
truls1502 opened this issue Nov 24, 2018 · 4 comments
Open

PHPCS exclusion list #2242

truls1502 opened this issue Nov 24, 2018 · 4 comments

Comments

@truls1502
Copy link

It might be a duplicate of #1884 - but I am looking for a way to tell my PHPCS that they can ignore exactly same what it is listed on .gitignore. It will save a lot of time. Also, I would like to have a file which I can tell import .gitignore, and we can also add more in the list which is not filled on .gitignore.

What do you think?

@gsherwood
Copy link
Member

An option in the ruleset XML format to import a list of files/directories to exclude, which would allow you to specify your .gitignore file, might work. I don't think I'd want a dedicated CLI option to do this though.

@truls1502
Copy link
Author

@gsherwood, the option sounds a good idea. Do you have an example about how to import a list of file/directories to exclude in the ruleset XML format?

@gsherwood
Copy link
Member

Do you have an example about how to import a list of file/directories to exclude in the ruleset XML format?

Nothing currently exists in PHPCS to do this.

@mxr576
Copy link

mxr576 commented Jul 29, 2019

We would need something like this exactly in Drupal also. Did some digging and maybe if the excluded list of directories could be also specified in the CodeSniffer.conf file (https://github.com/squizlabs/PHP_CodeSniffer/blob/3.4.2/CodeSniffer.conf.dist) then a composer-plugin could automatically registers exclusion paths in a project from various sources, for example .gitignore(s), environment variables, etc.

https://github.com/Dealerdirect/phpcodesniffer-composer-installer plugin uses this file to auto-register available PHPCS configurations. The suggested composer plugin could also do the same with excluded paths.

n0099 added a commit to n0099/open-tbm that referenced this issue Sep 15, 2024
…it doesn't support using `.gitignore`: squizlabs/PHP_CodeSniffer#2242 @ .github/workflows/be_base.yml
n0099 added a commit to n0099/open-tbm that referenced this issue Sep 15, 2024
…it doesn't support using `.gitignore`: squizlabs/PHP_CodeSniffer#2242 @ .github/workflows/be_base.yml

* fix all violation of PHPStorm inspection `Unnecessary fully qualified name` @ be
n0099 added a commit to n0099/open-tbm that referenced this issue Sep 15, 2024
… and manually ignore `vendor` & `bootstrap/cache` when running `phpc{s,bf}` as it doesn't support `.gitignore`: squizlabs/PHP_CodeSniffer#2242

* add one space before self-closing tags @ phpunit.xml & psalm.xml
* fix all violation of PHPStorm inspection `Unnecessary fully qualified name`
$ ./vendor/bin/phpcbf . && ./vendor/bin/pint
@ be
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants