You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm in the process of updating some old v2 sniffs to version 3 however I cant actually get the beautifier to work with the PHPCS standard.
Looks to me like file_put_contents(Standards/CI/Sniffs/Strings/VariableUsageSniff.php) is not saving to the full document path?
$ phpcs /Users/louis/Documents/Work/Projects/CodeIgniter/CodeIgniter-Standards/Standards/CI/Sniffs/Strings/VariableUsageSniff.php -n --standard=/Users/louis/Documents/Work/Projects/CodeIgniter/CodeIgniter-Standards/phpcs.xml
E
FILE: Standards/CI/Sniffs/Strings/VariableUsageSniff.php
------------------------------------------------------------------------------------------------------------------------
FOUND 65 ERRORS AFFECTING 52 LINES
------------------------------------------------------------------------------------------------------------------------
65 | ERROR | [ ] Inline comments must end in full-stops, exclamation marks, or question marks
72 | ERROR | [x] Expected 1 blank line before closing function brace; 0 found
91 | ERROR | [x] Whitespace found at end of line
95 | ERROR | [ ] Implicit true comparisons prohibited; use === TRUE instead
96 | ERROR | [ ] Implicit true comparisons prohibited; use === TRUE instead
103 | ERROR | [x] No blank line found after control structure
108 | ERROR | [x] No blank line found after control structure
109 | ERROR | [ ] Inline comments must start with a capital letter
110 | ERROR | [ ] Inline comments must end in full-stops, exclamation marks, or question marks
113 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space
116 | ERROR | [x] No blank line found after control structure
116 | ERROR | [x] End comment for long condition not found; expected "//end if"
118 | ERROR | [x] No blank line found after control structure
118 | ERROR | [x] End comment for long condition not found; expected "//end while"
120 | ERROR | [x] Expected 1 blank line before closing function brace; 0 found
137 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
138 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
138 | ERROR | [ ] Inline comments must start with a capital letter
138 | ERROR | [ ] Inline comments must end in full-stops, exclamation marks, or question marks
138 | ERROR | [x] Comments may not appear after statements
141 | ERROR | [ ] Implicit true comparisons prohibited; use === TRUE instead
146 | ERROR | [x] No blank line found after control structure
148 | ERROR | [x] No blank line found after control structure
150 | ERROR | [x] Expected 1 blank line before closing function brace; 0 found
150 | ERROR | [x] Expected 2 blank lines after function; 1 found
163 | ERROR | [ ] Parameter tags must be defined first in a doc comment
169 | ERROR | [ ] Method name "_parseVariable" should not be prefixed with an underscore to indicate visibility
171 | ERROR | [ ] Operator ! prohibited; use === FALSE instead
173 | ERROR | [x] No blank line found after control structure
179 | ERROR | [x] There must be no space between the "array" keyword and the opening parenthesis
179 | ERROR | [x] Array with multiple values cannot be declared on a single line
184 | ERROR | [x] No blank line found after control structure
187 | ERROR | [x] There must be no space between the "array" keyword and the opening parenthesis
187 | ERROR | [x] Array with multiple values cannot be declared on a single line
192 | ERROR | [x] No blank line found after control structure
193 | ERROR | [x] There must be no space between the "array" keyword and the opening parenthesis
194 | ERROR | [x] Expected 1 blank line before closing function brace; 0 found
207 | ERROR | [ ] Parameter tags must be defined first in a doc comment
213 | ERROR | [ ] Method name "_parseObjectAttribute" should not be prefixed with an underscore to indicate visibility
217 | ERROR | [x] No blank line found after control structure
221 | ERROR | [x] No blank line found after control structure
226 | ERROR | [ ] Variable "sub_attr" is not in valid camel caps format
227 | ERROR | [x] There must be no space between the "array" keyword and the opening parenthesis
227 | ERROR | [x] Array with multiple values cannot be declared on a single line
227 | ERROR | [ ] Variable "sub_attr" is not in valid camel caps format
232 | ERROR | [x] No blank line found after control structure
235 | ERROR | [x] There must be no space between the "array" keyword and the opening parenthesis
235 | ERROR | [x] Array with multiple values cannot be declared on a single line
240 | ERROR | [x] No blank line found after control structure
242 | ERROR | [x] Expected 1 blank line before closing function brace; 0 found
253 | ERROR | [ ] Parameter tags must be defined first in a doc comment
258 | ERROR | [ ] Method name "_parseArrayIndexes" should not be prefixed with an underscore to indicate visibility
262 | ERROR | [ ] Implicit true comparisons prohibited; use === TRUE instead
264 | ERROR | [x] Space found before square bracket; expected "$indexes[" but found "$indexes ["
264 | ERROR | [x] Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
269 | ERROR | [x] No blank line found after control structure
272 | ERROR | [x] Expected 1 blank line before closing function brace; 0 found
283 | ERROR | [ ] Parameter tags must be defined first in a doc comment
288 | ERROR | [ ] Method name "_parseArrayIndex" should not be prefixed with an underscore to indicate visibility
292 | ERROR | [x] No blank line found after control structure
294 | ERROR | [ ] Operator ! prohibited; use === FALSE instead
296 | ERROR | [x] No blank line found after control structure
301 | ERROR | [x] No blank line found after control structure
304 | ERROR | [x] Expected 1 blank line before closing function brace; 0 found
304 | ERROR | [x] Expected 2 blank lines after function; 0 found
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 44 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------
$ phpcbf /Users/louis/Documents/Work/Projects/CodeIgniter/CodeIgniter-Standards/Standards/CI/Sniffs/Strings/VariableUsageSniff.php -n --standard=/Users/louis/Documents/Work/Projects/CodeIgniter/CodeIgniter-Standards/phpcs.xml
PHP Fatal error: Uncaught exception 'PHP_CodeSniffer\Exceptions\RuntimeException' with message 'file_put_contents(Standards/CI/Sniffs/Strings/VariableUsageSniff.php): failed to open stream: No such file or directory in /usr/local/Cellar/php-code-sniffer/3.0.1/src/Reports/Cbf.php on line 83' in /usr/local/Cellar/php-code-sniffer/3.0.1/src/Runner.php:543 (Stacktrace etc)...
The text was updated successfully, but these errors were encountered:
Ok I've monkey patched my local version for now and all seems fine for me to get on tonight/tomorrow.
In Cbf.php at line 83 I changed file_put_contents($newFilename, $newContent); to file_put_contents($phpcsFile->config->basepath.'/'.$newFilename, $newContent);.
gsherwood
changed the title
I can sniff fine but phpcbf is giving me an error.
Use of basepath setting can stop PHPCBF being able to write fixed files
Jun 22, 2017
I'm in the process of updating some old v2 sniffs to version 3 however I cant actually get the beautifier to work with the PHPCS standard.
Looks to me like
file_put_contents(Standards/CI/Sniffs/Strings/VariableUsageSniff.php)
is not saving to the full document path?The text was updated successfully, but these errors were encountered: