Questions tagged [phpcodesniffer]

PHP_CodeSniffer is a PHP PEAR package that can be used to tokenise PHP, JavaScript and CSS files and to detect violations of a defined set of coding standards.

PHP_CodeSniffer is a PHP PEAR package that can be used to tokenise PHP, JavaScript and CSS files and to detect violations of a defined set of coding standards. More information can be found here: http://pear.php.net/package/PHP_CodeSniffer/redirected , including documentation and download links.

327 questions
0
votes
2 answers

PHP CodeSniffer error multiple times

I am completely baffled by what is going wrong. I had a version of my code that was running successfully, and after making the minor change of adding ;'s to the end of my endforeach and endif statements (to make it compatible with php 5.2), I got a…
jldavis76
  • 812
  • 2
  • 15
  • 42
0
votes
1 answer

How do I import existing phpcodesniffer results into sonar?

I'm starting out with Sonar. We've got about 10 custom sniffs in our own standard for PHP_Codesniffer and are using a subset of various sniffs of other standards. PHP_Codesniffer works like a charm and generates a report in Checkstyle format. How…
0
votes
1 answer

PHP_CodeSniffer PEAR.Commenting.FunctionComment.ParamNameNoMatch error

My source code generates the following error with PHP_CodeSniffer. "Doc comment for var &$myVar does not match actual variable name $myVar at position 2" PEAR.Commenting.FunctionComment.ParamNameNoMatch The code: /** * Function comment * * @param…
San
  • 666
  • 7
  • 27
0
votes
0 answers

Integrating CodeSniffer with Komodo IDE to sniff remote files

I have CodeSniffer integrated with Komodo and I'm trying to CodeSniff remote (SCP) files. My issue is that CS tries to open the file instead of reading what's in memory in the editor pane. It can't open the SCP URL and fails. Has anybody been…
0
votes
1 answer

Codesniffer to exit after identiying error before proceeding any further

I want codesniffer to produce error output in CLI and exit before proceeding any further to avoid running other tests like behat, phpmd, phpcpd so that comes after. Current code (as shown below) creates a XML report with errors listed in but it…
BentCoder
  • 12,257
  • 22
  • 93
  • 165
0
votes
1 answer

Clear phpcodesniffer markings in eclipse

Phpcodesniffer has added a lot of markings to my source file based in the PSR1, PSR2 standards. Many of them are related to code formatting like tags and spaces. I want to clear the current markings and run codesniffer later on in my development,…
crafter
  • 6,246
  • 1
  • 34
  • 46
0
votes
0 answers

How to use phpcs with url?

I want to report PHP 5.4 incompatibility issues and for that I am suggested phpCodeSniffer for Ubuntu Server 14.04, I am able to run the command to generate reports for local/path like: $ phpcs codesniffer/Sniffs/PHP/*.php but want to generate…
cage
  • 103
  • 1
  • 8
0
votes
1 answer

How to pass (cli) arguments by file in Ant

I'm using Ant to build my project, generate docs and check coding strandard violations. I use some external tool through exec task. Exec prefixes the output lines with [exec] This string messes my output up. If I specify the -e switch in the command…
erenon
  • 18,838
  • 2
  • 61
  • 93
0
votes
1 answer

Override ruleset in PHP CodeSniffer

I am trying to override a rule in PHP CodeSniffer as follows: However, the overridden value of 1 is not…
JonoB
  • 5,801
  • 17
  • 55
  • 77
0
votes
2 answers

How to use CodeSniffer in Phpstorm using Vagrant?

Is there a way to configure PHPStorm with CodeSniffer when CS is installed on Vagrant? Thanks.
luklaw
  • 25
  • 7
0
votes
1 answer

PHP-CodeBrowser not following path in checkstyle.xml correctly

I've set up phpUnderControl and it's all working very well, except that for a few projects that I have aren't getting any output in the PHP-CodeBrowser tab. If I run the command manually I get: phpcb --log projects/devvo/build/logs --source…
0
votes
1 answer

PHP Code Sniffer with Zend Studio Fails

I'm having an issue with PHP Code Sniffer plugin for Zend studio. I set up my php Executable to be my version of Zend 5.3.14. The PEAR library is also pointed to the executable in my zend directory. When I run code sniffer on a file it creates a new…
Lazadon
  • 193
  • 1
  • 1
  • 11
0
votes
1 answer

How can i remove the missing subpackage error in a phpcs ruleset?

I want to remove this because i dont need it on my project. See you
Rogoit
  • 81
  • 7
0
votes
1 answer

How to tell SonarQube to use PSR2 standard with CodeSniffer

I would like to create a quality profile in SonarQube that extends PSR2 rules. When I create one using this xml below, sonar shows me the following error: Unable to import unknown PhpCodeSniffer rule 'PSR2' consider adding an extension in sonar…
Michał Nowak
  • 1,686
  • 1
  • 12
  • 17
0
votes
1 answer

I want phpcodesniffer to prevent duplicate error reports

My phpcodesniffer report is producing lines like the following example : 146 | ERROR | Variable "tw_text" is not in valid camel caps format (Zend.NamingConventions.ValidVariableName.NotCamelCaps) 148 | ERROR | Variable "tw_text" is not in valid…
crafter
  • 6,246
  • 1
  • 34
  • 46