diff --git a/src/lint/linter/__tests__/ArcanistLinterTestCase.php b/src/lint/linter/__tests__/ArcanistLinterTestCase.php --- a/src/lint/linter/__tests__/ArcanistLinterTestCase.php +++ b/src/lint/linter/__tests__/ArcanistLinterTestCase.php @@ -75,8 +75,8 @@ $config, array( 'config' => 'optional map', - 'path' => 'optional string', 'mode' => 'optional string', + 'path' => 'optional string', 'stopped' => 'optional bool', )); @@ -171,81 +171,131 @@ $this->compareTransform($xform, $after_lint); } - private function compareLint($file, $expect, ArcanistLintResult $result) { - $seen = array(); - $raised = array(); - $message_map = array(); - - foreach ($result->getMessages() as $message) { - $sev = $message->getSeverity(); - $line = $message->getLine(); - $char = $message->getChar(); - $code = $message->getCode(); - $name = $message->getName(); - $message_key = $sev.':'.$line.':'.$char; - $message_map[$message_key] = $message; - $seen[] = $message_key; - $raised[] = sprintf( - ' %s: %s %s', - pht('%s at line %d, char %d', $sev, $line, $char), - $code, - $name); - } + private function compareLint($file, $expect, ArcanistLintResult $results) { + $expected_results = new ArcanistLintResult(); + $expect = trim($expect); if ($expect) { $expect = explode("\n", $expect); } else { $expect = array(); } - foreach ($expect as $key => $expected) { - $expect[$key] = head(explode(' ', $expected)); - } - $expect = array_fill_keys($expect, true); - $seen = array_fill_keys($seen, true); + foreach ($expect as $result) { + $parts = explode(':', $result); + + $message = new ArcanistLintMessage(); + + $severity = idx($parts, 0); + $line = idx($parts, 1); + $char = idx($parts, 2); + $code = idx($parts, 3); + + if ($severity !== null) { + $message->setSeverity($severity); + } + + if ($line !== null) { + $message->setLine($line); + } + + if ($char !== null) { + $message->setChar($char); + } + + if ($code !== null) { + $message->setCode($code); + } - if (!$raised) { - $raised = array(pht('No messages.')); + $expected_results->addMessage($message); } - $raised = sprintf( - "%s:\n%s", - pht('Actually raised'), - implode("\n", $raised)); - foreach (array_diff_key($expect, $seen) as $missing => $ignored) { - $missing = explode(':', $missing); - $sev = array_shift($missing); - $pos = $missing; + $missing = array(); + $surprising = $results->getMessages(); - $this->assertFailure( - pht( - "In '%s', expected lint to raise %s on line %d at char %d, ". - "but no %s was raised. %s", - $file, - $sev, - idx($pos, 0), - idx($pos, 1), - $sev, - $raised)); + // TODO: Make this more efficient. + foreach ($expected_results->getMessages() as $expected_message) { + $found = false; + + foreach ($results->getMessages() as $ii => $actual_message) { + if (!self::compareLintMessageProperty( + $expected_message->getSeverity(), + $actual_message->getSeverity())) { + + continue; + } + + if (!self::compareLintMessageProperty( + $expected_message->getLine(), + $actual_message->getLine())) { + + continue; + } + + if (!self::compareLintMessageProperty( + $expected_message->getChar(), + $actual_message->getChar())) { + + continue; + } + + if (!self::compareLintMessageProperty( + $expected_message->getCode(), + $actual_message->getCode())) { + + continue; + } + + $found = true; + unset($surprising[$ii]); + } + + if (!$found) { + $missing[] = $expected_message; + } } - foreach (array_diff_key($seen, $expect) as $surprising => $ignored) { - $message = $message_map[$surprising]; - $message_info = $message->getDescription(); + if ($missing || $surprising) { + $expected = pht('EXPECTED MESSAGES'); + if ($missing) { + foreach ($missing as $message) { + $expected .= sprintf( + "\n %s: %s %s", + pht( + '%s at line %d, char %d', + $message->getSeverity(), + $message->getLine(), + $message->getChar()), + $message->getCode(), + $message->getName()); + } + } else { + $expected .= "\n ".pht('No messages'); + } + + $actual = pht('UNEXPECTED MESSAGES'); + if ($surprising) { + foreach ($surprising as $message) { + $actual .= sprintf( + "\n %s: %s %s", + pht( + '%s at line %d, char %d', + $message->getSeverity(), + $message->getLine(), + $message->getChar()), + $message->getCode(), + $message->getName()); + } + } else { + $actual .= "\n ".pht('No messages'); + } - list($sev, $line, $char) = explode(':', $surprising); $this->assertFailure( sprintf( - "%s:\n\n%s\n\n%s", - pht( - "In '%s', lint raised %s on line %d at char %d, ". - "but nothing was expected", - $file, - $sev, - $line, - $char), - $message_info, - $raised)); + "%s\n\n%s\n\n%s", + pht("Lint failed for '%s'.", $file), + $expected, + $actual)); } } @@ -259,4 +309,18 @@ pht('File as patched by lint did not match the expected patched file.')); } + /** + * Compare properties of @{class:ArcanistLintMessage} instances. + * + * The expectation is that if one (or both) of the properties is null, then + * we don't care about its value. + * + * @param wild + * @param wild + * @return bool + */ + private static function compareLintMessageProperty($x, $y) { + return $x === null || $y === null || $x === $y; + } + } diff --git a/src/lint/linter/__tests__/chmod/empty_executable.lint-test b/src/lint/linter/__tests__/chmod/empty_executable.lint-test --- a/src/lint/linter/__tests__/chmod/empty_executable.lint-test +++ b/src/lint/linter/__tests__/chmod/empty_executable.lint-test @@ -1,5 +1,5 @@ ~~~~~~~~~~ -warning:: +warning:0:0:CHMOD1:Invalid Executable ~~~~~~~~~~ ~~~~~~~~~~ {"mode": "0755"} diff --git a/src/lint/linter/__tests__/coffeelint/no_trailing_whitespace.lint-test b/src/lint/linter/__tests__/coffeelint/no_trailing_whitespace.lint-test --- a/src/lint/linter/__tests__/coffeelint/no_trailing_whitespace.lint-test +++ b/src/lint/linter/__tests__/coffeelint/no_trailing_whitespace.lint-test @@ -1,4 +1,4 @@ x = 1234 y = 1 ~~~~~~~~~~ -error:1: +error:1:0 diff --git a/src/lint/linter/__tests__/filename/bad_filename.lint-test b/src/lint/linter/__tests__/filename/bad_filename.lint-test --- a/src/lint/linter/__tests__/filename/bad_filename.lint-test +++ b/src/lint/linter/__tests__/filename/bad_filename.lint-test @@ -1,5 +1,5 @@ ~~~~~~~~~~ -error:: +error:0:0:NAME1:Bad Filename ~~~~~~~~~~ ~~~~~~~~~~ {"path": "bad@filename"} diff --git a/src/lint/linter/__tests__/flake8/undefined.lint-test b/src/lint/linter/__tests__/flake8/undefined.lint-test --- a/src/lint/linter/__tests__/flake8/undefined.lint-test +++ b/src/lint/linter/__tests__/flake8/undefined.lint-test @@ -3,5 +3,5 @@ def hello(): return foo ~~~~~~~~~~ -error:3:1 -error:4:12 +error:3:1:E302 +error:4:12:F821 diff --git a/src/lint/linter/__tests__/jshint/dot-notation.lint-test b/src/lint/linter/__tests__/jshint/dot-notation.lint-test --- a/src/lint/linter/__tests__/jshint/dot-notation.lint-test +++ b/src/lint/linter/__tests__/jshint/dot-notation.lint-test @@ -2,5 +2,5 @@ args['foo'] = 'bar'; args['bar'] = 'baz'; ~~~~~~~~~~ -warning:2:5 -warning:3:5 +warning:2:5:W069 +warning:3:5:W069 diff --git a/src/lint/linter/__tests__/jshint/expected-conditional.lint-test b/src/lint/linter/__tests__/jshint/expected-conditional.lint-test --- a/src/lint/linter/__tests__/jshint/expected-conditional.lint-test +++ b/src/lint/linter/__tests__/jshint/expected-conditional.lint-test @@ -3,4 +3,4 @@ return true; } ~~~~~~~~~~ -warning:2:16 +warning:2:16:W084 diff --git a/src/lint/linter/__tests__/jshint/jshint.lint-test b/src/lint/linter/__tests__/jshint/jshint.lint-test --- a/src/lint/linter/__tests__/jshint/jshint.lint-test +++ b/src/lint/linter/__tests__/jshint/jshint.lint-test @@ -7,6 +7,6 @@ { ~~~~~~~~~~ -warning:3:8 -error:7:1 -error:9:1 +warning:3:8:W033 +error:7:1:E019 +error:9:1:E041 diff --git a/src/lint/linter/__tests__/jshint/missing-semicolon.lint-test b/src/lint/linter/__tests__/jshint/missing-semicolon.lint-test --- a/src/lint/linter/__tests__/jshint/missing-semicolon.lint-test +++ b/src/lint/linter/__tests__/jshint/missing-semicolon.lint-test @@ -1,3 +1,3 @@ console.log('foobar') ~~~~~~~~~~ -warning:1:22 +warning:1:22:W033 diff --git a/src/lint/linter/__tests__/jshint/too-many-errors.lint-test b/src/lint/linter/__tests__/jshint/too-many-errors.lint-test --- a/src/lint/linter/__tests__/jshint/too-many-errors.lint-test +++ b/src/lint/linter/__tests__/jshint/too-many-errors.lint-test @@ -1,5 +1,5 @@ /* jshint maxerr: 1 */ console.log('foobar') ~~~~~~~~~~ -disabled:2:22 -warning:2:22 +disabled:2:22:E043 +warning:2:22:W033 diff --git a/src/lint/linter/__tests__/jshint/unnecessary-semicolon.lint-test b/src/lint/linter/__tests__/jshint/unnecessary-semicolon.lint-test --- a/src/lint/linter/__tests__/jshint/unnecessary-semicolon.lint-test +++ b/src/lint/linter/__tests__/jshint/unnecessary-semicolon.lint-test @@ -2,4 +2,4 @@ return 'Hello, World!'; }; ~~~~~~~~~~ -warning:3:2 +warning:3:2:W032 diff --git a/src/lint/linter/__tests__/mergeconflict/mergeconflict.lint-test b/src/lint/linter/__tests__/mergeconflict/mergeconflict.lint-test --- a/src/lint/linter/__tests__/mergeconflict/mergeconflict.lint-test +++ b/src/lint/linter/__tests__/mergeconflict/mergeconflict.lint-test @@ -7,4 +7,4 @@ >>>>>>> branch2 } ~~~~~~~~~~ -error:5:1 +error:5:1:MERGECONFLICT1:Unresolved merge conflict diff --git a/src/lint/linter/__tests__/pep8/imports.lint-test b/src/lint/linter/__tests__/pep8/imports.lint-test --- a/src/lint/linter/__tests__/pep8/imports.lint-test +++ b/src/lint/linter/__tests__/pep8/imports.lint-test @@ -1,3 +1,3 @@ import os, sys ~~~~~~~~~~ -error:1:10 +error:1:10:E401 diff --git a/src/lint/linter/__tests__/php/fatal.lint-test b/src/lint/linter/__tests__/php/fatal.lint-test --- a/src/lint/linter/__tests__/php/fatal.lint-test +++ b/src/lint/linter/__tests__/php/fatal.lint-test @@ -4,4 +4,4 @@ $this = "cannot be re-assigned"; } ~~~~~~~~~ -error:4: +error:4:0:PHP2:Fatal Error diff --git a/src/lint/linter/__tests__/php/syntax.lint-test b/src/lint/linter/__tests__/php/syntax.lint-test --- a/src/lint/linter/__tests__/php/syntax.lint-test +++ b/src/lint/linter/__tests__/php/syntax.lint-test @@ -4,4 +4,4 @@ this is bad syntax; } ~~~~~~~~~ -error:4: +error:4:0:PHP1:Parse Error diff --git a/src/lint/linter/__tests__/pyflakes/pyflakes.lint-test b/src/lint/linter/__tests__/pyflakes/pyflakes.lint-test --- a/src/lint/linter/__tests__/pyflakes/pyflakes.lint-test +++ b/src/lint/linter/__tests__/pyflakes/pyflakes.lint-test @@ -2,6 +2,6 @@ x += 1 ~~~~~~~~~~ -warning:1: -warning:1: -error:3: +warning:1:0 +warning:1:0 +error:3:0 diff --git a/src/lint/linter/__tests__/pylint/negativechar.lint-test b/src/lint/linter/__tests__/pylint/negativechar.lint-test --- a/src/lint/linter/__tests__/pylint/negativechar.lint-test +++ b/src/lint/linter/__tests__/pylint/negativechar.lint-test @@ -3,4 +3,4 @@ """ Useless string """ ~~~~~~~~~~ -warning:4:0 See T9257. +warning:4:0:W0105:Pointless String Statement diff --git a/src/lint/linter/__tests__/pylint/pylint.lint-test b/src/lint/linter/__tests__/pylint/pylint.lint-test --- a/src/lint/linter/__tests__/pylint/pylint.lint-test +++ b/src/lint/linter/__tests__/pylint/pylint.lint-test @@ -2,6 +2,8 @@ x += 1 ~~~~~~~~~~ -warning:1:0 -advice:1:0 -error:3:0 +advice:1:0:C0111:Missing Docstring +advice:1:0:C0410:Multiple Imports +warning:1:0:W0611:Unused Import +warning:1:0:W0611:Unused Import +error:3:0:E0602:Undefined Variable diff --git a/src/lint/linter/__tests__/rubocop/convention.lint-test b/src/lint/linter/__tests__/rubocop/convention.lint-test --- a/src/lint/linter/__tests__/rubocop/convention.lint-test +++ b/src/lint/linter/__tests__/rubocop/convention.lint-test @@ -1,4 +1,4 @@ def hello() end ~~~~~~~~~~ -warning:1:10 +warning:1:10:- diff --git a/src/lint/linter/__tests__/ruby/hello.lint-test b/src/lint/linter/__tests__/ruby/hello.lint-test --- a/src/lint/linter/__tests__/ruby/hello.lint-test +++ b/src/lint/linter/__tests__/ruby/hello.lint-test @@ -1,4 +1,4 @@ def hello() puts "hello world" ~~~~~~~~~~ -error:2: +error:2:0:RUBY:Syntax Error diff --git a/src/lint/linter/__tests__/spelling/spell.lint-test b/src/lint/linter/__tests__/spelling/spell.lint-test --- a/src/lint/linter/__tests__/spelling/spell.lint-test +++ b/src/lint/linter/__tests__/spelling/spell.lint-test @@ -10,11 +10,11 @@ Added ZZZZsupermnZZZZ Added full batmn batmnZZZZ ~~~~~~~~~~ -warning:2:1 -warning:4:10 -warning:5:15 -warning:7:7 -warning:7:12 -warning:9:15 -warning:10:11 -warning:11:12 +warning:2:1:SPELL1:Possible Spelling Mistake +warning:4:10:SPELL2:Possible Spelling Mistake +warning:5:15:SPELL2:Possible Spelling Mistake +warning:7:7:SPELL2:Possible Spelling Mistake +warning:7:12:SPELL2:Possible Spelling Mistake +warning:9:15:SPELL1:Possible Spelling Mistake +warning:10:11:SPELL2:Possible Spelling Mistake +warning:11:12:SPELL1:Possible Spelling Mistake diff --git a/src/lint/linter/__tests__/text/bad-charset.lint-test b/src/lint/linter/__tests__/text/bad-charset.lint-test --- a/src/lint/linter/__tests__/text/bad-charset.lint-test +++ b/src/lint/linter/__tests__/text/bad-charset.lint-test @@ -1,3 +1,3 @@ ❤♎☀★☂♞ ~~~~~~~~~~ -error:1:1 +error:1:1:TXT5:Bad Charset diff --git a/src/lint/linter/__tests__/text/bof-whitespace-1.lint-test b/src/lint/linter/__tests__/text/bof-whitespace-1.lint-test --- a/src/lint/linter/__tests__/text/bof-whitespace-1.lint-test +++ b/src/lint/linter/__tests__/text/bof-whitespace-1.lint-test @@ -4,6 +4,6 @@ The quick brown fox jumps over the lazy dog. ~~~~~~~~~~ -autofix:1:1 +autofix:1:1:TXT8:Leading Whitespace at BOF ~~~~~~~~~~ The quick brown fox jumps over the lazy dog. diff --git a/src/lint/linter/__tests__/text/dos-newline.lint-test b/src/lint/linter/__tests__/text/dos-newline.lint-test --- a/src/lint/linter/__tests__/text/dos-newline.lint-test +++ b/src/lint/linter/__tests__/text/dos-newline.lint-test @@ -1,7 +1,7 @@ The quick brown fox jumps over the lazy dog. ~~~~~~~~~~ -error:1:1 +error:1:1:TXT1:DOS Newlines ~~~~~~~~~~ The quick brown fox jumps over the lazy dog. diff --git a/src/lint/linter/__tests__/text/empty.lint-test b/src/lint/linter/__tests__/text/empty.lint-test --- a/src/lint/linter/__tests__/text/empty.lint-test +++ b/src/lint/linter/__tests__/text/empty.lint-test @@ -1,4 +1,4 @@ ~~~~~~~~~~ -error:: +error:0:0:TXT10:Empty File diff --git a/src/lint/linter/__tests__/text/eof-whitespace.lint-test b/src/lint/linter/__tests__/text/eof-whitespace.lint-test --- a/src/lint/linter/__tests__/text/eof-whitespace.lint-test +++ b/src/lint/linter/__tests__/text/eof-whitespace.lint-test @@ -4,6 +4,6 @@ ~~~~~~~~~~ -autofix:2:1 +autofix:2:1:TXT9:Trailing Whitespace at EOF ~~~~~~~~~~ The quick brown fox jumps over the lazy dog. diff --git a/src/lint/linter/__tests__/text/line-wrap.lint-test b/src/lint/linter/__tests__/text/line-wrap.lint-test --- a/src/lint/linter/__tests__/text/line-wrap.lint-test +++ b/src/lint/linter/__tests__/text/line-wrap.lint-test @@ -1,6 +1,6 @@ The quick brown fox jumps over the lazy dog. ~~~~~~~~~~ -warning:1:1 +warning:1:1:TXT3:Line Too Long ~~~~~~~~~~ ~~~~~~~~~~ {"config": {"text.max-line-length": 40}} diff --git a/src/lint/linter/__tests__/text/trailing-whitespace-1.lint-test b/src/lint/linter/__tests__/text/trailing-whitespace-1.lint-test --- a/src/lint/linter/__tests__/text/trailing-whitespace-1.lint-test +++ b/src/lint/linter/__tests__/text/trailing-whitespace-1.lint-test @@ -1,8 +1,8 @@ The quick brown fox jumps over the lazy dog. ~~~~~~~~~~ -autofix:1:20 -autofix:2:25 +autofix:1:20:TXT6:Trailing Whitespace +autofix:2:25:TXT6:Trailing Whitespace ~~~~~~~~~~ The quick brown fox jumps over the lazy dog. diff --git a/src/lint/linter/__tests__/text/trailing-whitespace-2.lint-test b/src/lint/linter/__tests__/text/trailing-whitespace-2.lint-test --- a/src/lint/linter/__tests__/text/trailing-whitespace-2.lint-test +++ b/src/lint/linter/__tests__/text/trailing-whitespace-2.lint-test @@ -3,11 +3,11 @@ Phasellus sodales nibh erat, in hendrerit nulla dictum interdum. ~~~~~~~~~~ -error:1:28 -autofix:1:28 -autofix:2:29 -autofix:3:29 -autofix:4:36 +error:1:28:TXT2:Tab Literal +autofix:1:28:TXT6:Trailing Whitespace +autofix:2:29:TXT6:Trailing Whitespace +autofix:3:29:TXT6:Trailing Whitespace +autofix:4:36:TXT6:Trailing Whitespace ~~~~~~~~~~ Lorem ipsum dolor sit amet, consectetur adipiscing elit. diff --git a/src/lint/linter/__tests__/text/trailing-whitespace-3.lint-test b/src/lint/linter/__tests__/text/trailing-whitespace-3.lint-test --- a/src/lint/linter/__tests__/text/trailing-whitespace-3.lint-test +++ b/src/lint/linter/__tests__/text/trailing-whitespace-3.lint-test @@ -3,11 +3,11 @@ Phasellus sodales nibh erat, in hendrerit nulla dictum interdum. ~~~~~~~~~~ -error:1:28 -autofix:1:28 -autofix:2:29 -autofix:3:29 -autofix:4:36 +error:1:28:TXT2:Tab Literal +autofix:1:28:TXT6:Trailing Whitespace +autofix:2:29:TXT6:Trailing Whitespace +autofix:3:29:TXT6:Trailing Whitespace +autofix:4:36:TXT6:Trailing Whitespace ~~~~~~~~~~ Lorem ipsum dolor sit amet, consectetur adipiscing elit. diff --git a/src/lint/linter/__tests__/xhpast/embedded-tags.lint-test b/src/lint/linter/__tests__/xhpast/embedded-tags.lint-test --- a/src/lint/linter/__tests__/xhpast/embedded-tags.lint-test +++ b/src/lint/linter/__tests__/xhpast/embedded-tags.lint-test @@ -2,4 +2,4 @@ This shouldn't fatal the parser. ~~~~~~~~~~ -disabled:2:1 +disabled:2:1:XHP78:Inline HTML diff --git a/src/lint/linter/__tests__/xhpast/empty.lint-test b/src/lint/linter/__tests__/xhpast/empty.lint-test --- a/src/lint/linter/__tests__/xhpast/empty.lint-test +++ b/src/lint/linter/__tests__/xhpast/empty.lint-test @@ -1,4 +1,4 @@ ~~~~~~~~~~ -error:2:1 +error:2:1:XML4:LibXML Error diff --git a/src/lint/linter/__tests__/xml/char-ref.lint-test b/src/lint/linter/__tests__/xml/char-ref.lint-test --- a/src/lint/linter/__tests__/xml/char-ref.lint-test +++ b/src/lint/linter/__tests__/xml/char-ref.lint-test @@ -1,3 +1,3 @@ ~~~~~~~~~~ -error:1:63 +error:1:63:XML9:LibXML Error diff --git a/src/lint/linter/__tests__/xml/languages-5.lint-test b/src/lint/linter/__tests__/xml/languages-5.lint-test --- a/src/lint/linter/__tests__/xml/languages-5.lint-test +++ b/src/lint/linter/__tests__/xml/languages-5.lint-test @@ -3,4 +3,4 @@ <> ~~~~~~~~~~ -error:3:6 +error:3:6:XML68:LibXML Error diff --git a/src/lint/linter/__tests__/xml/languages-6.lint-test b/src/lint/linter/__tests__/xml/languages-6.lint-test --- a/src/lint/linter/__tests__/xml/languages-6.lint-test +++ b/src/lint/linter/__tests__/xml/languages-6.lint-test @@ -3,5 +3,5 @@ ~~~~~~~~~~ -error:3:16 -error:4:1 +error:3:16:XML76:LibXML Error +error:4:1:XML5:LibXML Error diff --git a/src/lint/linter/xhpast/rules/__tests__/__lambda_func-function/lamba-func-function.lint-test b/src/lint/linter/xhpast/rules/__tests__/__lambda_func-function/lamba-func-function.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/__lambda_func-function/lamba-func-function.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/__lambda_func-function/lamba-func-function.lint-test @@ -2,4 +2,4 @@ function __lambda_func() {} ~~~~~~~~~~ -error:3:1 +error:3:1:XHP68:`__lambda_func` Function diff --git a/src/lint/linter/xhpast/rules/__tests__/__toString-exception/__toString-exception.lint-test b/src/lint/linter/xhpast/rules/__tests__/__toString-exception/__toString-exception.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/__toString-exception/__toString-exception.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/__toString-exception/__toString-exception.lint-test @@ -24,4 +24,4 @@ abstract public function __toString(); } ~~~~~~~~~~ -error:6:7 +error:6:7:XHP67:Throwing Exception in `__toString` Method diff --git a/src/lint/linter/xhpast/rules/__tests__/abstract-method-body/body.lint-test b/src/lint/linter/xhpast/rules/__tests__/abstract-method-body/body.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/abstract-method-body/body.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/abstract-method-body/body.lint-test @@ -3,4 +3,4 @@ abstract public function someMethod() {} } ~~~~~~~~~~ -error:3:41 +error:3:41:XHP108:`abstract` Method Cannot Contain Body diff --git a/src/lint/linter/xhpast/rules/__tests__/abstract-private-method/abstract-private-method.lint-test b/src/lint/linter/xhpast/rules/__tests__/abstract-private-method/abstract-private-method.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/abstract-private-method/abstract-private-method.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/abstract-private-method/abstract-private-method.lint-test @@ -3,4 +3,4 @@ private abstract function someMethod(); } ~~~~~~~~~~ -error:3:3 +error:3:3:XHP107:`abstract` Method Cannot Be Declared `private` diff --git a/src/lint/linter/xhpast/rules/__tests__/alias-functions/alias-functions.lint-test b/src/lint/linter/xhpast/rules/__tests__/alias-functions/alias-functions.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/alias-functions/alias-functions.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/alias-functions/alias-functions.lint-test @@ -5,9 +5,9 @@ die(); sizeOf($x); ~~~~~~~~~~ -advice:4:1 -advice:5:1 -advice:6:1 +advice:4:1:XHP65:Alias Functions +advice:5:1:XHP65:Alias Functions +advice:6:1:XHP65:Alias Functions ~~~~~~~~~~ $y, ); ~~~~~~~~~~ -warning:4:9 -warning:5:10 -warning:6:9 -warning:16:5 +warning:4:9:XHP27:Space Around Binary Operator +warning:5:10:XHP27:Space Around Binary Operator +warning:6:9:XHP27:Space Around Binary Operator +warning:16:5:XHP27:Space Around Binary Operator ~~~~~~~~~~ 'var2', ); ~~~~~~~~~~ -error:6:3 -error:9:3 -error:16:3 -error:21:3 -error:26:3 -error:35:3 +error:6:3:XHP22:Duplicate Keys in Array +error:9:3:XHP22:Duplicate Keys in Array +error:16:3:XHP22:Duplicate Keys in Array +error:21:3:XHP22:Duplicate Keys in Array +error:26:3:XHP22:Duplicate Keys in Array +error:35:3:XHP22:Duplicate Keys in Array diff --git a/src/lint/linter/xhpast/rules/__tests__/duplicate-switch-case/duplicate-switch-case.lint-test b/src/lint/linter/xhpast/rules/__tests__/duplicate-switch-case/duplicate-switch-case.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/duplicate-switch-case/duplicate-switch-case.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/duplicate-switch-case/duplicate-switch-case.lint-test @@ -25,5 +25,5 @@ break; } ~~~~~~~~~~ -error:16:3 -error:23:7 +error:16:3:XHP50:Duplicate Case Statements +error:23:7:XHP50:Duplicate Case Statements diff --git a/src/lint/linter/xhpast/rules/__tests__/dynamic-define/dynamic-define.lint-test b/src/lint/linter/xhpast/rules/__tests__/dynamic-define/dynamic-define.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/dynamic-define/dynamic-define.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/dynamic-define/dynamic-define.lint-test @@ -5,5 +5,5 @@ define('PONY', $cute); define($pony, $cute); ~~~~~~~~~~ -error:4:8 dynamic define -error:6:8 dynamic define +error:4:8:XHP12:Dynamic `define` +error:6:8:XHP12:Dynamic `define` diff --git a/src/lint/linter/xhpast/rules/__tests__/elseif-usage/elseif-usage.lint-test b/src/lint/linter/xhpast/rules/__tests__/elseif-usage/elseif-usage.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/elseif-usage/elseif-usage.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/elseif-usage/elseif-usage.lint-test @@ -8,7 +8,7 @@ echo 'baz'; } ~~~~~~~~~~ -advice:5:3 +advice:5:3:XHP42:`elseif` Usage ~~~~~~~~~~ ~~~~~~~~~~ -disabled:2:1 +disabled:2:1:XHP78:Inline HTML diff --git a/src/lint/linter/xhpast/rules/__tests__/inner-function/inner-function.lint-test b/src/lint/linter/xhpast/rules/__tests__/inner-function/inner-function.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/inner-function/inner-function.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/inner-function/inner-function.lint-test @@ -11,4 +11,4 @@ function () {}; } ~~~~~~~~~~ -warning:5:5 +warning:5:5:XHP59:Inner Functions diff --git a/src/lint/linter/xhpast/rules/__tests__/instanceof-operator/instanceof-operator.lint-test b/src/lint/linter/xhpast/rules/__tests__/instanceof-operator/instanceof-operator.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/instanceof-operator/instanceof-operator.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/instanceof-operator/instanceof-operator.lint-test @@ -5,6 +5,6 @@ var_dump(null instanceof stdClass); var_dump($x instanceof stdClass); ~~~~~~~~~~ -error:3:10 -error:4:10 -error:5:10 +error:3:10:XHP69:`instanceof` Operator +error:4:10:XHP69:`instanceof` Operator +error:5:10:XHP69:`instanceof` Operator diff --git a/src/lint/linter/xhpast/rules/__tests__/interface-abstract-method/abstract.lint-test b/src/lint/linter/xhpast/rules/__tests__/interface-abstract-method/abstract.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/interface-abstract-method/abstract.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/interface-abstract-method/abstract.lint-test @@ -4,4 +4,4 @@ abstract public function someMethod(); } ~~~~~~~~~~ -error:4:3 +error:4:3:XHP118:`interface` Methods Cannot Be Marked `abstract` diff --git a/src/lint/linter/xhpast/rules/__tests__/interface-method-body/body.lint-test b/src/lint/linter/xhpast/rules/__tests__/interface-method-body/body.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/interface-method-body/body.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/interface-method-body/body.lint-test @@ -4,4 +4,4 @@ public function someMethod() {} } ~~~~~~~~~~ -error:4:32 +error:4:32:XHP114:`interface` Method Cannot Contain Body diff --git a/src/lint/linter/xhpast/rules/__tests__/invalid-default-parameter/invalid-default-parameter.lint-test b/src/lint/linter/xhpast/rules/__tests__/invalid-default-parameter/invalid-default-parameter.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/invalid-default-parameter/invalid-default-parameter.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/invalid-default-parameter/invalid-default-parameter.lint-test @@ -13,6 +13,6 @@ function func_nine(stdClass $x = null) {} function func_ten(stdClass $x = array()) {} ~~~~~~~~~~ -error:6:31 -error:10:35 -error:14:33 +error:6:31:XHP70:Invalid Default Parameter +error:10:35:XHP70:Invalid Default Parameter +error:14:33:XHP70:Invalid Default Parameter diff --git a/src/lint/linter/xhpast/rules/__tests__/invalid-modifiers/invalid-modifiers.lint-test b/src/lint/linter/xhpast/rules/__tests__/invalid-modifiers/invalid-modifiers.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/invalid-modifiers/invalid-modifiers.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/invalid-modifiers/invalid-modifiers.lint-test @@ -11,8 +11,8 @@ abstract final public function baz() {} } ~~~~~~~~~~ -error:5:10 -error:6:10 -error:7:11 -error:10:10 -error:11:12 +error:5:10:XHP72:Invalid Modifiers +error:6:10:XHP72:Invalid Modifiers +error:7:11:XHP72:Invalid Modifiers +error:10:10:XHP72:Invalid Modifiers +error:11:12:XHP72:Invalid Modifiers diff --git a/src/lint/linter/xhpast/rules/__tests__/invalid-octal-numeric-scalar/octal.lint-test b/src/lint/linter/xhpast/rules/__tests__/invalid-octal-numeric-scalar/octal.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/invalid-octal-numeric-scalar/octal.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/invalid-octal-numeric-scalar/octal.lint-test @@ -3,5 +3,5 @@ 08; -08; ~~~~~~~~ -error:3:1 -error:4:2 +error:3:1:XHP125:Invalid Octal Numeric Scalar +error:4:2:XHP125:Invalid Octal Numeric Scalar diff --git a/src/lint/linter/xhpast/rules/__tests__/is_a-should-be-instanceof/is_a.lint-test b/src/lint/linter/xhpast/rules/__tests__/is_a-should-be-instanceof/is_a.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/is_a-should-be-instanceof/is_a.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/is_a-should-be-instanceof/is_a.lint-test @@ -4,10 +4,10 @@ is_a($x, '\\SomeClass'); is_a($x, '\\'.'Some'.'Class'); ~~~~~~~~~~ -advice:2:1 -advice:3:1 -advice:4:1 -advice:5:1 +advice:2:1:XHP111:`is_a` Should Be `instanceof` +advice:3:1:XHP111:`is_a` Should Be `instanceof` +advice:4:1:XHP111:`is_a` Should Be `instanceof` +advice:5:1:XHP111:`is_a` Should Be `instanceof` ~~~~~~~~~~ diff --git a/src/lint/linter/xhpast/rules/__tests__/no-parent-scope/no-parent-scope.lint-test b/src/lint/linter/xhpast/rules/__tests__/no-parent-scope/no-parent-scope.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/no-parent-scope/no-parent-scope.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/no-parent-scope/no-parent-scope.lint-test @@ -16,4 +16,4 @@ } } ~~~~~~~~~~ -error:11:5 +error:11:5:XHP64:No Parent Scope diff --git a/src/lint/linter/xhpast/rules/__tests__/object-operator-spacing/object-operator-spacing.lint-test b/src/lint/linter/xhpast/rules/__tests__/object-operator-spacing/object-operator-spacing.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/object-operator-spacing/object-operator-spacing.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/object-operator-spacing/object-operator-spacing.lint-test @@ -4,8 +4,8 @@ id(new Something()) ->doSomething(); ~~~~~~~~~~ -warning:3:3 -warning:3:6 +warning:3:3:XHP74:Object Operator Spacing +warning:3:6:XHP74:Object Operator Spacing ~~~~~~~~~~ ~~~~~~~~~~ -error:3:1 +error:3:1:XHP8:Use of Close Tag `?>` diff --git a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/conditional-usage.lint-test b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/conditional-usage.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/conditional-usage.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/conditional-usage.lint-test @@ -20,9 +20,9 @@ $var = 'some_func'; if ($var()) {} ~~~~~~~~~~ -error:5:3 -error:7:3 -error:12:7 +error:5:3:XHP45:PHP Compatibility +error:7:3:XHP45:PHP Compatibility +error:12:7:XHP45:PHP Compatibility ~~~~~~~~~~ ~~~~~~~~~~ { diff --git a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/index-function.lint-test b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/index-function.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/index-function.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/index-function.lint-test @@ -2,7 +2,7 @@ f()[0]; ~~~~~~~~~~ -error:3:5 +error:3:5:XHP45:PHP Compatibility ~~~~~~~~~~ ~~~~~~~~~~ { diff --git a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/nowdoc.lint-test b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/nowdoc.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/nowdoc.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/nowdoc.lint-test @@ -4,7 +4,7 @@ Hello World! EOT; ~~~~~~~~~~ -error:3:6 +error:3:6:XHP45:PHP Compatibility ~~~~~~~~~~ ~~~~~~~~~~ { diff --git a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php-compatibility.lint-test b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php-compatibility.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php-compatibility.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php-compatibility.lint-test @@ -3,8 +3,8 @@ define_syslog_variables(); var_dump(STREAM_ENFORCE_SAFE_MODE); ~~~~~~~~~~ -error:3:1 -error:4:10 +error:3:1:XHP45:PHP Compatibility +error:4:10:XHP45:PHP Compatibility ~~~~~~~~~~ ~~~~~~~~~~ { diff --git a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php53-features.lint-test b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php53-features.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php53-features.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php53-features.lint-test @@ -11,13 +11,13 @@ $a::m(); echo __DIR__; ~~~~~~~~~~ -error:3:1 -error:4:1 -error:5:3 -error:6:3 -error:7:1 -error:9:1 -error:12:6 +error:3:1:XHP45:PHP Compatibility +error:4:1:XHP45:PHP Compatibility +error:5:3:XHP45:PHP Compatibility +error:6:3:XHP45:PHP Compatibility +error:7:1:XHP45:PHP Compatibility +error:9:1:XHP45:PHP Compatibility +error:12:6:XHP45:PHP Compatibility ~~~~~~~~~~ ~~~~~~~~~~ { diff --git a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-features.lint-test b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-features.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-features.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-features.lint-test @@ -25,12 +25,12 @@ []; ~~~~~~~~~~ -error:3:5 -error:4:9 -error:12:7 -error:18:7 -error:23:1 -error:25:1 +error:3:5:XHP45:PHP Compatibility +error:4:9:XHP45:PHP Compatibility +error:12:7:XHP45:PHP Compatibility +error:18:7:XHP45:PHP Compatibility +error:23:1:XHP45:PHP Compatibility +error:25:1:XHP45:PHP Compatibility ~~~~~~~~~~ ~~~~~~~~~~ { diff --git a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-incompat.lint-test b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-incompat.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-incompat.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-incompat.lint-test @@ -9,10 +9,10 @@ continue 1; continue 1 + foo() * $bar; ~~~~~~~~~~ -error:4:7 -error:6:7 -error:8:10 -error:10:10 +error:4:7:XHP45:PHP Compatibility +error:6:7:XHP45:PHP Compatibility +error:8:10:XHP45:PHP Compatibility +error:10:10:XHP45:PHP Compatibility ~~~~~~~~~~ ~~~~~~~~~~ {"config": {"xhpast.php-version": "5.4.0"}} diff --git a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/windows.lint-test b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/windows.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/windows.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/windows.lint-test @@ -2,7 +2,7 @@ chroot('/tmp'); ~~~~~~~~~~ -error:3:1 +error:3:1:XHP45:PHP Compatibility ~~~~~~~~~~ ~~~~~~~~~~ { diff --git a/src/lint/linter/xhpast/rules/__tests__/php-echo-tag/php-echo-tag.lint-test b/src/lint/linter/xhpast/rules/__tests__/php-echo-tag/php-echo-tag.lint-test --- a/src/lint/linter/xhpast/rules/__tests__/php-echo-tag/php-echo-tag.lint-test +++ b/src/lint/linter/xhpast/rules/__tests__/php-echo-tag/php-echo-tag.lint-test @@ -1,4 +1,4 @@ ~~~~~~~~~~ -error:1:1 +error:1:1:XHP15:Expected Open Tag ~~~~~~~~~~ garbage garbage $bar; // okay ~~~~~~~~~~ -error:3:1 +error:3:1:XHP3:Use of Variable