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
1
vote
1 answer

Fixing PSR2 errors with phpcbf.phar

I am trying to fix PSR2 error using the pcpcbf.phar file released from squizlabs - http://www.squizlabs.com/php-codesniffer I am running the following command to fix the file home.php: php phpcbf.phar --standard=PSR2 "home.php" which returns the…
George
  • 89
  • 2
  • 9
1
vote
0 answers

Install PHP CodeSniffer / PHP MessDetector

I am new to PEAR thing in PHP and I want to install PHP CodeSniffer & PHP MessDetector. I am using PHP Storm as my editor. My XAMPP installation directory is D i.e. D:\xampp\ I have downloaded CodeSniffer and Mess Detector and installed it manually…
Slimshadddyyy
  • 4,085
  • 5
  • 59
  • 121
1
vote
1 answer

ZF2 and PHPCSMD using PSR-2 in NetBeans 7.4

In NetBeans 7.4 I am using a PHP:CS plugin set to use PSR-2 rules for controlling the source code. My colleague has the same settings (we checked it), same version of the plugin, same version of NetBeans. Yet we have different results after the code…
shadyyx
  • 15,825
  • 6
  • 60
  • 95
1
vote
3 answers

Where is the repository "Standards" of PHP CodeSniffer with the sonar PHP plugin?

I have installed SonarQube™ and the PHP Plugin. I want to add a new CodeSniffer rule, like it's indicated in http://docs.codehaus.org/display/SONAR/PHP+Custom+Coding+Rules. However, I can't find the location of the "Standard" repository wich…
Marine
  • 11
  • 1
  • 2
1
vote
1 answer

Netbeans indention is not working properly for switch case php

I am using netbeans 7.1.2. Normally i'm using netbeans to indent my code. I have changed the "tabs and intends" options in Tools > Options > Editor > Formatting section. It is working for all the control statements while running the file in…
Kalaiyarasan
  • 12,134
  • 8
  • 31
  • 49
1
vote
1 answer

PHP_CodeSniffer to check for file extensions in a folder

I am using the CakePHP framework, and would like to have PHP_CodeSniffer warn against image files that developers might in a haste, paste into the app/webroot/css folder while copying in something, as opposed to moving them into an appropriate…
Angad
  • 2,803
  • 3
  • 32
  • 45
1
vote
1 answer

Setting up PHP Codesniffer (installed with homebrew) in Sublime Text 2

Is it possible to run PHP Codesniffer from a .phar file? What does the following documentation, taken from a Sublime Text 2 plugin at https://github.com/benmatselby/sublime-phpcs, mean? If you have installed php-cs-fixer, phpmd or phpcs via…
scisteffan
  • 13
  • 1
  • 5
1
vote
1 answer

Running CommandCLI Codesniffer for Drupal Coding Standards gives error

I've downloaded the Drupal coder package (7.x-2.0-beta2) from http://drupal.org/project/coder and extracted the relevant standard files; but when I try to execute from the CLI I'm getting: Fatal error: Call to undefined method…
Mark Baker
  • 209,507
  • 32
  • 346
  • 385
1
vote
3 answers

CodeSniffer with PHPStorm produces errors

I'm working on a WordPress project using PHPStorm. To beautify my code I downloaded the following CodeSniffer rules for WP and put them in my build directory in my project folder: https://github.com/mrchrisadams/WordPress-Coding-Standards Now When I…
lumio
  • 7,428
  • 4
  • 40
  • 56
1
vote
1 answer

PHP_CodeSniffer Tutorials

Does anyone have any tutorials that are up to date, and include more complex processing of rules? Most of the tutorials I am finding on line do not deal with 1.4.3, with the ruleset.xml, but the old php file of coding. Secondly, I want to do more…
Steven Scott
  • 10,234
  • 9
  • 69
  • 117
1
vote
1 answer

"Codesniffer" for PHP Hungarian Notation

I am using PHAN in my projects and wonder if there is some kind of codesniffer to validate the code is PHAN compliant.
Paul Peelen
  • 10,073
  • 15
  • 85
  • 168
1
vote
1 answer

Code sniffer SVN pre commit hook

I have been trying to get code sniffer to act as a svn pre-commit hook following the guide from pear. However while i am 100% certain my code should be invalid i get no errors and the project commits without problem. Is there something else that…
Björn
  • 203
  • 6
  • 19
1
vote
1 answer

Is there a code sniffer standard which allows this?

Is there a standard for codesniffer which would run without an error or warning for the code below? If no is there a tutorial for creating a code standard, that also explains the different sniffers of the already implemented standards?
Pascal
  • 2,175
  • 4
  • 39
  • 57
1
vote
1 answer

OSError: [Errno 13] Permission denied from python when using Sublime phpcs package, OSX 10.7

Im trying to use Php Code Sniffer with Sublime, but in the sublime terminal I get the following every time I try to Sniff a file: Traceback (most recent call last): File "./sublime_plugin.py", line 350, in run_ File "./phpcs.py", line 382, in…
petesiss
  • 994
  • 13
  • 30
0
votes
0 answers

Is there any sniff available for valid variable name when preset is Laravel

I've integrated this library into my existing Laravel project, and it's been performing exceptionally well. However, I've encountered a challenge related to adhering to camel case variable naming conventions. I attempted to address this concern by…
Pankaj Agrawal
  • 1,469
  • 2
  • 17
  • 27