- Notifications
You must be signed in to change notification settings - Fork 23
Support Drupal and WordPress Code Standards #34
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
Support Drupal and WordPress Code Standards #34
Conversation
| I tested this similar to how I did here: #31 (comment) The container does build and the code standards for both WordPress and Drupal appear to be supported. However, there seems to be a discrepancy between what PHPCS discovers running locally vs in the container. I compared the results of running codeclimate analyze with running: Here are the results:
Any thoughts? |
| Hi @josephdpurcell it's hard to say without knowing what the missing 60/403 issues are. Some things I know of off the top of my head:
|
| The engine also ignores warnings by default unless you've updated your phpcodesniffer: enabled: true config: standard: "Drupal" ignore_warnings: false |
| Hey @josephdpurcell, I did some digging and found the discrepancy to be caused by slightly different versions of PHPCS and the underlying standard packages. You can see differences in known rules by comparing the output of A solution would be to better lock down the versions of packages installed. I think the following { "require": { "squizlabs/php_codesniffer": "2.6.1", "barracudanetworks/forkdaemon-php": "1.0.7", "danielstjules/stringy": "2.3.2", "drupal/coder": "8.2.7", "wp-coding-standards/wpcs": "0.9.0" } } |
| I have redone the test given the above input, here is the (Due to pastebin character limit, I'm using the drupal-replication repo instead.) Here is the output from phpcs: http://pastebin.com/nNiBGJZE Number of errors:
Here is how I calculated for PHPCS:
Comparing the output, it looks like perhaps Code Climate isn't accounting for warnings even with the Assuming that is the case, I re-ran PHPCS with End of my analysis I am left with:
I'll investigate more later if I have time. |
| Ah! That would explain it. I'll compare versions and retry the checks to verify. |
| That was it! Here is how I checked: Assuming 327 == 327 and I'm not missing something different that should be obvious, I think this PR is good to go! |
| Oh! There's the question of the composer.json and what it should be set to. I'm not sure what is best: on the one hand, leaving the versions loose gives the opportunity for a composer update to pull in latest updates, on the other hand doing so will result in variations in GPAs on projects. I think down the road it would be nice to be able to specify which version of code standards the project is compliant against, but for now my thought is that ^8.2 and ^0.9 is reasonable--assuming semantic versioning, perhaps those should hold until the next major versions of those projects, Drupal 9 and WordPress 5? |
| That sounds good to me. Something like this perhaps? { "require": { "squizlabs/php_codesniffer": "^2.5", "barracudanetworks/forkdaemon-php": "^1.0", "danielstjules/stringy": "^2.3", "drupal/coder": "^8.2", "wp-coding-standards/wpcs": "^0.9" } } |
| Sure. I updated the composer.json, but I did not update the specified version in the lock file. I figure it would be best to isolate updates to dependent libraries from this PR. |
| LGTM |
This PR should address #30 and #15.
This PR is an alternative to #31 and #29.