带有VScode的phpcs-如何禁用行长警告?

我正在处理一些旧代码,并且由于诸如Line exceeds 85 characters,contains 91 characters之类的警告,VScode突出显示了很多行。这很烦人,我想将该限制提高到至少120个字符,甚至完全禁用它。 我的垂直标尺已经设置为120。

如何移动或取消该限制?我到处都在找,但是找不到有效的答案...这是我项目的settings.json

{
    "editor.wordWrapColumn": 120
}
q7236181 回答:带有VScode的phpcs-如何禁用行长警告?

在VS Code中编辑phpcs设置,并确保“ PHP Sniffer:Standard”为空白(以便它查找您的自定义规则集文件)。

在项目根目录中创建文件“ phpcs.xml”,其中包含如下规则集:

<?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>
本文链接:https://www.f2er.com/3136832.html

大家都在问