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

Improve handling of disable/enable/ignore directives #123

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Dec 10, 2023

  1. Improve handling of disable/enable/ignore directives

    The current method, listing codes to disable and a list of exceptions to
    that list, still has trouble with some cases. For example, disabling a
    standard, re-enabling a category within that standard, then ignoring or
    disabling a sniff within that category cannot be handled. We'd need a
    list of exceptions to the exceptions, and possibly a list of exceptions
    to that list too, and figuring out how to keep those lists up to date as
    new directives are encountered could prove to be confusing.
    
    Since the standard→category→sniff→code hierarchy is supposed to be
    thought of as a tree, let's store the ignore list that way instead.
    Manipulating the branches of the tree is straightforward no matter what
    directives are encountered.
    
    In this implementation I've favored speed over space: there are cases
    where we could prune a subtree that would evaluate to "ignore" or "don't
    ignore" for any possible input, but detecting that doesn't seem worth
    the time when it's not likely there will be so many enable or disable
    directives that the wasted space will be a problem.
    
    Fixes PHPCSStandards#111
    anomiex committed Dec 10, 2023
    Configuration menu
    Copy the full SHA
    d8c5655 View commit details
    Browse the repository at this point in the history
  2. Make phpstan happy

    anomiex committed Dec 10, 2023
    Configuration menu
    Copy the full SHA
    7338e5a View commit details
    Browse the repository at this point in the history