WordPress-Coding-Standards | PHP_CodeSniffer rules to enforce WordPress | Content Management System library

 by   WordPress PHP Version: 2.3.0 License: MIT

kandi X-RAY | WordPress-Coding-Standards Summary

kandi X-RAY | WordPress-Coding-Standards Summary

WordPress-Coding-Standards is a PHP library typically used in Web Site, Content Management System, Wordpress applications. WordPress-Coding-Standards has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

This project is a collection of PHP_CodeSniffer rules (sniffs) to validate code developed for WordPress. It ensures code quality and adherence to coding conventions, especially the official WordPress Coding Standards.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              WordPress-Coding-Standards has a medium active ecosystem.
              It has 2263 star(s) with 456 fork(s). There are 86 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 206 open issues and 810 have been closed. On average issues are closed in 773 days. There are 10 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of WordPress-Coding-Standards is 2.3.0

            kandi-Quality Quality

              WordPress-Coding-Standards has 0 bugs and 0 code smells.

            kandi-Security Security

              WordPress-Coding-Standards has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              WordPress-Coding-Standards code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              WordPress-Coding-Standards is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              WordPress-Coding-Standards releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.
              WordPress-Coding-Standards saves you 5660 person hours of effort in developing the same functionality from scratch.
              It has 11843 lines of code, 240 functions and 93 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed WordPress-Coding-Standards and discovered the below as its top functions. This is intended to give you an instant insight into WordPress-Coding-Standards implemented functionality, and help decide if they suit your requirements.
            • Process multi - line array .
            • Process a token .
            • Checks if a variable is valid .
            • Process comments .
            • Process a global variable declaration .
            • Check for missing arguments .
            • Process variable variable .
            • Process a variable .
            • Process an arbitrary constant declaration .
            • Process method declaration .
            Get all kandi verified functions for this library.

            WordPress-Coding-Standards Key Features

            No Key Features are available at this moment for WordPress-Coding-Standards.

            WordPress-Coding-Standards Examples and Code Snippets

            No Code Snippets are available at this moment for WordPress-Coding-Standards.

            Community Discussions

            QUESTION

            In VSCode-->settings.json, a particular line appears dimmer than the rest of the code. What is that indicating?
            Asked 2019-Oct-06 at 09:53

            In VSCode, in settings.json for one of my extensions is a line

            "extends": "C:/Users/snarl/.vscode/extensions/stylelint-config-wordpress",

            But that line is dimmed compared to the rest of the text in the file, as if disabled, or path not found (screenshot). Is that indicating some kind of error I need to resolve? That folder does indeed exist at that location (screenshot).

            Motivation For My Question

            I ask because this is a line of code I manually added to settings.json, as part of installation instructions for a particular extension. I'm currently using the stylelint extension to help notify me of errors while I type. I am now trying to install a separate extension--stylelint-config-wordpress--which is a set of rules to be used with stylelint. But that new ruleset doesn't seem to be working properly. So I am now trying to troubleshoot why the new rules are not working properly. The settings.json file I edited is part of the stylelint-config-wordpress extension.

            Of Note

            • I am running Windows 10.

            • When I initially installed stylelint, I installed it globally. I can confirm it was installed properly and linting errors in my code, as expected.

            • In the GitHub repo for stylelint-config-wordpress, there is one issue related to this (see here). I posted there and received some initial replies. But nothing worked, and I've not heard back since.

            ...

            ANSWER

            Answered 2019-Oct-06 at 09:53

            After opening an issue in the relevant GitHub repo, I was able to understand the answer to my question.

            Short Answer: The code I was adding was incorrect. I was adding:

            Source https://stackoverflow.com/questions/58062567

            QUESTION

            How can we customize Wordpress coding standards and use them in VSCode?
            Asked 2019-Aug-29 at 02:15

            How can we customize Wordpress coding standards on Windows and use them with VSCode? I am trying to do this globally so I don't have to do it for every project (I don't think currently that this is a bad idea?) but I guess the same thing can be applied to local project, only paths should be changed.

            First, I have installed them in C:\wamp64\www\_standards\wpcs and I have set correct path using:

            ...

            ANSWER

            Answered 2018-Aug-22 at 19:16

            A couple of pointers:

            • The phpcs.xml file (can also be phpcs.xml.dist and other similar variations that have a preferred order) (not ruleset.xml), should be in the root of your project code, not in the directory you installed WPCS.
            • The VS Code config would then be the path (absolute or relative) to that phpcs.xml file:

              "phpcs.standard": "/path/to/project/phpcs.xml"

              or

              "phpcs.standard": "./phpcs.xml"

            You'll still need to ensure that the phpcs executable you're referring to has got the WordPress standards registered.

            Reference: https://marketplace.visualstudio.com/items?itemName=ikappas.phpcs

            Source https://stackoverflow.com/questions/51428993

            QUESTION

            Install git in window 10
            Asked 2018-Nov-08 at 09:41

            I have installed git in my pc(windows 10) and set environment variable path also. But when I try to download WPCS using git git clone -b master https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs getting an error

            'git' is not recognized as an internal or external command, operable program or batch file.

            Git directory path is C:\Program Files\Git and I have set the environment variable as C:\Program Files\Git\cmd. Can anyone suggest me what might be the problem here? I have tried this commands also

            ...

            ANSWER

            Answered 2018-Nov-08 at 08:23

            If you already installed the git-scm.com version, you can use my second favourite on top of it, Git for Windows (https://gitforwindows.org)

            It will support your Git installation out of the box without messing around with environment variables and it uses Git Bash, which emulates a common Linux command line, so most git commands you will find around on the web will work for you

            If you do this, you shouldn't try to run git directly from the Windows command line, but from the Git Bash command line, which will be accessible everywhere in Windows from the right click menu

            Source https://stackoverflow.com/questions/53203539

            QUESTION

            PHP CodeSniffer WordPress via Composer
            Asked 2018-Mar-14 at 17:44

            Is there a way to install PHPCodeSniffer and WordPress Coding Standards for PHP_CodeSniffer per project via Composer? I've installed both as dev dependencies and set the installed path to WordPress Coding Standards in CodeSniffer.conf. Unfortunately phpcs can not resolve to the config file when I run the command in the terminal because it is looking in "vendor" folder for "vendor/squizlabs/php_codesniffer/CodeSniffer.conf"

            Here is my project setup:

            composer.json

            ...

            ANSWER

            Answered 2018-Feb-27 at 19:32

            First, you don't need to require PHP CodeSniffer explicitly, because wp-coding-standards/wpcs pulls it automatically.

            composer.json

            Source https://stackoverflow.com/questions/48485778

            QUESTION

            How to install npm packages in Atom?
            Asked 2017-Aug-19 at 18:11

            I'm trying to add WordPress Coding Standards to ESLint in Atom. Unfortunately there are no package I could add via Atom's installer. I've found one (I think) suitable package here but whenever I try to install it using Windows CMD or XAMPP shell I get "npm is ot recognized as internal or external command". I installed ESLint for Atom, so I've got the prerequisite met. Is it possible to add it to Atom on Windows at all?

            Cheers, best regards.

            ...

            ANSWER

            Answered 2017-Aug-19 at 18:10

            Ok,

            I digged into the topic and pparently I didn't have Node.js installed so I couldn't manage any npm packages. After installing Node.js I was able to install WordPress-Coding-Standards. Unfortunately I installed the wrong package at first, which was eslint-plugin-wordpress. After trying to set it up eslint started giving me plenty of errors. Then I found out (with a little help from guys on Github) that there are other WordPress Coding Standards plugin for eslint - eslint-config-wordpress which I installed as well. Now everything works like a charm. It's good to learn something new everyday.

            Thanks, Dan.

            Source https://stackoverflow.com/questions/45578054

            QUESTION

            phpcbf doesn't see installed phpcs standard
            Asked 2017-Jul-21 at 20:58

            I’ve installed the WordPress Coding Standards for phpcs. Running phpcs -i confirms this:

            ...

            ANSWER

            Answered 2017-Jul-21 at 20:58

            Greg Sherwood’s comment above pointed me in the right direction. The two commands were symlinks pointing at different installs. I figured this out by running which phpcs and which phpcbf and running readlink (to see if they were symlinks) on the results.

            which phpcs gave me /usr/local/bin/phpcs and readlink /usr/local/bin/phpcs gave me the path to the actual executable.

            Once I figured out that phpcbf was a symlink to an executable in a different install I deleted it and replaced it with a symlink to phpcbf in the same install as phpcs, which solved my issue.

            Source https://stackoverflow.com/questions/45175341

            QUESTION

            WordPress Coding Standards – phpcs Warnings
            Asked 2017-Jun-25 at 07:27

            I'm using the WordPress-Core rules for a project I just started in PhpStorm (involves developing a custom plugin and theme), and I find it strange that most of the default php files in a clean WordPress install (for example, wp-config.php, wp-mail.php, etc.) don't pass the phpcs test when any of the WordPress rules in that repo are used.

            Most of the times I see the open and close bracket warning:

            ...

            ANSWER

            Answered 2017-Jun-25 at 07:27

            Historically, WordPress has avoided cleaning up the Core code style, for several reasons:

            • The tools for checking coding standards were not particularly reliable. This has changed in recent years, with the WordPress Coding Standards (WPCS) project maturing, and many of the little edge cases being fixed in PHPCS.
            • With no reliable automated tools, this would be a manual job, requiring many commits. This causes unnecessary code churn, and makes it harder to look through revision logs.
            • It just hasn't been a high priority. ~4% of WordPress' PHP violates the coding standard, so most folks just don't encounter it.

            With the tools maturing, that position changed recently, there's now an in-progress effort to get PHPCS and WPCS working with WordPress Core. With appropriate automated testing, WordPress will continue to match it's own coding standards in the future.

            Source https://stackoverflow.com/questions/43757738

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install WordPress-Coding-Standards

            You can download it from GitHub.
            PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.

            Support

            See CONTRIBUTING, including information about unit testing the standard.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/WordPress/WordPress-Coding-Standards.git

          • CLI

            gh repo clone WordPress/WordPress-Coding-Standards

          • sshUrl

            git@github.com:WordPress/WordPress-Coding-Standards.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Content Management System Libraries

            Try Top Libraries by WordPress

            WordPress

            by WordPressPHP

            gutenberg

            by WordPressJavaScript

            Requests

            by WordPressPHP

            wordpress-develop

            by WordPressPHP

            wordpress-playground

            by WordPressJavaScript