Page MenuHomePhabricator

Make MediaWiki core pass mediawiki-codesniffer
Closed, ResolvedPublic


MediaWiki-Codesniffer (packagist, Gerrit) has improved considerably over the last few months and it's probably a good idea to make core pass the codesniffer tests.

  • Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
  • Generic.Files.EndFileNewline.NotFound
  • Generic.Files.LineLength
  • Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed
  • MediaWiki.NamingConventions.PrefixedGlobalFunctions.wfPrefix
  • MediaWiki.VariableAnalysis.UnusedGlobalVariables
  • MediaWiki.WhiteSpace.SpaceAfterControlStructure.Incorrect
  • MediaWiki.WhiteSpace.SpaceyParenthesis.SingleSpaceAfterOpenParenthesis
  • MediaWiki.WhiteSpace.SpaceyParenthesis.SingleSpaceBeforeCloseParenthesis
  • PSR2.Methods.MethodDeclaration.AbstractAfterVisibility
  • PSR2.Methods.MethodDeclaration.StaticBeforeVisibility
  • PSR2.Methods.MethodDeclaration.Underscore
  • PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter
  • Squiz.Classes.ValidClassName.NotCamelCaps
  • Squiz.WhiteSpace.ScopeClosingBrace.Indent
  • Squiz.WhiteSpace.SemicolonSpacing.Incorrect
  • Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines

After this, T102598 could happen and we could have mediawiki-codesniffer running as a voting jenkins job against master.

The output of mediawiki codesniffer running against core (at 3247aa82027) can be found at P789.
The output against core (at 03c1d480a7d) and ignoring languages/messages and languages/classes can be found at P815.

You can try this out yourself by running:
phpcs --standard=vendor/mediawiki/mediawiki-codesniffer/MediaWiki --extensions=php,php5,inc --ignore=vendor,extensions -p .

Related Objects

Event Timeline

polybuildr raised the priority of this task from to Needs Triage.
polybuildr updated the task description. (Show Details)

Change 219010 had a related patch set uploaded (by Umherirrender):
Fixed spacing

Change 219027 had a related patch set uploaded (by Paladox):
Fix phpcs warnings


languages/messages should only excluded from the long line check, the rest seems fine to check also in languages/classes

@Umherirrender, that is the plan. Since most of errors in the files in those directories are long line errors, I thought it would be a good idea to also show what the summary looks like without including that directory.

All other sniffs will certainly still run on those directories.

Any progress here / status update? :)

@Addshore, still some way to go. A few tasks were resolved a while back, but then I got occupied with my GSoC project. After my midterms end (a few days from now), I'll investigate this is more depth.

Change 241085 had a related patch set uploaded (by Jforrester):
Disable failing sniffs in phpcs.xml

Change 241085 merged by jenkins-bot:
phpcs: Disable failing sniffs in phpcs.xml

Change 241345 had a related patch set uploaded (by Umherirrender):
Re-enable last phpcs rule

Umherirrender added a subscriber: Umherirrender.

All issues in the current configuration are fixed and that means phpcs is passing mediawiki/core at the moment.

Change 241345 merged by jenkins-bot:
Re-enable last phpcs rule