Skip to content

4.0 | Removed feature support: error or warning ? #858

Closed
@jrfnl

Description

@jrfnl

In light of #857 and #184 (comment)...

In PHPCS 4.0, support will be dropped for a number of previously (partially) supported features, like JS/CSS only sniffs, sniffs not complying with the naming conventions, setting array properties using the old comma-separated string format etc.

Some related issues: #689, #693, #694, #740, #799

Most of these features are already soft deprecated and in the last PHPCS 3.x major, these features will get deprecation notices, in as far as possible (hard deprecation).

Support for these features will be removed in PHPCS 4.0.

The question I'm running into now: how to handle this for end-users in PHPCS 4.0 ?

The choice is basically between throwing an error, which will stop the PHPCS run with a non-zero exit code, or to show a warning and continue running PHPCS, but the results may not be as expected.

Some examples:

  • Use of a sniff which doesn't comply with the PHPCS naming conventions
    Should such a sniff be ignored by PHPCS with a warning ? Or should PHPCS stop running when such a sniff is included via the ruleset ? (error)
    A sniff being ignored, in practice means that some rules will not be enforced and that the results of the PHPCS run may not be as expected as some errors may not be reported.
  • Use of a sniff which doesn't explicitly implement the Sniff interface
    Should such a sniff be ignored by PHPCS with a warning ? Or should PHPCS stop running when such a sniff is included via the ruleset ? (error)
  • Use of the comma-separated string format for array properties
    Should the property setting be ignored with a warning ? Or should PHPCS stop running and throw an error ?
    An array property setting being ignored can lead to significant differences in the result of a sniff.
  • Requesting a sniff which has been removed in PHPCS 4.0
    While quite some sniffs will be removed in PHPCS 4.0 (JS/CSS/MySource), in principle, this situation is already handled in the Ruleset and currently would throw an error.
    If the other situations above would throw a warning and ignore the sniff, should this "Referenced sniff %s does not exist." error be changed to warning and ignore the sniff instead ?

Opinions ?

Originally, I intended to make these warnings, but now I'm not so sure that's the right way to handle this and I'm currently leaning to letting these all be errors. However, I'd very much like some second opinions on this.

/cc @asispts @dingo-d @fredden @GaryJones @greg0ire @kukulich @michalbundyra @Ocramius @sirbrillig @stronk7 @weierophinney @wimg

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions