Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 222
Cata John Avatar asked Mar 09 '23 09:03

Cata John


1 Answers

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

like image 185
gz-ang Avatar answered Mar 15 '23 06:03

gz-ang