All Projects → wongjn → vscode-php-sniffer

wongjn / vscode-php-sniffer

Licence: MIT License
Visual Studio Code extension for PHP_Codesniffer validation and formatting.

Programming Languages

javascript
184084 projects - #8 most used programming language
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to vscode-php-sniffer

vscode-javascript-booster
Sprinkle extra refactorings, code actions and commands over your JavaScript! 🍩 TypeScript and Flow are first class citizens as well!
Stars: ✭ 115 (+180.49%)
Mutual labels:  vscode-extension
vscode-fzf-quick-open
vscode extension providing quick file/folder open and searching using fzf
Stars: ✭ 42 (+2.44%)
Mutual labels:  vscode-extension
vscode-px-to-rem
Extension that allows you to convert from px to rem, and vice versa
Stars: ✭ 36 (-12.2%)
Mutual labels:  vscode-extension
clj-kondo.lsp
Clj-kondo language server and VSCode extension: https://marketplace.visualstudio.com/items?itemName=borkdude.clj-kondo
Stars: ✭ 17 (-58.54%)
Mutual labels:  vscode-extension
Shortcut-Menu-Bar-VSCode-Extension
Add handy buttons like beautify, show opened files, save, toggle terminal, etc to the editor menu bar in VSCode. You can also create your own buttons with custom commands. VSCode Marketplace link: https://marketplace.visualstudio.com/items?itemName=jerrygoyal.shortcut-menu-bar
Stars: ✭ 126 (+207.32%)
Mutual labels:  vscode-extension
theme-bluloco-light
A fancy but yet sophisticated light designer color scheme.
Stars: ✭ 73 (+78.05%)
Mutual labels:  vscode-extension
vscode-checkpoints
Checkpoints for your code editing.
Stars: ✭ 27 (-34.15%)
Mutual labels:  vscode-extension
vscode-material-product-icons
Product Icon Theme with Material Icons for VS Code
Stars: ✭ 19 (-53.66%)
Mutual labels:  vscode-extension
vscode-explicit-folding
Customize your Folding for Visual Studio Code
Stars: ✭ 46 (+12.2%)
Mutual labels:  vscode-extension
ProtheusDoc-VsCode
Repositório para implementação dinâmica do ProtheusDoc do TDS para VsCode
Stars: ✭ 19 (-53.66%)
Mutual labels:  vscode-extension
multicopy
VS Code extension to copy and paste multiple snippets of code in your workspace.
Stars: ✭ 29 (-29.27%)
Mutual labels:  vscode-extension
vscode-gleam
📟 Gleam support for VS Code
Stars: ✭ 34 (-17.07%)
Mutual labels:  vscode-extension
todo-txt
Todo.txt syntax highlighter and helper extension for visual studio code.
Stars: ✭ 39 (-4.88%)
Mutual labels:  vscode-extension
vscode-tlaplus
TLA+ language support for Visual Studio Code
Stars: ✭ 213 (+419.51%)
Mutual labels:  vscode-extension
componizer
vs code extension for refactoring to components
Stars: ✭ 31 (-24.39%)
Mutual labels:  vscode-extension
vscode-interactive-graphviz
Interactive Graphviz Dot Preview for Visual Studio Code
Stars: ✭ 57 (+39.02%)
Mutual labels:  vscode-extension
graphql-codegen-vscode
vscode extension which runs graphql-codegen whenever you save a query/mutation
Stars: ✭ 41 (+0%)
Mutual labels:  vscode-extension
swdc-vscode-100-days-of-code
A VS Code extension that helps you reach your goals in completing the 100 Days of Code challenge
Stars: ✭ 45 (+9.76%)
Mutual labels:  vscode-extension
vscode-magento-wizard
Helps develop Magento 2 extensions using VSCode
Stars: ✭ 22 (-46.34%)
Mutual labels:  vscode-extension
SmartContractTrading-wFabric1-4-VSCodeExt
Learn now to create a smart contract with VSCode
Stars: ✭ 27 (-34.15%)
Mutual labels:  vscode-extension

PHP Sniffer

Build Status PHP Sniffer on the Visual Studio Marketplace

Uses PHP_CodeSniffer to format and lint (mainly) PHP code.

Features

  • Runs phpcs to lint code.
  • Runs phpcbf to format fixable code validation errors, using the built-in commands "Format Document" or "Format Selection" (PHP only).
    • One may need to set this extension as the default language formatter for some languages. The following snippet is an example for PHP that can be added in a settings.json:
      {
        "[php]": {
          "editor.defaultFormatter": "wongjn.php-sniffer"
        }
      }

Requirements

Extension Settings

Quick Setup

settings.json:

{
  "phpSniffer.autoDetect": true
}

And if your projects look like this:

workspace-folder/
  vendor/
    bin/
      phpcs
      phpcbf
  .phpcs.xml

Validation and formatting will work (see below for alternative filenames for .phpcs.xml).

In Depth

This extension contributes the following settings:

  • phpSniffer.run: When to run phpcs (the linter). Can be onSave, onType or never.
  • phpSniffer.onTypeDelay: When phpSniffer.run is onType, this sets the amount of milliseconds the validator will wait after typing has stopped before it will run. The validator will also cancel an older run if the run is on the same file.
  • phpSniffer.extraFiles: Glob patterns of extra files to match that this extension should run on. Useful for standards that don't just validate PHP files. This extension will always run on PHP files — be sure to have your files.associations setting correctly setup for PHP files.
  • phpSniffer.executablesFolder: The folder where both phpcs and phpcbf executables are. Use this to specify a different executable if it is not in your global PATH, such as when using PHP_Codesniffer as a project-scoped dependency. Can be absolute, or relative to the workspace folder.
  • phpSniffer.autoDetect: Set to true for the extension to auto-detect phpSniffer.executablesFolder as ./vendor/bin/ per workspace folder (applies only if phpSniffer.executablesFolder is empty).
  • phpSniffer.standard: The standards to check against. This is passed to the phpcbf and phpcs executables as the value for --standard. Can be absolute, or relative to the workspace folder. If not set, PHP_CodeSniffer will attempt to find a file to use, at the root of the currently open file's workspace folder in the following order:
    1. .phpcs.xml
    2. phpcs.xml
    3. .phpcs.xml.dist
    4. phpcs.xml.dist
  • phpSniffer.snippetExcludeSniffs: Sniffs to exclude when formatting a PHP code snippet (such as when formatting on paste or on the command format on selection). This is passed to the phpcbf command as the value for --exclude when not formatting a whole file.
  • phpSniffer.disableWhenDebugging: Disable sniffing when any debug session is active.

Known Issues

Windows Hanging PHP Process

When phpcs encounters a malformed array declaration, it can sometimes hang from an error. This is exacerbated by the fact that we do not have access to the spawned php process in the extension code and cannot kill php.exe directly. This causes many non-exiting PHP processes on Windows machines which can really slow down the machine. The fix for this is to update squizlabs/PHP_Codesniffer in use to >=3.4.2.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].