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

Javascript files not being scanned by phpcs #75

Closed
hkirsman opened this issue Jun 10, 2022 · 6 comments
Closed

Javascript files not being scanned by phpcs #75

hkirsman opened this issue Jun 10, 2022 · 6 comments

Comments

@hkirsman
Copy link
Collaborator

Deivids Briedis discovered that deploy is complaining about issues in javascript files but running grumphp locally there are no errors.

It seems that the issue is that we've not added js as allowed extension for phpcs https://github.com/wunderio/code-quality/blob/master/src/Task/tasks.yml#L126

Should we change that?

@misterjoonas
Copy link
Member

Is phpcs supposed to check JS files? The validation errors are all about:
TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true" (Generic.PHP.UpperCaseConstant.Found)
but lowercase is used for boolean values in JS.

@hkirsman
Copy link
Collaborator Author

hkirsman commented Oct 28, 2022

Indeed, and TRUE is not even proper javascript. So this means we don't want to add js as default extension.

What I don't understand is how during deploy js files are scanned? Was it just a glitch?

@deiviic @misterjoonas

@deiviic
Copy link

deiviic commented Oct 28, 2022

@hkirsman Yes, it seems I missed the config when I initially investigated this but it's been fixed. I'm not sure why this issue didn't show up locally when running GrumPHP but only when running PHPCS separately.

https://github.com/wunderio/client-fi-lab-elab/commit/4e9a635adbd67c70a5918e946d1f356e9e95aeaf

@hkirsman
Copy link
Collaborator Author

Maybe you didn't use GrumpPHP and bypassed some of our default configs? With GrumPHP one can run specific task like this:

./vendor/bin/grumphp run --tasks=phpcs

@deiviic
Copy link

deiviic commented Oct 28, 2022

I just ran
lando grumphp run
and then found the issue when running phpcs independently of GrumPHP. Perhaps in that case some configs were bypassed but I remember using the phpcs.xml as the standard and it's also used in GrumPHP. In any case, the JS file exclusion was missing from the phpcs.xml file and now it's fixed. 🙂

@hkirsman
Copy link
Collaborator Author

hkirsman commented Oct 28, 2022

Ok, thanks.

I'll close this and create something new instead - adding ESLint to lint Drupal js with Drupal rules #84

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

No branches or pull requests

3 participants