Better directive handling #552

Merged
merged 4 commits into from Mar 6, 2016

Projects

None yet

2 participants

@za-creature
Contributor

Closes #540

Changes:

  1. Changes the semantics of coffeelint-enable:

    From: enables all rules that were previously disabled by a coffeelint-disable directive
    To: resets the ruleset to whatever was originally specified in coffeelint.json

    This is because the current implementation is buggy and mixes immutable with mutable structures. While there are ways around this, it makes the code needlessly complex and not that much useful.

    Example of existing bug

    # coffeelint: enable=no_implicit_parens
    # coffeelint: disable=no_implicit_parens
    # coffeelint: enable
    foo "bar"  # error
    # coffeelint: disable=no_implicit_parens
    # coffeelint: enable=no_implicit_parens
    # coffeelint: disable=no_implicit_parens
    # coffeelint: enable
    foo "bar"  # no error
  2. Adds the following directives that work like their parents but only for the current line

    • coffeelint-disable-line=foo,bar,baz
    • coffeelint-enable-line=foo,bar,baz
  3. Overloads coffeelint-disable to disable all registered rules. Primary use case:

    # coffeelint: disable
    do bad shit here
    # coffeelint: enable

    This contrasts with the primary use case for the parametric version which is:

    # coffeelint: disable=foo
    do shit "foo" would complain about
    # coffeelint: enable=foo
  4. Adds support for directive shortcuts. Also defines the first shortcut # noqa that expands into coffeelint: disable-line

@AsaAyers
Collaborator
AsaAyers commented Mar 6, 2016

Thanks for adding this.

@AsaAyers AsaAyers merged commit a8e7653 into clutchski:master Mar 6, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@za-creature za-creature deleted the za-creature:noqa branch Mar 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment