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

Fix usage of --standard parameter and make file extension behavior work like documented. #3

Closed
wants to merge 21 commits into from

Conversation

das-peter
Copy link

Hi there,

We're working on a Sniff for Drupal: http://drupal.org/project/drupalcs
While doing so we came across two issues I fixed in this commit.

  1. File Extensions:
    Bug: https://pear.php.net/bugs/bug.php?id=19246
    Drupal Issue: http://drupal.org/node/1414902#comment-5507580
    According to the advanced usage documentation (http://pear.php.net/manual/en/package.php.php-codesniffer.advanced-usage.php) extensions are ignored if a file is explicitly passed. That's not the case atm. we should decide whether to change the code (my favourite) or the documentation.
  2. Use a path as --standard
    Bug: http://pear.php.net/bugs/bug.php?id=19144 (Not sure if really related)
    Drupal Issue: http://drupal.org/node/1354722
    Currently it's impossible to use the own standard in the ruleset.xml if --standard is set to a file path. The autoloader as well as PHP_CodeSniffer::_expandRulesetReference() throw errors doing so.

Feedback would be very welcome :)

Thanks
Peter

@gsherwood
Copy link

For 1, see my comment on the bug report.

For 2, I don't really know what you are asking. You can already specify a full path to a ruleset.xml file on the command line using --standard. If you happen to have your own sniffs and a directory to put them in, you specify the directory name and not the ruleset path. But I'm not entirely sure if that is what you are doing.

Also note that I don't maintain this fork of PHP_CodeSniffer. Please submit all pull requests to https://github.com/squizlabs/PHP_CodeSniffer where I maintain the actually PHPCS source.

Thanks

illusori and others added 20 commits February 10, 2012 22:38
…mework

The list-style… lines were correctly merging their tokens in the CSS tokenizer post-processing but the tokenizer was not going through the curly braces and fixing up the open/close token IDs after removing a token from the array, so those values were invalid.

There is now also an additional check in the PHP tokenizer during post-processing to skip functions without openers. This happens when closures are used inside other function calls. The tokenizer still needs to find some way to parse the code in there, but that's going to be a bit tricky, so muting the notices is fine for now as behaviour doesn't change. Related bug report #19188 is still open for this additional parsing.
@CloCkWeRX
Copy link
Member

Sorry about the confusion folks - I created this fork so we could make use of jenkins - Greg's cherry picked the commits he wants out of it, so his is most definately the best place for pull requests :)

@CloCkWeRX CloCkWeRX closed this Feb 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants