EBernhardson has uploaded a new change for review.

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

Change subject: Expect specific output from sniffs
......................................................................

Expect specific output from sniffs

Many of these files were testing multiple things, but the only thing
we asserted was that the file had at least one failure. Patch adds
.expect files for all tests so we can assert that it fails in all the
cases we expect it to fail. I have not manually reviewed the expect
files to determine if all the things that were supposed to be failing
actually do.

.expect files were generated with:

find MediaWiki/Tests/files/ -iname '*.php' -print0 | \
    xargs -0 -I{} bash -c 'vendor/bin/phpcs --standard=MediaWiki {} > {}.expect'

Change-Id: Idd06a613599b2ac9f88bcdb68c558ead29ee2109
---
M MediaWiki/Tests/MediaWikiStandardTest.php
A MediaWiki/Tests/files/AlternativeSyntax/alternative_syntax_fail.php.expect
A MediaWiki/Tests/files/AlternativeSyntax/alternative_syntax_pass.php.expect
A 
MediaWiki/Tests/files/ControlStructures/assignment_in_control_structures_fail.php.expect
A 
MediaWiki/Tests/files/ControlStructures/assignment_in_control_structures_pass.php.expect
A MediaWiki/Tests/files/ControlStructures/if_else_structure_fail.php.expect
A MediaWiki/Tests/files/ControlStructures/if_else_structure_pass.php.expect
A 
MediaWiki/Tests/files/ExtraCharacters/extra_characters_before_phpopen_tag_fail.php.expect
A 
MediaWiki/Tests/files/ExtraCharacters/extra_characters_before_phpopen_tag_pass.php.expect
A 
MediaWiki/Tests/files/ExtraCharacters/valid_shebang_before_phpopen_tag_fail.php.expect
A 
MediaWiki/Tests/files/ExtraCharacters/valid_shebang_before_phpopen_tag_pass.php.expect
A MediaWiki/Tests/files/NamingConventions/case_global_name_fail.php.expect
A MediaWiki/Tests/files/NamingConventions/wf_global_function_fail.php.expect
A MediaWiki/Tests/files/NamingConventions/wf_global_function_pass.php.expect
A MediaWiki/Tests/files/NamingConventions/wf_namespace_pass.php.expect
A MediaWiki/Tests/files/NamingConventions/wg_global_name2_fail.php.expect
A MediaWiki/Tests/files/NamingConventions/wg_global_name_fail.php.expect
A MediaWiki/Tests/files/Usage/dir_usage_fail.php.expect
A MediaWiki/Tests/files/Usage/dir_usage_pass.php.expect
A MediaWiki/Tests/files/Usage/goto_usage_fail.php.expect
A MediaWiki/Tests/files/Usage/goto_usage_pass.php.expect
A MediaWiki/Tests/files/VariableAnalysis/unused_global_variables_fail.php.expect
A 
MediaWiki/Tests/files/VariableAnalysis/unused_global_variables_heredoc_pass.php.expect
A MediaWiki/Tests/files/VariableAnalysis/used_global_variables_pass.php.expect
A 
MediaWiki/Tests/files/VariableAnalysis/used_global_variables_quote_string_pass.php.expect
A 
MediaWiki/Tests/files/VariableAnalysis/used_global_variables_regression_pass.php.expect
A MediaWiki/Tests/files/WhiteSpace/multiple_empty_lines_fail.php.expect
A MediaWiki/Tests/files/WhiteSpace/multiple_empty_lines_pass.php.expect
A MediaWiki/Tests/files/WhiteSpace/short_array_fail.php.expect
A 
MediaWiki/Tests/files/WhiteSpace/space_after_delim_singleline_comment_fail.php.expect
A 
MediaWiki/Tests/files/WhiteSpace/space_after_delim_singleline_comment_pass.php.expect
A MediaWiki/Tests/files/WhiteSpace/space_before_parens_fail.php.expect
A MediaWiki/Tests/files/WhiteSpace/space_before_parens_pass.php.expect
A MediaWiki/Tests/files/WhiteSpace/spacey_parenthesis_fail.php.expect
A MediaWiki/Tests/files/WhiteSpace/spacey_parenthesis_pass.php.expect
A MediaWiki/Tests/files/generic_namespace_pass.php.expect
A MediaWiki/Tests/files/generic_pass.php.expect
37 files changed, 299 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/codesniffer 
refs/changes/75/290975/1

diff --git a/MediaWiki/Tests/MediaWikiStandardTest.php 
b/MediaWiki/Tests/MediaWikiStandardTest.php
index d556d01..44f57a3 100644
--- a/MediaWiki/Tests/MediaWikiStandardTest.php
+++ b/MediaWiki/Tests/MediaWikiStandardTest.php
@@ -40,7 +40,8 @@
        /**
         * testFiles
         *
-        * Run simple syntax checks, if the filename ends with pass.php - 
expect it to pass
+        * Run simple syntax checks, comparing the phpcs output for the test
+        * file against an expected output.
         */
        public static function testProvider() {
                $tests = [];
@@ -54,11 +55,13 @@
                        }
 
                        $file = $dir->getPathname();
-                       $expectPass = ( substr( $file, -8 ) === 'pass.php' );
+                       if ( substr( $file, -4 ) !== '.php' ) {
+                               continue;
+                       }
                        $tests[] = [
                                $file,
                                $standard,
-                               $expectPass
+                               "$file.expect"
                        ];
                }
                return $tests;
@@ -71,23 +74,46 @@
         *
         * @param string $file
         * @param string $standard
-        * @param boolean $expectPass
+        * @param boolean $expectedOutputFile
         */
-       public function testFile( $file, $standard, $expectPass ) {
-               $outputStr = $this->helper->runPhpCs( $file, $standard );
-               if ( $expectPass ) {
-                       $this->assertNotRegExp(
-                               "/FOUND \d+ ERROR/",
-                               $outputStr,
-                               basename( $file ) . ' - expected to pass with 
no errors, some were reported. '
-                       );
-               } else {
-                       $this->assertRegExp(
-                               "/FOUND \d+ ERROR/",
-                               $outputStr,
-                               basename( $file ) . ' - expected failures, none 
reported. '
-                       );
+       public function testFile( $file, $standard, $expectedOutputFile ) {
+               $outputStr = $this->prepareOutput( $this->helper->runPhpCs( 
$file, $standard ) );
+               $expect = $this->prepareOutput( file_get_contents( 
$expectedOutputFile ) );
+               $this->assertEquals( $expect, $outputStr );
+       }
+
+       /**
+        * strip down the output to only the warnings
+        *
+        * @param string $outputStr phpcs output
+        * @return string
+        */
+       private function prepareOutput( $outputStr ) {
+               if ( $outputStr ) {
+                       $outputLines = explode( "\n", $outputStr );
+                       $outputLines = $this->stripTwoDashLines( $outputLines, 
true );
+                       $outputLines = $this->stripTwoDashLines( $outputLines, 
false );
+                       $outputStr = implode( "\n", $outputLines );
                }
+
+               return $outputStr;
+       }
+
+       /**
+        * @param string[] $lines
+        * @param bool $front When true strip from the front of array. 
Otherwise the end.
+        * @return string[]
+        */
+       private function stripTwoDashLines( array $lines, $front = true ) {
+               $dashLines = 0;
+               while ( $lines && $dashLines < 2 ) {
+                       $line = $front ? array_shift( $lines ) : array_pop( 
$lines );
+                       if ( strlen( $line ) > 0 && $line[0] === '-' ) {
+                               $dashLines++;
+                       }
+               }
+
+               return $lines;
        }
 
 }
diff --git 
a/MediaWiki/Tests/files/AlternativeSyntax/alternative_syntax_fail.php.expect 
b/MediaWiki/Tests/files/AlternativeSyntax/alternative_syntax_fail.php.expect
new file mode 100644
index 0000000..bc06081
--- /dev/null
+++ b/MediaWiki/Tests/files/AlternativeSyntax/alternative_syntax_fail.php.expect
@@ -0,0 +1,24 @@
+
+FILE: ...iaWiki/Tests/files/AlternativeSyntax/alternative_syntax_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AND 6 WARNINGS AFFECTING 7 LINES
+----------------------------------------------------------------------
+  5 | WARNING | [ ] Alternative syntax such as "enddeclare" should
+    |         |     not be used
+  9 | WARNING | [ ] Alternative syntax such as "endfor" should not be
+    |         |     used
+ 11 | ERROR   | [x] Short array syntax must be used to define arrays
+ 13 | WARNING | [ ] Alternative syntax such as "endforeach" should
+    |         |     not be used
+ 19 | WARNING | [ ] Alternative syntax such as "endif" should not be
+    |         |     used
+ 25 | WARNING | [ ] Alternative syntax such as "endswitch" should not
+    |         |     be used
+ 29 | WARNING | [ ] Alternative syntax such as "endwhile" should not
+    |         |     be used
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 13ms; Memory: 3.5Mb
+
diff --git 
a/MediaWiki/Tests/files/AlternativeSyntax/alternative_syntax_pass.php.expect 
b/MediaWiki/Tests/files/AlternativeSyntax/alternative_syntax_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MediaWiki/Tests/files/AlternativeSyntax/alternative_syntax_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/ControlStructures/assignment_in_control_structures_fail.php.expect
 
b/MediaWiki/Tests/files/ControlStructures/assignment_in_control_structures_fail.php.expect
new file mode 100644
index 0000000..fc76b42
--- /dev/null
+++ 
b/MediaWiki/Tests/files/ControlStructures/assignment_in_control_structures_fail.php.expect
@@ -0,0 +1,15 @@
+
+FILE: ...iles/ControlStructures/assignment_in_control_structures_fail.php
+----------------------------------------------------------------------
+FOUND 6 ERRORS AFFECTING 6 LINES
+----------------------------------------------------------------------
+  3 | ERROR | Assignment expression not allowed within "if".
+  5 | ERROR | Assignment expression not allowed within "elseif".
+  7 | ERROR | Assignment expression not allowed within "elseif".
+  9 | ERROR | Assignment expression not allowed within "elseif".
+ 11 | ERROR | Assignment expression not allowed within "elseif".
+ 15 | ERROR | Assignment expression not allowed within "while".
+----------------------------------------------------------------------
+
+Time: 12ms; Memory: 3.5Mb
+
diff --git 
a/MediaWiki/Tests/files/ControlStructures/assignment_in_control_structures_pass.php.expect
 
b/MediaWiki/Tests/files/ControlStructures/assignment_in_control_structures_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/MediaWiki/Tests/files/ControlStructures/assignment_in_control_structures_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/ControlStructures/if_else_structure_fail.php.expect 
b/MediaWiki/Tests/files/ControlStructures/if_else_structure_fail.php.expect
new file mode 100644
index 0000000..5458bd7
--- /dev/null
+++ b/MediaWiki/Tests/files/ControlStructures/if_else_structure_fail.php.expect
@@ -0,0 +1,13 @@
+
+FILE: ...diaWiki/Tests/files/ControlStructures/if_else_structure_fail.php
+----------------------------------------------------------------------
+FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
+----------------------------------------------------------------------
+  7 | WARNING | [x] Single space expected before "elseif"
+ 10 | WARNING | [x] Single space expected before "else"
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 14ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/ControlStructures/if_else_structure_pass.php.expect 
b/MediaWiki/Tests/files/ControlStructures/if_else_structure_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MediaWiki/Tests/files/ControlStructures/if_else_structure_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/ExtraCharacters/extra_characters_before_phpopen_tag_fail.php.expect
 
b/MediaWiki/Tests/files/ExtraCharacters/extra_characters_before_phpopen_tag_fail.php.expect
new file mode 100644
index 0000000..a4c6621
--- /dev/null
+++ 
b/MediaWiki/Tests/files/ExtraCharacters/extra_characters_before_phpopen_tag_fail.php.expect
@@ -0,0 +1,13 @@
+
+FILE: ...les/ExtraCharacters/extra_characters_before_phpopen_tag_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
+----------------------------------------------------------------------
+ 1 | ERROR   | [ ] Extra character found before first <?
+ 7 | WARNING | [x] Single space expected between "//" and comment
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 11ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/ExtraCharacters/extra_characters_before_phpopen_tag_pass.php.expect
 
b/MediaWiki/Tests/files/ExtraCharacters/extra_characters_before_phpopen_tag_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/MediaWiki/Tests/files/ExtraCharacters/extra_characters_before_phpopen_tag_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/ExtraCharacters/valid_shebang_before_phpopen_tag_fail.php.expect
 
b/MediaWiki/Tests/files/ExtraCharacters/valid_shebang_before_phpopen_tag_fail.php.expect
new file mode 100644
index 0000000..f745cec
--- /dev/null
+++ 
b/MediaWiki/Tests/files/ExtraCharacters/valid_shebang_before_phpopen_tag_fail.php.expect
@@ -0,0 +1,10 @@
+
+FILE: .../files/ExtraCharacters/valid_shebang_before_phpopen_tag_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AFFECTING 1 LINE
+----------------------------------------------------------------------
+ 3 | ERROR | Extra character found before first <?
+----------------------------------------------------------------------
+
+Time: 12ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/ExtraCharacters/valid_shebang_before_phpopen_tag_pass.php.expect
 
b/MediaWiki/Tests/files/ExtraCharacters/valid_shebang_before_phpopen_tag_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/MediaWiki/Tests/files/ExtraCharacters/valid_shebang_before_phpopen_tag_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/NamingConventions/case_global_name_fail.php.expect 
b/MediaWiki/Tests/files/NamingConventions/case_global_name_fail.php.expect
new file mode 100644
index 0000000..6b0e65c
--- /dev/null
+++ b/MediaWiki/Tests/files/NamingConventions/case_global_name_fail.php.expect
@@ -0,0 +1,15 @@
+
+FILE: ...ediaWiki/Tests/files/NamingConventions/case_global_name_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
+----------------------------------------------------------------------
+ 3 | WARNING | [x] Space found before opening parenthesis of function
+   |         |     call
+ 5 | ERROR   | [ ] Global variable "$wgsomething" should use
+   |         |     CamelCase: "$wgWgsomething"
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 11ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/NamingConventions/wf_global_function_fail.php.expect 
b/MediaWiki/Tests/files/NamingConventions/wf_global_function_fail.php.expect
new file mode 100644
index 0000000..3ab55a3
--- /dev/null
+++ b/MediaWiki/Tests/files/NamingConventions/wf_global_function_fail.php.expect
@@ -0,0 +1,11 @@
+
+FILE: ...iaWiki/Tests/files/NamingConventions/wf_global_function_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AFFECTING 1 LINE
+----------------------------------------------------------------------
+ 3 | ERROR | Global function "foo" is lacking a 'wf' prefix. Should
+   |       | be "wfFoo".
+----------------------------------------------------------------------
+
+Time: 11ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/NamingConventions/wf_global_function_pass.php.expect 
b/MediaWiki/Tests/files/NamingConventions/wf_global_function_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MediaWiki/Tests/files/NamingConventions/wf_global_function_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/NamingConventions/wf_namespace_pass.php.expect 
b/MediaWiki/Tests/files/NamingConventions/wf_namespace_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MediaWiki/Tests/files/NamingConventions/wf_namespace_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/NamingConventions/wg_global_name2_fail.php.expect 
b/MediaWiki/Tests/files/NamingConventions/wg_global_name2_fail.php.expect
new file mode 100644
index 0000000..80785c2
--- /dev/null
+++ b/MediaWiki/Tests/files/NamingConventions/wg_global_name2_fail.php.expect
@@ -0,0 +1,15 @@
+
+FILE: ...MediaWiki/Tests/files/NamingConventions/wg_global_name2_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
+----------------------------------------------------------------------
+ 3 | WARNING | [x] Space found before opening parenthesis of function
+   |         |     call
+ 5 | ERROR   | [ ] Global variable "$LocalInterwikis" is lacking 'wg'
+   |         |     prefix. Should be "$wgLocalInterwikis".
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 12ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/NamingConventions/wg_global_name_fail.php.expect 
b/MediaWiki/Tests/files/NamingConventions/wg_global_name_fail.php.expect
new file mode 100644
index 0000000..e70e24f
--- /dev/null
+++ b/MediaWiki/Tests/files/NamingConventions/wg_global_name_fail.php.expect
@@ -0,0 +1,15 @@
+
+FILE: .../MediaWiki/Tests/files/NamingConventions/wg_global_name_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
+----------------------------------------------------------------------
+ 3 | WARNING | [x] Space found before opening parenthesis of function
+   |         |     call
+ 5 | ERROR   | [ ] Global variable "$someotherglobal" is lacking 'wg'
+   |         |     prefix. Should be "$wgSomeotherglobal".
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 11ms; Memory: 3.25Mb
+
diff --git a/MediaWiki/Tests/files/Usage/dir_usage_fail.php.expect 
b/MediaWiki/Tests/files/Usage/dir_usage_fail.php.expect
new file mode 100644
index 0000000..eba3594
--- /dev/null
+++ b/MediaWiki/Tests/files/Usage/dir_usage_fail.php.expect
@@ -0,0 +1,13 @@
+
+FILE: ...tools-codesniffer/MediaWiki/Tests/files/Usage/dir_usage_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AFFECTING 1 LINE
+----------------------------------------------------------------------
+ 3 | ERROR | [x] Use __DIR__ constant instead of calling
+   |       |     dirname(__FILE__)
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 11ms; Memory: 3.25Mb
+
diff --git a/MediaWiki/Tests/files/Usage/dir_usage_pass.php.expect 
b/MediaWiki/Tests/files/Usage/dir_usage_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MediaWiki/Tests/files/Usage/dir_usage_pass.php.expect
diff --git a/MediaWiki/Tests/files/Usage/goto_usage_fail.php.expect 
b/MediaWiki/Tests/files/Usage/goto_usage_fail.php.expect
new file mode 100644
index 0000000..92d99e3
--- /dev/null
+++ b/MediaWiki/Tests/files/Usage/goto_usage_fail.php.expect
@@ -0,0 +1,10 @@
+
+FILE: ...ools-codesniffer/MediaWiki/Tests/files/Usage/goto_usage_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AFFECTING 1 LINE
+----------------------------------------------------------------------
+ 5 | ERROR | Control statement "goto" must not be used.
+----------------------------------------------------------------------
+
+Time: 12ms; Memory: 3.25Mb
+
diff --git a/MediaWiki/Tests/files/Usage/goto_usage_pass.php.expect 
b/MediaWiki/Tests/files/Usage/goto_usage_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MediaWiki/Tests/files/Usage/goto_usage_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/VariableAnalysis/unused_global_variables_fail.php.expect
 
b/MediaWiki/Tests/files/VariableAnalysis/unused_global_variables_fail.php.expect
new file mode 100644
index 0000000..74af5cf
--- /dev/null
+++ 
b/MediaWiki/Tests/files/VariableAnalysis/unused_global_variables_fail.php.expect
@@ -0,0 +1,14 @@
+
+FILE: ...ki/Tests/files/VariableAnalysis/unused_global_variables_fail.php
+----------------------------------------------------------------------
+FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
+----------------------------------------------------------------------
+ 3 | WARNING | [x] Space found before opening parenthesis of function
+   |         |     call
+ 5 | WARNING | [ ] Global $wgSomething is never used.
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 11ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/VariableAnalysis/unused_global_variables_heredoc_pass.php.expect
 
b/MediaWiki/Tests/files/VariableAnalysis/unused_global_variables_heredoc_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/MediaWiki/Tests/files/VariableAnalysis/unused_global_variables_heredoc_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/VariableAnalysis/used_global_variables_pass.php.expect 
b/MediaWiki/Tests/files/VariableAnalysis/used_global_variables_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/MediaWiki/Tests/files/VariableAnalysis/used_global_variables_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/VariableAnalysis/used_global_variables_quote_string_pass.php.expect
 
b/MediaWiki/Tests/files/VariableAnalysis/used_global_variables_quote_string_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/MediaWiki/Tests/files/VariableAnalysis/used_global_variables_quote_string_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/VariableAnalysis/used_global_variables_regression_pass.php.expect
 
b/MediaWiki/Tests/files/VariableAnalysis/used_global_variables_regression_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/MediaWiki/Tests/files/VariableAnalysis/used_global_variables_regression_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/WhiteSpace/multiple_empty_lines_fail.php.expect 
b/MediaWiki/Tests/files/WhiteSpace/multiple_empty_lines_fail.php.expect
new file mode 100644
index 0000000..a8852f1
--- /dev/null
+++ b/MediaWiki/Tests/files/WhiteSpace/multiple_empty_lines_fail.php.expect
@@ -0,0 +1,15 @@
+
+FILE: ...r/MediaWiki/Tests/files/WhiteSpace/multiple_empty_lines_fail.php
+----------------------------------------------------------------------
+FOUND 2 ERRORS AFFECTING 2 LINES
+----------------------------------------------------------------------
+ 3 | ERROR | [x] Multiple empty lines should not exist in a row;
+   |       |     found 2 consecutive empty lines
+ 9 | ERROR | [x] Multiple empty lines should not exist in a row;
+   |       |     found 2 consecutive empty lines
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 11ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/WhiteSpace/multiple_empty_lines_pass.php.expect 
b/MediaWiki/Tests/files/WhiteSpace/multiple_empty_lines_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MediaWiki/Tests/files/WhiteSpace/multiple_empty_lines_pass.php.expect
diff --git a/MediaWiki/Tests/files/WhiteSpace/short_array_fail.php.expect 
b/MediaWiki/Tests/files/WhiteSpace/short_array_fail.php.expect
new file mode 100644
index 0000000..f035877
--- /dev/null
+++ b/MediaWiki/Tests/files/WhiteSpace/short_array_fail.php.expect
@@ -0,0 +1,16 @@
+
+FILE: ...odesniffer/MediaWiki/Tests/files/WhiteSpace/short_array_fail.php
+----------------------------------------------------------------------
+FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 4 LINES
+----------------------------------------------------------------------
+ 3 | WARNING | [x] Single space expected after opening parenthesis
+ 3 | WARNING | [x] Single space expected before closing parenthesis
+ 4 | WARNING | [x] Single space expected after opening parenthesis
+ 5 | WARNING | [x] Single space expected before closing parenthesis
+ 6 | WARNING | [x] Single space expected before closing parenthesis
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 11ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/WhiteSpace/space_after_delim_singleline_comment_fail.php.expect
 
b/MediaWiki/Tests/files/WhiteSpace/space_after_delim_singleline_comment_fail.php.expect
new file mode 100644
index 0000000..ae709f7
--- /dev/null
+++ 
b/MediaWiki/Tests/files/WhiteSpace/space_after_delim_singleline_comment_fail.php.expect
@@ -0,0 +1,19 @@
+
+FILE: ...s/files/WhiteSpace/space_after_delim_singleline_comment_fail.php
+----------------------------------------------------------------------
+FOUND 2 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
+----------------------------------------------------------------------
+ 2 | WARNING | [x] Single space expected between "//" and comment
+ 3 | WARNING | [ ] Unnecessary empty comment found
+ 3 | ERROR   | [x] Whitespace found at end of line
+ 4 | WARNING | [x] Single space expected between "#" and comment
+ 5 | WARNING | [ ] Unnecessary empty comment found
+ 5 | ERROR   | [x] Whitespace found at end of line
+ 6 | WARNING | [x] Single space expected between "//" and comment
+ 7 | WARNING | [x] Single space expected between "#" and comment
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 11ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/WhiteSpace/space_after_delim_singleline_comment_pass.php.expect
 
b/MediaWiki/Tests/files/WhiteSpace/space_after_delim_singleline_comment_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ 
b/MediaWiki/Tests/files/WhiteSpace/space_after_delim_singleline_comment_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/WhiteSpace/space_before_parens_fail.php.expect 
b/MediaWiki/Tests/files/WhiteSpace/space_before_parens_fail.php.expect
new file mode 100644
index 0000000..57b3b08
--- /dev/null
+++ b/MediaWiki/Tests/files/WhiteSpace/space_before_parens_fail.php.expect
@@ -0,0 +1,18 @@
+
+FILE: ...er/MediaWiki/Tests/files/WhiteSpace/space_before_parens_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AND 3 WARNINGS AFFECTING 3 LINES
+----------------------------------------------------------------------
+ 2 | WARNING | [x] Space found before opening parenthesis of function
+   |         |     call
+ 3 | WARNING | [x] Space found before opening parenthesis of function
+   |         |     call
+ 4 | ERROR   | [x] Short array syntax must be used to define arrays
+ 4 | WARNING | [x] Space found before opening parenthesis of function
+   |         |     call
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 12ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/WhiteSpace/space_before_parens_pass.php.expect 
b/MediaWiki/Tests/files/WhiteSpace/space_before_parens_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MediaWiki/Tests/files/WhiteSpace/space_before_parens_pass.php.expect
diff --git 
a/MediaWiki/Tests/files/WhiteSpace/spacey_parenthesis_fail.php.expect 
b/MediaWiki/Tests/files/WhiteSpace/spacey_parenthesis_fail.php.expect
new file mode 100644
index 0000000..fd812c2
--- /dev/null
+++ b/MediaWiki/Tests/files/WhiteSpace/spacey_parenthesis_fail.php.expect
@@ -0,0 +1,19 @@
+
+FILE: ...fer/MediaWiki/Tests/files/WhiteSpace/spacey_parenthesis_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AND 7 WARNINGS AFFECTING 4 LINES
+----------------------------------------------------------------------
+ 4 | WARNING | [x] Single space expected after opening parenthesis
+ 4 | WARNING | [x] Single space expected before closing parenthesis
+ 5 | WARNING | [x] Single space expected after opening parenthesis
+ 5 | WARNING | [x] Single space expected before closing parenthesis
+ 6 | WARNING | [x] Single space expected after opening parenthesis
+ 6 | WARNING | [x] Single space expected before closing parenthesis
+ 7 | ERROR   | [x] Short array syntax must be used to define arrays
+ 7 | WARNING | [x] Unnecessary space found within parentheses
+----------------------------------------------------------------------
+PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
+----------------------------------------------------------------------
+
+Time: 12ms; Memory: 3.25Mb
+
diff --git 
a/MediaWiki/Tests/files/WhiteSpace/spacey_parenthesis_pass.php.expect 
b/MediaWiki/Tests/files/WhiteSpace/spacey_parenthesis_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MediaWiki/Tests/files/WhiteSpace/spacey_parenthesis_pass.php.expect
diff --git a/MediaWiki/Tests/files/generic_namespace_pass.php.expect 
b/MediaWiki/Tests/files/generic_namespace_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MediaWiki/Tests/files/generic_namespace_pass.php.expect
diff --git a/MediaWiki/Tests/files/generic_pass.php.expect 
b/MediaWiki/Tests/files/generic_pass.php.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MediaWiki/Tests/files/generic_pass.php.expect

-- 
To view, visit https://gerrit.wikimedia.org/r/290975
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd06a613599b2ac9f88bcdb68c558ead29ee2109
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/codesniffer
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to