4

I am working on some legacy code, and VScode is highlighting a lot of lines because of some warnings like Line exceeds 85 characters, contains 91 characters. It's pretty annoying, and I'd like to raise that limit to at least 120 chars, or even disable it completely. My vertical ruler is already set to 120.

How can I move or remove that limit? I've been looking everywhere but I can't find a a working answer... this is my project's settings.json

{
    "editor.wordWrapColumn": 120
}
ToX 82
  • 1,064
  • 12
  • 35

1 Answers1

5

Edit phpcs settings in VS Code and make sure "PHP Sniffer: Standard" is blank (so that it looks for your custom ruleset file).

Create file "phpcs.xml" in your project root, containing a ruleset like:

<?xml version="1.0"?>
<ruleset name="MyRuleset">
  <!-- Scan all files in directory -->
  <file>.</file>

  <!-- Ignore Composer dependencies -->
  <exclude-pattern>vendor/</exclude-pattern>

  <!-- Show colors in console -->
  <arg value="-colors"/>

  <!-- Show sniff codes in all reports -->
  <arg value="ns"/>

  <!-- Use PSR-12 as a base -->
  <rule ref="PSR12"/>

  <rule ref="Generic.Files.LineLength.TooLong">
      <severity>0</severity>
  </rule>
</ruleset>
BenW
  • 71
  • 1
  • 5
  • Doesn't work for me. I get the error `phpcs: The "c:\Users\paul\OneDrive\Games\Scratch\Shops\PP\Site\phpcs.xml" coding standard is not installed. Please review your configuration an try again.` – RedGuy11 Jan 19 '21 at 03:44