Page MenuHomePhabricator

Standardize line length enforcement in CheckUser
Closed, ResolvedPublic

Description

Background

During sprint planning, the team discussed line length standards for CheckUser. The existing linter configuration (inherited from mediawiki-codesniffer) sets a warning at 120 characters returning a CLI exit code, but the hard limit error is at 9999, creating ambiguity about what is required vs. optional in code reviews.

Problem

Without a documented and enforced standard, reviewers had no clear basis for when to raise or ignore line length comments, leading to inconsistent review feedback.

Event Timeline

Dreamy_Jazz subscribed.

The existing linter configuration (inherited from mediawiki-codesniffer) sets a soft warning at 120 characters but no hard error

mediawiki-codesniffer in PHP sets 120 chars as a hard limit, which you have to specifically ignore because otherwise the tests will fail in CI and prevent merging. Is this not PHP you are talking about?

Change #1259980 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/CheckUser@master] Enforce 120-char line length limit in CheckUser

https://gerrit.wikimedia.org/r/1259980

The existing linter configuration (inherited from mediawiki-codesniffer) sets a soft warning at 120 characters but no hard error

mediawiki-codesniffer in PHP sets 120 chars as a hard limit, which you have to specifically ignore because otherwise the tests will fail in CI and prevent merging. Is this not PHP you are talking about?

Yes, you're right that a lineLimit warning causes composer phpcs to fail, so in practice long lines do block CI unless suppressed with // phpcs:ignore Generic.Files.LineLength.TooLong .
However, mediawiki-codesniffer sets lineLimit=120 (a warning) and absoluteLineLimit=9999 (effectively no hard error).
So in essence phpcs:ignore Generic.Files.LineLength.TooLong suppresses only the warning, not an absolute error.

I've updated the description.

Change #1260745 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/CheckUser@master] Add coding conventions, php-cs-fixer, and reformat arg lists

https://gerrit.wikimedia.org/r/1260745

Change #1259980 abandoned by Mpostoronca:

[mediawiki/extensions/CheckUser@master] Change 120-char line length limit warning to error

https://gerrit.wikimedia.org/r/1259980

Change #1261386 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/tools/codesniffer@master] Add EnsureFullyMultilineSniff for multiline arg lists

https://gerrit.wikimedia.org/r/1261386

Change #1260745 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Add coding conventions, php-cs-fixer, and reformat arg lists

https://gerrit.wikimedia.org/r/1260745

Change #1261386 abandoned by Mpostoronca:

[mediawiki/tools/codesniffer@master] Add EnsureFullyMultilineSniff for multiline arg lists

https://gerrit.wikimedia.org/r/1261386

Change #1265373 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/CheckUser@master] Add php-cs-fixer to enforce fully multiline argument lists

https://gerrit.wikimedia.org/r/1265373

Change #1265373 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Add php-cs-fixer to enforce fully multiline argument lists

https://gerrit.wikimedia.org/r/1265373

Change #1268973 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/CheckUser@master] Fix linting

https://gerrit.wikimedia.org/r/1268973

Change #1268973 abandoned by Mpostoronca:

[mediawiki/extensions/CheckUser@master] Fix linting

https://gerrit.wikimedia.org/r/1268973

Change #1268977 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/CheckUser@master] Fix linting

https://gerrit.wikimedia.org/r/1268977

Change #1268977 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Fix linting

https://gerrit.wikimedia.org/r/1268977