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

How to make PHP CodeSniffer standard PHPCS validate the ternary operator?

I've been using PHP_CodeSniffer for a few days but I still can't validate some codes. When I use ternary operator, even a very simple like this: $name = (strlen($name) > 0) ? $name : 'nameless'; The Code Sniffer says: ERROR | Inline IF…
user2377782
0
votes
2 answers

PHP static code analysis - disabling false-positive warnings

On our CI servers we run PHP codesniffer and phpmd. Some of issues raised are false-positive. How can I disable certain parts of PHP file to be analysed by those (as @SupressWarning(...) in Java) ? Thanks!
FazoM
  • 4,777
  • 6
  • 43
  • 61
0
votes
0 answers

Code Sniffer proper documents

First let me admit that I'd my first encounter with Code Sniffer just yesterday. I want to setup custom rules files for my ZF 1.x project. However all Zend snippets are not applicable. Again another problem, I don't want to rediscover wheel (& I…
Kapil Sharma
  • 10,135
  • 8
  • 37
  • 66
0
votes
1 answer

Installing PHP_codesniffer with Pear and MAMP Pro on OSX

I've tried all kinds of fixes to get php_codesniffer working with OSX and Pear and am having no luck. The installation works, the scripts are there, but when I run, for example, phpcs -h, nothing happens. I am doing the following to install and try…
Chris
  • 871
  • 1
  • 10
  • 19
0
votes
1 answer

Customize tags list for MissingTag rule

I would like to use PEAR.Commenting.FileComment.MissingTag for my phpcs ruleset, but I need to customize the list of required tags. Is it possible via some API or must I exclude this rule and write a new Sniff? I was searching through documentation…
ozahorulia
  • 9,798
  • 8
  • 48
  • 72
0
votes
0 answers

Sublime + CodeSniffer problems

I'm trying to configure my sublime with codesniffer but is show this error in console: [Phpcs] C:\wamp\bin\php\php5.4.16 -l -d display_errors=On X:\classes\activity.class.php [Phpcs] cwd: C:\Users\mag Exception in thread Thread-6: Traceback (most…
Fabio
  • 141
  • 4
  • 13
0
votes
0 answers

What is the category tag in the PEAR standard coding style for?

The PEAR coding style here requires a tag category to be defined for each class (see especially here). But what is the meaning of this category tag, as I cannot find a definition or a real example for category?
Alex
  • 41,580
  • 88
  • 260
  • 469
0
votes
0 answers

Trying to get drupal's Code Sniffer working with Sublime Text 2, what am I doing wrong?

I followed this tutorial, but when I hit cmd-B in Sublime, I get this error: Warning: include_once(PHP/CodeSniffer/CLI.php): failed to open stream: No such file or directory in /usr/local/bin/phpcs on line 31 Warning: include_once(): Failed opening…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
0
votes
1 answer

Cannot get CodeSniffer working in (any) Eclipse

i installed Eclipse then installed the latest PDT, then CodeSniffer from the official update site. After restarting eclipse, nothing changes. No validation at all. I can manually start PHP CodeSniffer on a selected file, but nothing happens. Tried…
NovumCoder
  • 4,349
  • 9
  • 43
  • 58
0
votes
2 answers

PHP Codesniffer Whitespace

have you ever met with such a problem?: Jenkins report says that at the end of line 49 there are some white spaces but I checked code in repository and definitely end of comment is end of line: 048 * @var integer|timestamp|string 049 …
Vail
  • 608
  • 5
  • 14
0
votes
2 answers

Sonar not showing violation using custom rules?

I am trying to integrate Sonar for code review and analysis . I am working in typo3, so I added the following rules in rules.xml
Siva
  • 481
  • 7
  • 26
0
votes
1 answer

Error Loading Subset of Sniffs in PHP_CodeSniffer 1.4.3

I am having trouble including external sniffs in my standard. Using the newest version of PHP_CodeSniffer 1.4.3, I can not include a group of sniffs. I can include them individually, but I would like to cut down on my maintenance, and simply only…
Steven Scott
  • 10,234
  • 9
  • 69
  • 117
0
votes
1 answer

Joomla! PHP CodeSniffer

I get this message with PHP Code Sniffer: Expected "if (...)\n"; found "if (...)" My code: authorise('core.admin')): ?>
  • Bruno Batista
    • 223
    • 3
    • 11
  • 0
    votes
    1 answer

    Which Sniff for whitespace after condiftion in PHP?

    I'm looking or a sniff, which detects: if() switch() elseif() because only if () switch () elseif () is allowed! Thanks
    OskarStark
    • 384
    • 1
    • 11
    0
    votes
    2 answers

    Using Codesniffer with Xampp on Windows 7

    I'm running into an issue trying to get codesniffer working with Xampp (1.7.1). I've got pear running by editing the include_path in php.ini. When I try to run phpcs I get the following errors: Warning: include_once(PHP/CodeSniffer/CLI.php): failed…
    Matt
    • 1
    • 1
    • 1
    1 2 3
    21
    22