Warning: Undefined array key "HTTPS" in /srv/users/serverpilot/apps/pixelspress/public/wp-config.php on line 21

Warning: Cannot modify header information - headers already sent by (output started at /srv/users/serverpilot/apps/pixelspress/public/wp-config.php:21) in /srv/users/serverpilot/apps/pixelspress/public/wp-includes/feed-rss2.php on line 8
Code Quality Tools Archives - PixelsPress http://www.pixelspress.com/code-quality-tools/ Free WordPress Theme & Plugins Wed, 06 Apr 2022 19:59:21 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.2 http://www.pixelspress.com/wp-content/uploads/2019/04/cropped-PixelsPress-Favicon-32x32.png Code Quality Tools Archives - PixelsPress http://www.pixelspress.com/code-quality-tools/ 32 32 How to Add Yii2 Coding Standards in PHP_CodeSniffer http://www.pixelspress.com/how-to-add-yii2-coding-standards-in-php_codesniffer/ http://www.pixelspress.com/how-to-add-yii2-coding-standards-in-php_codesniffer/#respond Fri, 12 Mar 2021 13:01:46 +0000 https://pixelspress.com/?p=895 In this tutorial, you will learn how to add Yii2 Coding Standards in PHP_CodeSniffer.

The post How to Add Yii2 Coding Standards in PHP_CodeSniffer appeared first on PixelsPress.

]]>
In this tutorial, you will learn how to add Yii2 Coding Standards in PHP_CodeSniffer.

Prerequisites

Yii2 Coding Standards have the ruleset of PHP_CodeSniffer. The ruleset is a set of sniffs that looks for things that are wrong and tells you about them so that you can fix them. So if we go to GitHub and look up the Yii2 Coding Standards and navigate to the Yii2 directory, we find the ruleset having a bunch of instructions for PHP_CodeSniffer to follow. Now ruleset tells PHP_CodeSniffer what to do.

To get this ruleset on your computer you have to use git so I am assuming that you have already installed git on your computer and we will install it as a standalone set so you can use it globally. Now copy & paste the following command which cloned the master branch and we will put it in yii2cs directory on our computer. In my case, I am on my D Drive and I have a special directory in my D Drive called utilities so I will change my directory by using the window command cd and navigate to utilities folder i.e.

cd utilities

and clone them.

git clone -b master git://github.com/yiisoft/yii2-coding-standards.git yii2cs

Now we have to tell PHP_CodeSniffer to go and look at this ruleset and to do that we will run a command phpcs and set some configuration with –config-set specifically, we want you to point at a new path with installed_paths and the path where we cloned it i.e.

phpcs --config-set installed_paths "D:\utilities\yii2cs"

After run above command, we will get the following output.

Config value "installed_paths" updated successfully;

Now if we type the following command and hit enter.

phpcs -i

We will see that we have the Yii2 Coding Standards available via the command line on PHP_CodeSniffer.

The post How to Add Yii2 Coding Standards in PHP_CodeSniffer appeared first on PixelsPress.

]]>
http://www.pixelspress.com/how-to-add-yii2-coding-standards-in-php_codesniffer/feed/ 0
How to Add WordPress Coding Standards in PHP_CodeSniffer http://www.pixelspress.com/how-to-add-wordpress-coding-standards-in-php_codesniffer/ http://www.pixelspress.com/how-to-add-wordpress-coding-standards-in-php_codesniffer/#respond Fri, 12 Mar 2021 12:31:44 +0000 https://pixelspress.com/?p=832 In this tutorial, you will learn how to add WordPress Coding Standards in PHP_CodeSniffer.

The post How to Add WordPress Coding Standards in PHP_CodeSniffer appeared first on PixelsPress.

]]>
In this tutorial, you will learn how to add WordPress Coding Standards in PHP_CodeSniffer.

Prerequisites

WordPress Coding Standards have the ruleset of PHP_CodeSniffer. The ruleset is a set of sniffs that looks for things that are wrong and tells you about them so that you can fix them. So if we go to GitHub and look up the WordPress Coding Standards and navigate to it, we find the ruleset having a bunch of instructions for PHP_CodeSniffer to follow. Now ruleset tells PHP_CodeSniffer what to do.

To get this ruleset on your computer you have to use git so I am assuming that you have already installed git on your computer and we will install it as a standalone set so you can use it globally. Now copy & paste the following command which cloned the master branch and we will put it in wpcs directory on our computer. In my case, I am on my D Drive and I have a special directory in my D Drive called utilities so I will change my directory by using the window command cd and navigate to utilities folder i.e.

cd utilities

and clone them.

git clone -b master https://github.com/WordPress/WordPress-Coding-Standards.git wpcs

Now we have to tell PHP_CodeSniffer to go and look at this ruleset and to do that we will run a command phpcs and set some configuration with –config-set specifically, we want you to point at a new path with installed_paths and the path where we cloned it i.e.

phpcs --config-set installed_paths "D:\utilities\wpcs"

After run above command, we will get the following output.

Config value "installed_paths" updated successfully;

Now if we type the following command and hit enter.

phpcs -i

We will see that we have all of the WordPress Coding Standards available via the command line on PHP_CodeSniffer.

The post How to Add WordPress Coding Standards in PHP_CodeSniffer appeared first on PixelsPress.

]]>
http://www.pixelspress.com/how-to-add-wordpress-coding-standards-in-php_codesniffer/feed/ 0
How to Install PHP_CodeSniffer Using Composer http://www.pixelspress.com/how-to-install-php_codesniffer-using-composer/ http://www.pixelspress.com/how-to-install-php_codesniffer-using-composer/#respond Sat, 02 May 2020 13:41:17 +0000 https://pixelspress.com/?p=818 In this tutorial, you will learn how to install PHP_CodeSniffer using Composer on Windows.

The post How to Install PHP_CodeSniffer Using Composer appeared first on PixelsPress.

]]>
In this tutorial, you will learn how to install PHP_CodeSniffer using Composer on Windows.

Before starting, you should know what PHP_CodeSniffer or PHPCS is. PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent. PHPCS is a short form of it.

In my point of view using a composer to manage PHP_CodeSniffer is a wise choice. After all, the composer is just a tool for dependency management in PHP i.e. it allows you to add and manage script libraries and packages as dependencies in your project, in order to reduce development time and have the ability to take advantage of third-party code.

Install Composer

If you don’t have composer installed on your computer then hop over to getcomposer.org.

The easiest way to get Composer set up on your machine by using Installer. So download and run Composer-Setup.exe. It will install the latest Composer version and set up your PATH so that you can call composer from any directory in your command line.

To make sure the installation completed successfully, run the following command:

composer help

Now move on to next step actually installing PHP_CodeSniffer.

Install PHP_CodeSniffer

To install PHP_CodeSniffer, use the following command, drop it to your command line, hit enter and let compose go out grab PHP_CodeSniffer, and added to your path.

composer global require "squizlabs/php_codesniffer=*"

If you want to know the path of PHP_CodeSniffer in your PC. then use the following command in windows

where.exe phpcs

On Mac, you can use the following command

which phpcs

If you want to know your current PHP_CodeSniffe version, then you can use the following command

phpcs --version

If you want to know current installed coding standards, then use the following command

phpcs -i

Conclusion

You have learned how to install PHP_CodeSniffer using Composer on Windows.

The post How to Install PHP_CodeSniffer Using Composer appeared first on PixelsPress.

]]>
http://www.pixelspress.com/how-to-install-php_codesniffer-using-composer/feed/ 0