-
-
Notifications
You must be signed in to change notification settings - Fork 460
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
Settle on coding convention for WPCS snfifs #256
Comments
@westonruter Do you have any preference for which CS we use? |
WPCS will be problematic due to the camelCase methods of PHPCS. So I think we'll have to use the PHPCS standards. |
That makes sense. It will also make it consistent when looking at Generic / Squiz and WP sniffs. |
I'd really much prefer if we use the WordPress standards, at least as far as whitespace goes. An added benefit of using WPCS itself, is that with an IDE like phpStorm you can see what is failing/succeeding when editing the
Honestly, I don't think that'd be such a good thing 😈. Seriously though, I think parity with WordPress's coding standards would be much easier on contributors, since that is what they'll be used to and probably expect. |
Just like PHPCS has a PHPCS Standard that itself follows, we can do the same with a WPCS standard, where we can mostly use the WordPress standard we're familiar with, but allow for camel case method names and other things needed as we extend PHPCS. |
+1
|
We already allow for camelCase in subclasses anyway (#307). So, are we saying, " |
Either way, but for the cleanup of all existing sniffs we just wouldn't want to make any headaches for any open pull requests. |
To be able to check it properly, I think all the sniffs have to be cleaned up, but minimising the effect on open PRs. If we're waiting on improved PRs, give PR authors a nudge to get it improved in the next couple of weeks. If the PRs is ready, get it merged into 0.4.0, then let's make 0.5.0 the version where we meet our own standards. FWIW, we only have six open PRs - three for @JDGrimes , one for @westonruter and two for @shadyvb so this is pretty much an internal nudge anyway. |
I think it will be much easier to update the sniffs to match the coding standards once we've implemented automatic error fixing for more of them (#388). Let's wait until then. |
There seems to be consensus about this - so what about setting up the standard and adding it to the travis build script ? |
@jrfnl I agree. Also, we can use wp-dev-lib's |
@westonruter Love the idea, just not all that sure how to implement it. Shell is definitely not my strong point. |
Result of an initial run isn't too bad if you take spaces vs tabs out of the equation. <rule ref="WordPress-Core">
<exclude name="Generic.Files.LowercasedFilename" />
<exclude name="WordPress.NamingConventions.ValidVariableName" />
</rule>
|
Just thinking: for me to try and figure out how to get the Do I have support for doing that (fixing the code style of the whole code base in one go) ? |
@jrfnl I've implemented this in #587. Once merged, it should then cause Travis to run a build on
(Above found via |
We could try using |
Personally, I'd prefer that we do that. I know that it can make history harder to traverse, but I find it more confusing when a project is inconsistent. But I'll leave it up to y'all. I'll be happy either way. 😄 |
My offer to do a nuclear clean up still stands. In that case we wouldn't need the additional dependency on the submodule. Either way is fine with me, but would be great if we could get to a decision some time within the next few days as it will impact the Theme Check fork/future PR if we want to create a semi-clean history on that end. |
I think it would be a benefit to use wp-dev-lib anyway, but regardless, if you want to do a nuclear clean up, go for it. Doing |
We should merge |
Scratch that. Looks like we don't have any open PRs that would cause conflicts. Go for it. |
Going for it ;-) Oh and I already made sure the open PR for the alternative open tags will comply with the standard. |
Unfortunately that doesn't work on Windows, but not to worry, got my own tricks, not my first rodeo. |
While I'm at it - shall I remove unused (commented out) code as well ? |
😀 starting to be able to tell who's worked on which file based on code style ;-) 1/3 down, 2/3 to go |
All done. Expect PR later today. |
PR submitted - #590 |
@westonruter Curious to hear what benefits this will bring other than the PR code style diff (which shouldn't be needed anymore now). |
See a446a38#commitcomment-8129539.
The text was updated successfully, but these errors were encountered: