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
2
votes
1 answer

How to run specifics sniffs with PHP Code Sniffer

I got PHP Code Sniffer 2.6.0. I'm using phpcs and it's working fine. I have a huge project in PHP 5.2.17, more than 2000 classes, and it will migrate to 5.6.20. I want to focus on refactoring classes with deprecated PHP functions first. I'm tried…
2
votes
3 answers

PHP codesniffer (phpcs) - how to allow override when using as part of a svn pre-commit hook?

We have a PHP 5 web application and we're currently evaluating PHP CodeSniffer in order to decide whether forcing code standards improves code quality. We use subversion for our code repository and deployment base and I have added a SVN pre-commit…
Tom
  • 14,041
  • 16
  • 64
  • 80
2
votes
1 answer

In PHPUnderControl, can I configure PHP_CodeSniffer to ignore specific directories?

I've recently been trying to set up PHPUnderControl, a Continuous Integration server based on CruisControl. Part of the checks I'd like to run is the PHP CodeSniffer (PHPCS) to detect "code smell". However, letting this run on my codebase results in…
2
votes
0 answers

Integrating Vagrant and PHPStorm with Composer/PHPCS using Remote Interpreter via Shared Folders?

I'm using a Vagrant VM created by Puphpet, running Ubuntu 14.04 for the purpose of developing a Wordpress site. I use Composer to manage PHP dependencies, and Composer is installed automatically as a system service via Puphpet, so there is no .phar…
2
votes
1 answer

Reference custom php codesniffer sniffs from a ruleset that is not in the standards directory

I have a ruleset with some custom sniffs. I have the ruleset in my project directory/repository, but I can't work out how to keep the custom sniffs there. If I put a relative link into the ruleset: then it throws this…
SystemicPlural
  • 5,629
  • 9
  • 49
  • 74
2
votes
2 answers

phpcs - class must be in a namespace of at least one level - how to fix?

I am using laravel 4.2. Lets say there is such class: class BShopsController extends ShopsController To fix this, I try to use name space lets say this: namespace app\controllers; and then it does not find ShopsController so I add use…
Dariux
  • 3,953
  • 9
  • 43
  • 69
2
votes
1 answer

Custom PHP_CodeSniffer (CodeSniffer) Standards

I seem to be having trouble providing the installed_paths configurable. It seems to sabotage phpcs. Show installed standards: $ sudo /usr/bin/phpcs -i The installed coding standards are PSR2, PHPCS, PEAR, PSR1, Squiz, MySource, Zend, CakePHP, PSR2,…
Dustin Oprea
  • 9,673
  • 13
  • 65
  • 105
2
votes
1 answer

PHPStorm 8 version control (git) scope to ignore files in PHP_CodeSniffer

I would only like to run an inspection (phpcs) on files that are not ignored by git as the core code of Magento (which is ignored) does not really have code style so the inspector goes wild. So I see in Settings | Scopes you need to match as a…
jzahedieh
  • 1,570
  • 1
  • 15
  • 27
2
votes
1 answer

How to override allowedTypes in PHP Codesniffer

I've managed to get PHP CodeSniffer installed and working. I have also managed to write my own custom sniffs. There is one issue that I cannot figure out - how do I override the $allowedTypes variable which is defined in the main PHP_CodeSniffer…
JonoB
  • 5,801
  • 17
  • 55
  • 77
2
votes
1 answer

Sublime-phpcs - Can't get PHP MD and CS packages to function properly

I've been trying to configure sublime-phpcs. I've installed pear and from command line installed PHP_CodeSniffer, and PHPMD using their documented install procedures. PHP and pear are in my path at d:/Program Files/xampp/php and d:/Program…
mtpultz
  • 17,267
  • 22
  • 122
  • 201
2
votes
1 answer

Using SonarQube Quality profile All PHP CodeSniffer Rules results in 0 issue and 0,0 days of technical debt

I'm using SonarQube 4.0 and when I set a project to be analyzed with All PHP CodeSniffer Rules quality profile, the result is 0 issue and 0,0 days of technical debt. The project I analyze is a PHP Project. The other metrics work well like…
2
votes
1 answer

PHP code sniffer exclude-pattern

Hi I currently working on php coding sniffer. We are using the ruleset.xml file in PHPStorm as well on our TeamCity buildserver. This works fine. The last thing we wanted todo is to exclude 3th party libraries. What is do know is that we should us…
2
votes
1 answer

What built-in codesniff could I use to ensure there are no spaces before parenthesis and after function name

Is there a built-in sniff to ensure that public function foo () { ^---- there is no such a space. I couldn't find it in any built-in standard, or did I just miss it?
zerkms
  • 249,484
  • 69
  • 436
  • 539
2
votes
1 answer

The file phpcs.bat isn't the right Code Sniffer batch

I've installed PHP_CodeSniffer via Pear, and have Netbeans 7.3.1 installed. This is all on a Windows 8 system. When I go to configure Code Sniffer in Netbeans and point it towards my phpcs batch file (only one I have), I get the following error "The…
Arak Tai'Roth
  • 408
  • 1
  • 7
  • 24
2
votes
1 answer

symfony2 php codesniffer standard error

I'm new to phpCodeSniffer and I'm trying to integrate it with eclipse. I've downloaded phpCodeSniffer from PEAR following these instructions, and I also downloaded Symfony2 standards from Github and the php-cs-fixer. I followed all the instructions…
metalvarez
  • 606
  • 1
  • 8
  • 14