Cata John
Cata John

Reputation: 1401

PHP codesniffer path to whole project

I`m new to this but i have installed composer and with it installed PHP Codesniffer. Now, how can i use php codesnifer to check for files in my entire project folder? My directory structure is something like this:

ProjectName
    functions
        functions.php
    templates
        template.php
    myFunctions.php
    vendor
        bin
            phpcs.exe

If i try to run

phpcs --standard=PSR2 functions 

it will check the files inside of the functions files inside of the functions directory but i need it to check all the php files in the ProjectName directory.

Thank you!

Upvotes: 4

Views: 5140

Answers (2)

gz-ang
gz-ang

Reputation: 66

there should be an option called "extensions" to fit your use

phpcs --extensions=php --standard=PSR2 .

where you should run this code in your project root directory since "." points to the current directory

Upvotes: 5

Tomas Votruba
Tomas Votruba

Reputation: 24280

You can use dot sign "." to check current directory.

phpcs --standard=PSR2 .

Upvotes: 5

Related Questions