Page MenuHomePhabricator

Make MediaWiki core pass mediawiki-codesniffer
Closed, ResolvedPublic

Description

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 .

Details

Related Gerrit Patches:
mediawiki/core : masterRe-enable last phpcs rule
mediawiki/core : masterphpcs: Disable failing sniffs in phpcs.xml
mediawiki/core : masterFixed spacing

Related Objects

Event Timeline

polybuildr raised the priority of this task from to Needs Triage.
polybuildr updated the task description. (Show Details)
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 16 2015, 12:05 PM

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

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

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

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

Change 219010 merged by jenkins-bot:
Fixed spacing

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

hashar removed a subscriber: hashar.Jun 18 2015, 12:55 PM
polybuildr updated the task description. (Show Details)Jun 20 2015, 8:35 PM
polybuildr set Security to None.

--ignore=vendor,extensions,skins,languages/classes,languages/messages

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.

Ricordisamoa added a subscriber: Ricordisamoa.
greg awarded a token.Sep 25 2015, 10:21 PM
greg added a subscriber: greg.

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

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

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

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

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

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

Umherirrender closed this task as Resolved.Oct 14 2015, 5:12 PM
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

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