Giter Club home page Giter Club logo

vscode-linter's Introduction

Linter
Extension for code linting, all in one package.

VSCode Marketplace Installs Linter Version

Linter in Action

Extension for code linting, all in one package. New linters can be easily added through an extension framework.

Supports out of the box:

Features:

  • Implement new linters easily with just a few lines of code.
  • Ignore rules (end-of line, file, or current line).
  • Fix files (depends on linter's support).
  • Add links to rule's documentation.
  • Linters are lazy loaded, so you won't waste computer memory with linters you don't use.

Usage

Install the extension by visiting https://marketplace.visualstudio.com/items?itemName=fnando.linter or searching for fnando.linter.

Linter will use the binary that's on your $PATH; if your file is not being linted, check the "linter" output panel for additional information.

Output panel

You can tweak your linters configuration by editing only the nodes you need; for instance, to disable a linter, all you need is something like this:

{
  "linter.linters": {
    "ruby": {
      "enabled": false
    }
  }
}

Development

License

Copyright © 2021 Nando Vieira

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

vscode-linter's People

Contributors

fbbergamo avatar fnando avatar kittydoor avatar stauchert avatar xiejiangzhi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vscode-linter's Issues

Add DBT "jinja-sql" files to sqlfluff linter

DBT is a popular framework for data modeling and transformations, is is built on SQL with jinja macros, and their official plugin extension records a file type "Jinja SQL", which can be linted with sqlfluff with the DBT templater

Sqlfluff officially supports DBT

# .sqlfluff
[sqlfluff]
dialect = bigquery
templater = dbt

It would be great to add this compatibility out of the box when installing the extension

Feature - Support node_modules/.bin

Since a number of linters are npm packages it would be great to support node_modules/.bin in addition to $PATH so that we can add the various linters as devDependencies of the current project avoiding the need for developers to install them globally and we can control the version to avoid issues where different developers can be using different versions.

Clippy lints fail because "offense is for another file" on Windows

Clippy lints for Rust files aren't working for me. In the linter log, every lint produces a message like this:

offense is for another file {
  "src": "file://d:\\Documents\\Creation\\Rust\\project\\src\\main.rs",
  "uri": "file:///d%3A/Documents/Creation/Rust/project/src/main.rs"
}

or

offense is for another file {
  "src": "file://d:\\Documents\\Creation\\Rust\\project\\src\\main.rs",
  "uri": "file:///d%3A/Documents/Creation/Rust/project/src/app.rs"
}

This appears to happen for main.rs as well as all other files. Using Clippy 0.1.72 on Windows, VSCode version 1.84.0, extension version 0.0.19.

npm gherkin-lint

Hello,

It's not clear to me how to enable the Cucumber Lint (https://www.npmjs.com/package/gherkin-lint) with your Linter

On my local, it's set package.json

"scripts": {
"lint:feature": "gherkin-lint -c tests/.gherkin-lintrc"

Then npm run lint:feature to lint.

Ideally, could you add this to default?

Thank you

Add support for venv

Currently, linters such as yamllint that are installed using Python require them to be installed globally. When they are installed in a venv, they work normally, but aren't seen by the linter extension.

Searched for any of yamllint; couldn't be found within $PATH: [
...
]

This is a problem as not only it requires polluting the $PATH, but can be hard to do in systems with multiple Python versions, where installed packages don't get added to the $PATH.

yamllint: ignore rule in config file doesn't work

I've created some ignore rule in .yamllint.yaml like the following

rules:
  indentation:
    ignore:
      - "base/templates/deployment.yaml"

When I run yamllint from the command line all works fine.
But in VS-Code I still get a line to long error.

After some experimentation I stumbled about this in .settings

    "yamllint": {
      "capabilities": ["ignore-line"],
      "command": [
        "yamllint",
        "--format",
        "parsable",
        ["$config", "--config-file", "$config"],
        "-"
      ],
...

which means, yamllint reads the file from stdin and obvious has no filename.

I can get around this problem by calling yamllint with the filename

    "yamllint": {
      "capabilities": ["ignore-line"],
      "command": [
        "yamllint",
        "--format",
        "parsable",
        ["$config", "--config-file", "$config"],
        "$file" # <-- change!
      ],
...

but I have to re-write the ignore rules to

rules:
  indentation:
    ignore:
      - "**/base/templates/deployment.yaml"

because it seems, that yamllint is not executed from the root of the workspace.

After these changes my yaml files are linted as they were linted from the command line.

Is there anything that I miss, or is there a better way to tackle this problem?

Markdownlint error: `spawnSync markdownlint ENOENT`

I have a bug with Linter and Markdownlint.

I'm on Windows and I've installed Markdownlint using npm install -g markdownlint-cli, but I get this error:

Error while running "markdownlint": spawnSync markdownlint ENOENT

I restarted my machine, just in case, but same error.

Here's the whole output (regarding markdownlint, not the other linters, which are not installed anyway):

Linter config: {
  "capabilities": [
    "fix-inline"
  ],
  "command": [
    "markdownlint",
    "--json",
    [
      "$fixAll",
      "--fix"
    ],
    [
      "$config",
      "--config",
      "$config"
    ],
    "--stdin"
  ],
  "configFiles": [
    ".markdownlint.json",
    ".markdownlint.yaml",
    ".markdownlint.yml",
    ".markdownlintrc"
  ],
  "enabled": true,
  "languages": [
    "markdown"
  ],
  "name": "markdownlint",
  "url": "https://github.com/DavidAnson/markdownlint"
}
Args: {
  "$rootDir": "c:\\path\\to\\root\\dir",
  "$file": "/c:/path/to/file.md",
  "$extension": ".md",
  "$extensionBare": "md",
  "$config": "",
  "$debug": false,
  "$lint": true,
  "$language": "markdown",
  "$shebang": ""
}
{
  "rootDir": "c:\\path\\to\\root\\dir",
  "configFile": "",
  "command": [
    "markdownlint",
    "--json",
    "--stdin"
  ]
}
Error while running "markdownlint": spawnSync markdownlint ENOENT
markdownlint's command took 4ms

(I only edited the paths for privacy reasons)

I used cmd to run markdownlint --json --stdin < c:/path/to/file.md (without the leading / in the file path), and it worked as expected.

Copy/paste is verrry slow, backspace and newline (enter key) too

Type: Bug

Try to edit a text with backspacing sometime and enter newline with enter key.
It's very slow.
Copy/paste is very slow too even for few chars

Extension version: 0.0.19
VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:49:37.021Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz (8 x 2112)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 7.76GB (3.34GB free)
Process Argv --crash-reporter-id a081c408-d0c4-4c33-8cc5-548b6e439ff8
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vshan820:30294714
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
py29gd2263:30899288
vsclangdf:30486550
c4g48928:30535728
azure-dev_surveyone:30548225
f6dab269:30613381
pythongtdpath:30769146
i26e3531:30792625
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2cf:30928864
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
aa_t_chat:30882232
cp7184t3:30927821

Made prettier to load a lot

Type: Bug

Made prettier to load a lot when saving file

Extension version: 0.0.13
VS Code version: Code 1.70.1 (6d9b74a70ca9c7733b29f0456fd8195364076dda, 2022-08-10T06:08:33.642Z)
OS version: Windows_NT x64 10.0.22000
Modes:
Connection to 'wsl+Ubuntu' could not be established

System Info
Item Value
CPUs Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 2592)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.91GB (16.38GB free)
Process Argv --crash-reporter-id 65355a84-9a99-4d60-9d6b-3ca1bb3e980a
Screen Reader no
VM 0%

Connection to 'wsl+Ubuntu' could not be established

A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
wslgetstarted:30449410
cppdebug:30492333
pylanb8912:30545647
vsclangdf:30486550
c4g48928:30535728
hb751961:30543456
dsvsc012:30540252
azure-dev_surveyone:30548225

PHPCS: Searched for shim - couldn't be found within $PATH

PHPCS Version: 3.7.2 (stable)

Searched for any of /Users/jacob/.vscode-insiders/extensions/fnando.linter-0.0.19/shims/phpcs-shim; couldn't be found within $PATH

It then goes on to print my $PATH, which includes all the proper paths, including the one to the phpcs script.

It's worth mentioning that I don't think this error message is particularly helpful or accurate.

I tried debugged the phpcs-shim. I get an exit code of 127 from the phpcs call.

I then tried replicating the command using phpcs directly. However, I discovered that it's hanging with using STDIN. Passing the file as the last argument seems to work, without using STDIN, using phpcs directly.

phpcs --report=json --standard=/path/to/phpcs.xml /path/to/file.php -q

I then tried modifying the /Users/jacob/.vscode-insiders/extensions/fnando.linter-0.0.19/shims/phpcs-shim arguments to match the successful command from phpcs. I'm able to get the command array to print what seems to be the correct arguments, but I suspect the shim isn't written to handle the file being at the end of the command, without a flag.

  "command": [
    "/Users/jacob/.vscode-insiders/extensions/fnando.linter-0.0.19/shims/phpcs-shim",
    "--report",
    "json",
    "--standard",
    "/path/to/phpcs.xml",
    "/path/to/file.php",
    "-q"
  ]

At this point, maybe that shim can be rewritten to process the /path/to/file.php without a flag. But, I don't want to go down that path if there is something else going on here that I'm overlooking.

Any ideas?

No linters found for "dockercompose"

Hi,

I'm using vscode-linter to lint my yaml and docker-compose.yml (which is yaml) files.
Since I have also the "composer" extension for docker, the Language id changed from yaml to dockercompose. and yamllint don't recognize this.

It works if I run yamllint manually:
yamllint -c ~/.yamllint.yml docker-compose.yml

Output in vscode:

Language id: dockercompose
No linters found for "dockercompose"

settings.json:

"linter.linters": {
    "yamllint": {
      "capabilities": [
        "ignore-line"
      ],
      "command": [
        "yamllint",
        "--format",
        "parsable",
        [
          "$config",
          "--config-file",
          "$config"
        ],
        "-"
      ],
      "configFiles": [
        ".yamllint.yml",
        ".yamllint.yaml",
        ".yamllint"
      ],
      "enabled": true,
      "languages": [
        "yaml",
      ],
      "name": "yamllint",
      "url": "https://github.com/adrienverge/yamllint"
    }
  },

I have added dockercompose to languages, but no result:

"languages": [
        "yaml",
        "dockercompose"
      ],

I also added a complete new section, with language only set to dockercompose, no luck...

"linter.linters": {
    "yamllint": {
      "capabilities": [
        "ignore-line"
      ],
      "command": [
        "yamllint",
        "--format",
        "parsable",
        [
          "$config",
          "--config-file",
          "$config"
        ],
        "-"
      ],
      "configFiles": [
        ".yamllint.yml",
        ".yamllint.yaml",
        ".yamllint"
      ],
      "enabled": true,
      "languages": [
        "yaml",
      ],
      "name": "yamllint",
      "url": "https://github.com/adrienverge/yamllint"
    },
    "yamllint_dockercompose": {
      "capabilities": [
        "ignore-line"
      ],
      "command": [
        "yamllint",
        "--format",
        "parsable",
        [
          "$config",
          "--config-file",
          "$config"
        ],
        "-"
      ],
      "configFiles": [
        ".yamllint.yml",
        ".yamllint.yaml",
        ".yamllint"
      ],
      "enabled": true,
      "languages": [
        "dockercompose"
      ],
      "name": "yamllint_dockercompose",
      "url": "https://github.com/adrienverge/yamllint"
    }
  },

What can I do here? Do i something wrong?

Thanks for help :)

Not finding linter in Windows without `.exe`

I just got this error:

[10/5/2022, 8:27:19 PM] The yamllint binary couldn't be found within $PATH: [
  // omitted for brevity...
  "C:\\Users\\giovanni\\scoop\\apps\\python310\\current\\Scripts",
  // omitted for brevity...  
]

I do have the binary at C:\Users\giovanni\scoop\apps\python310\current\Scripts, it is named yamllint.exe.

It works if I set the config as follows (all I am adding is the .exe:

"linter.linters": {
    "yamllint": {
        "command": [
            "yamllint.exe", // <-- see the .exe
            "--format",
            "parsable",
            [
                "$config",
                "--config-file",
                "$config"
            ],
            "-"
        ]
    }
}

If I remove .exe from this custom config the same error shows up, confirming the problem. It seems to not be able to find .exe on Windows, which is something that works on the OS.

Gherkint-lint extension $file system variable is not correct in windows

Hello Dear,

Install the lintern plugin, to use the gherkint-linter extension and when configuring this extension, I noticed that the $file system variable does not have the correct path for windows, I attach a screenshot.

path Incorrect:
/c:/Users/jose_/OneDrive/Escritorio/Proyecto/arquetipoFrameworkAutomatizacion/src/test/resources/feature/oneFeaturePerFileInCorrect.feature

image

but if I enter the correct raw path it works

Path Correct: c:/Users/jose_/OneDrive/Escritorio/Proyecto/arquetipoFrameworkAutomatizacion/src/test/resources/feature/oneFeaturePerFileInCorrect.feature

image

image

Not working on docker-compose.yaml output filled with `No linters found for "Log"`

Metadata

Extension

  • Id: fnando.linter
  • Version: 0.0.13

VSCode

  • Version: 1.69.2
  • Commit: 3b889b090b5ad5793f524b5d1d39fda662b96a2a
  • Date: 2022-07-19T00:58:08.152Z
  • Electron: 18.3.5
  • Chromium: 100.0.4896.160
  • Node.js: 16.13.2
  • V8: 10.0.139.17-electron.0
  • OS: Linux x64 5.19.0-23-generic

Settings.json

Details
  "linter.linters": {
"brakeman": {
  "capabilities": [],
  "command": [
    [
      "$isBundler",
      "bundle",
      "exec"
    ],
    "brakeman",
    "--format",
    "json",
    "--no-progress",
    "--quiet",
    "--absolute-paths",
    [
      "$config",
      "--config-file",
      "$config"
    ],
    "$rootDir"
  ],
  "configFiles": [
    "brakeman.yml",
    "config/brakeman.yml",
    ".brakeman/config.yml"
  ],
  "enabled": true,
  "languages": [
    "ruby",
    "ruby-puma",
    "ruby-bundler",
    "ruby-test",
    "erb"
  ],
  "name": "brakeman",
  "url": "https://brakemanscanner.org/",
  "when": [
    "$isRails"
  ]
},
"credo": {
  "capabilities": [
    "ignore-line",
    "ignore-file"
  ],
  "command": [
    "mix",
    "credo",
    "--format",
    "json",
    "--read-from-stdin",
    "--all-priorities",
    "$file"
  ],
  "configFiles": [],
  "enabled": true,
  "languages": [
    "elixir"
  ],
  "name": "credo",
  "url": "https://hexdocs.pm/credo/"
},
"dart": {
  "capabilities": [],
  "command": [
    "dart",
    "analyze",
    "$file"
  ],
  "configFiles": [],
  "enabled": true,
  "languages": [
    "dart"
  ],
  "name": "dart",
  "url": "https://dart.dev/tools/linter-rules"
},
"eslint": {
  "capabilities": [
    "ignore-line",
    "ignore-file",
    "fix-one",
    "fix-all",
    "fix-inline"
  ],
  "command": [
    "eslint",
    "--format",
    "json",
    [
      "$config",
      "--config",
      "$config"
    ],
    [
      "$debug",
      "--loglevel",
      "debug",
      "--debug"
    ],
    [
      "$fixAll",
      "--fix-dry-run"
    ],
    [
      "$fixOne",
      "--fix-dry-run"
    ],
    "--stdin-filename",
    "$file",
    "--stdin"
  ],
  "configFiles": [
    ".eslintrc.js",
    ".eslintrc.cjs",
    ".eslintrc.yaml",
    ".eslintrc.yml",
    ".eslintrc.json",
    ".eslintrc"
  ],
  "enabled": true,
  "languages": [
    "javascript",
    "jsx",
    "typescript",
    "typescriptreact"
  ],
  "name": "eslint",
  "url": "https://eslint.org"
},
"hadolint": {
  "capabilities": [
    "ignore-line"
  ],
  "command": [
    "hadolint",
    "--format",
    "json",
    [
      "$config",
      "--config",
      "$config"
    ],
    "-"
  ],
  "configFiles": [
    ".hadolint.yml",
    ".hadolint.yaml"
  ],
  "enabled": true,
  "languages": [
    "dockerfile"
  ],
  "name": "hadolint",
  "url": "https://github.com/hadolint/hadolint"
},
"language-tool": {
  "capabilities": [],
  "command": [
    "languagetool",
    "--json",
    "--autoDetect"
  ],
  "configFiles": [],
  "enabled": true,
  "languages": [
    "markdown",
    "html",
    "plaintext"
  ],
  "name": "language-tool",
  "url": "https://github.com/languagetool-org/languagetool"
},
"luacheck": {
  "capabilities": [],
  "command": [
    "luacheck",
    "--formatter",
    "plain",
    "--codes",
    "--ranges",
    [
      "$config",
      "--config",
      "$config"
    ],
    "-"
  ],
  "configFiles": [
    ".luacheckrc"
  ],
  "enabled": true,
  "languages": [
    "lua"
  ],
  "name": "luacheck",
  "url": "https://luacheck.readthedocs.io/en/stable/"
},
"markdownlint": {
  "capabilities": [
    "fix-inline"
  ],
  "command": [
    "markdownlint",
    "--json",
    [
      "$fixAll",
      "--fix"
    ],
    [
      "$config",
      "--config",
      "$config"
    ],
    "--stdin"
  ],
  "configFiles": [
    ".markdownlint.json",
    ".markdownlint.yaml",
    ".markdownlint.yml",
    ".markdownlintrc"
  ],
  "enabled": true,
  "languages": [
    "markdown"
  ],
  "name": "markdownlint",
  "url": "https://github.com/DavidAnson/markdownlint"
},
"php-code-sniffer": {
  "capabilities": [],
  "command": [
    "phpcs",
    "--report",
    "json",
    [
      "$config",
      "--standard",
      "$config"
    ],
    [
      "!$config",
      "--standard",
      "PSR12"
    ],
    "--stdin-path",
    "$file",
    "-q",
    "-"
  ],
  "configFiles": [
    ".phpcs.xml",
    "phpcs.xml",
    ".phpcs.xml.dist",
    "phpcs.xml.dist"
  ],
  "enabled": true,
  "languages": [
    "php"
  ],
  "name": "php-code-sniffer",
  "url": "https://github.com/squizlabs/PHP_CodeSniffer"
},
"proselint": {
  "capabilities": [
    "fix-inline"
  ],
  "command": [
    "proselint",
    "--json",
    [
      "$config",
      "--config",
      "$config"
    ],
    "-"
  ],
  "configFiles": [
    ".proselintrc"
  ],
  "enabled": true,
  "languages": [
    "markdown",
    "html",
    "plaintext"
  ],
  "name": "proselint",
  "url": "https://github.com/amperser/proselint/"
},
"pylint": {
  "capabilities": [
    "ignore-file"
  ],
  "command": [
    "pylint",
    "--from-stdin",
    "--output-format",
    "json",
    [
      "$config",
      "--rcfile",
      "$config"
    ],
    "$file"
  ],
  "configFiles": [
    ".pylintrc"
  ],
  "enabled": true,
  "languages": [
    "python"
  ],
  "name": "pylint",
  "url": "https://www.pylint.org"
},
"reek": {
  "capabilities": [
    "ignore-line"
  ],
  "command": [
    "reek",
    "--format",
    "json",
    "--no-progress",
    [
      "$config",
      "--config",
      "$config"
    ],
    "--stdin-filename",
    "$file"
  ],
  "configFiles": [
    ".reek.yml"
  ],
  "enabled": true,
  "languages": [
    "ruby",
    "ruby-test",
    "ruby-puma",
    "ruby-bundler"
  ],
  "name": "reek",
  "url": "https://github.com/troessner/reek"
},
"rubocop": {
  "capabilities": [
    "ignore-eol",
    "fix-category",
    "fix-all"
  ],
  "command": [
    [
      "$isBundler",
      "bundle",
      "exec"
    ],
    "rubocop",
    [
      "$lint",
      "--format",
      "json",
      "--extra-details"
    ],
    [
      "$config",
      "--config",
      "$config"
    ],
    [
      "$debug",
      "--debug"
    ],
    [
      "$fixAll",
      "--auto-correct-all",
      "--stderr"
    ],
    [
      "$fixCategory",
      "--auto-correct-all",
      "--only",
      "$code",
      "--stderr"
    ],
    "--stdin",
    "$file"
  ],
  "configFiles": [
    ".rubocop.yml"
  ],
  "enabled": true,
  "languages": [
    "ruby",
    "ruby-test",
    "ruby-puma",
    "ruby-bundler"
  ],
  "name": "rubocop",
  "url": "https://rubocop.org"
},
"ruby": {
  "capabilities": [],
  "command": [
    "ruby",
    "-c",
    "-w"
  ],
  "configFiles": [],
  "enabled": true,
  "languages": [
    "ruby",
    "ruby-test",
    "ruby-puma",
    "ruby-bundler"
  ],
  "name": "ruby",
  "url": "https://www.ruby-lang.org"
},
"shellcheck": {
  "args": {
    "$bash": {
      "extensions": [
        ".bash"
      ]
    },
    "$shellscript": {
      "languages": [
        "shellscript"
      ]
    }
  },
  "capabilities": [],
  "command": [
    "shellcheck",
    "--format",
    "json",
    "--enable",
    "all",
    "-"
  ],
  "configFiles": [],
  "enabled": true,
  "languages": [
    "shellscript",
    "bash"
  ],
  "name": "shellcheck",
  "url": "https://github.com/koalaman/shellcheck"
},
"sqlfluff": {
  "args": {
    "$mysql": {
      "languages": [
        "mysql"
      ]
    },
    "$postgres": {
      "languages": [
        "postgres"
      ]
    }
  },
  "capabilities": [
    "fix-all",
    "ignore-eol"
  ],
  "command": [
    "sqlfluff",
    [
      "$lint",
      "lint",
      "--format",
      "json"
    ],
    [
      "$fixAll",
      "fix"
    ],
    [
      "$postgres",
      "--dialect",
      "postgres"
    ],
    [
      "$mysql",
      "--dialect",
      "mysql"
    ],
    "-"
  ],
  "configFiles": [
    ".sqlfluff"
  ],
  "enabled": true,
  "languages": [
    "mysql",
    "postgres"
  ],
  "name": "sqlfluff",
  "url": "https://docs.sqlfluff.com/en/stable/index.html"
},
"stylelint": {
  "capabilities": [
    "fix-all"
  ],
  "command": [
    "stylelint",
    "--formatter",
    "json",
    [
      "$fixAll",
      "--fix"
    ],
    [
      "$config",
      "--config",
      "$config"
    ],
    "--stdin-filename",
    "$file",
    "--stdin"
  ],
  "configFiles": [
    "stylelint.config.js",
    ".stylelintrc.json",
    ".stylelintrc.yml",
    ".stylelintrc.yaml",
    ".stylelintrc.js"
  ],
  "enabled": true,
  "languages": [
    "css",
    "css-in-js",
    "html",
    "less",
    "markdown",
    "sass",
    "scss",
    "sugarss"
  ],
  "name": "stylelint",
  "url": "https://stylelint.io"
},
"swiftlint": {
  "capabilities": [
    "ignore-line",
    "ignore-file"
  ],
  "command": [
    "swiftlint",
    "--use-stdin",
    "--reporter",
    "json",
    [
      "$fixAll",
      "--fix",
      "--format"
    ],
    [
      "$config",
      "--config",
      "$config"
    ]
  ],
  "configFiles": [
    ".swiftlint.yml",
    ".swiftlint.yaml"
  ],
  "enabled": true,
  "languages": [
    "swift"
  ],
  "name": "swiftlint",
  "url": "https://realm.github.io/SwiftLint/"
},
"textlint": {
  "capabilities": [
    "fix-inline"
  ],
  "command": [
    "textlint",
    "--format",
    "json",
    [
      "$debug",
      "--debug"
    ],
    [
      "$config",
      "--config",
      "$config"
    ],
    "--stdin",
    "--stdin-filename",
    "$file"
  ],
  "configFiles": [
    ".textlintrc",
    ".textlintrc.js",
    ".textlintrc.json",
    ".textlintrc.yaml",
    ".textlintrc.yml"
  ],
  "enabled": true,
  "languages": [
    "markdown",
    "plaintext",
    "html"
  ],
  "name": "textlint",
  "url": "https://textlint.github.io"
},
"vale": {
  "capabilities": [],
  "command": [
    "vale",
    "--output",
    "JSON",
    [
      "$config",
      "--config",
      "$config"
    ],
    "--ext",
    "$extension"
  ],
  "configFiles": [
    ".vale.ini"
  ],
  "enabled": true,
  "languages": [
    "markdown",
    "plaintext",
    "html"
  ],
  "name": "vale",
  "url": "https://github.com/errata-ai/vale"
},
"yamllint": {
  "capabilities": [
    "ignore-line"
  ],
  "command": [
    "yamllint",
    "--format",
    "parsable",
    [
      "$config",
      "--config-file",
      "$config"
    ],
    "-"
  ],
  "configFiles": [
    ".yamllint.yml",
    ".yamllint.yaml",
    ".yamllint"
  ],
  "enabled": true,
  "languages": [
    "yaml"
  ],
  "name": "yamllint",
  "url": "https://github.com/adrienverge/yamllint"
}

}

Output linter

[02/11/2022, 10:21:37] No linters found for "Log"

[02/11/2022, 10:21:37] Reading from cache? false

Error searching for linters on Windows

When searching for tools on Windows the path is incorrect. It seems to be using Linux's path separator :, instead of Windows' ;.

Sample output:

[5/19/2022, 4:43:12 PM] The yamllint binary couldn't be found within $PATH: [
  "C",
  "\\Program Files\\PowerShell\\7;C",
  "\\Windows\\System32;C",
  "\\Windows;C",
...

Custom linter doesn't work without "configFiles" property

I have set up a simple custom linter according to the instructions here.

It worked just fine until I removed the configFiles property from the configuration in package.json.
When it's missing, the plugin builds, get loaded (it's listed in "available linters" log entry), but it never gets executed. No errors or warnings are issues anywhere (or at least in all places I searched for).

This is very counter-intuitive - some simple linters may not require or even support configuration files.

Adding an empty list: "configFiles": [] resolves the issue, but I spent quite some time to find it out.

i dont't get it

  • Do i replace Stylelint extension?
  • Does it read my .Stylelintrc
  • How run it and get the output (npx run linter ?)
  • How to make it work with Prettier ?

v0.0.14 and Later Breaks Linting on MacOS

When using the linter plugin on 0.0.13, I get the following output

[1/13/2023, 11:56:00 AM] {
  "rootDir": "/Users/My.User/projects/my_root_path",
  "configFile": "",
  "command": [
    "/absolute/path/to/linting_script.rb",
    "--",
    "--format",
    "json",
    "--extra-details",
    "/absolute/path/to/target_file.rb",
  ]
}
[1/13/2023, 11:56:01 AM] rubocop's command took 1528ms

After which, linting errors correctly populate in my IDE.

But when I upgrade to 0.0.14 or later, get the following error:

Searched for any of /absolute/path/to/linting_script.rb; couldn't be found within $PATH: [
  "/opt/homebrew/bin",
  // ...
  "/usr/local/share/dotnet",
  "~/.dotnet/tools"
]
rubocop's command took 0ms

My guess is that one of windows compatibility fixes caused an issue for Unix systems.

Typo in tagline for VS code

The tagline for the package in VSCode reads:

An extension for VSCode that provides linting for multiple languages in on package.

It should say,

An extension for VSCode that provides linting for multiple languages in >>> one <<< package.

Disable linter

In the documentation it says I can disable linters as such:

{
  "linter.linters": {
    "ruby": {
      "enabled": false
    }
  }
}

I've tried adding the above to VSCode's settings.json, but that didn't have any effect. Where and how is Linter supposed to be configured?

a couple of odd choices

thanks for making this. but i'm wondering, why are the default config files for eslint set to prettier? it should be eslint config files. also, why is it linting the console/log window?

Yamllint does not work in Windows: Overidding default command feature

At first, the debugging console said that the executable could not be found in $PATH after adding it, I was getting the following error:

Error while running "yamllint": spawnSync yamllint ENOENT
yamllint's command took 4ms

I realized that it is not working because for Windows users, the only possible way is through pip (docs). Due to this, executable is not a normal "binary" but a python script. And I guess this is where the plugin struggles. Potential solutions are:

  • Is there a quick fix I can do on my side for it? Right now I am calling yamllint with python3 -m yamllint. While in Ubuntu I did not need the python3 -m part, in Windows I do. I also tried defining an alias but of course it is not working.
  • About the fix in this repository, is there a possibility to call for python3 -m yamllint if calling yamllint throws this error?
  • I have also integrated linters into other IDEs by using these type of plugins. Few of them had the possibility to override the default command to avoid these issues. I think this would be the best option. With this, I could define in my settings.json from VSCode that I do not want to use the yamllint command but python3 -m yamllint. This will also solve potential problems that will arise with other plugins, as it provides with good enough flexibility.

I cannot think about any other possible solutions
Thanks!

Blocks saving and Github Copilot

I've noticed that this extension will

  • delay a file from being saved until linters run
  • block GitHub copilot from making inline suggestions

Are there any plans to address these things? I've started to read in the code to see if I can figure out where these things happen but I'm not super savvy with VSCode extensions (recently converted from vim). Happy to try and work on these things if someone pointed me in the right direction on where to start!

does not work with workspace ?

Hi,

I tested this extension on a shell script

It worked when i opened a folder containing the script

But it didn't worked when i opened a workspace (with only 1 folder) containing this folder

No linters found for "sql"

Hello:

I have sqlfluff installed but when I save my postgres migration file with .sql extension, linter reports No linters found for "sql".

Does it need extra configuration? What should I do to work it around? Please lend a hand!

Bad command/path generation on Windows

I am using this extension on VS Code in Windows with gherkin-lint and am having some issues. If I look at the output, I get something like this:

Language id: cucumber
Matching linters: [
"gherkin-lint"
]
Reading from cache? false
Linter config: {
"capabilities": [],
"command": [
"gherkin-lint",
"--config",
"$config",
"--format",
"json",
"$file"
],
"configFiles": [
".gherkin-lintrc"
],
"enabled": true,
"languages": [
"cucumber"
],
"name": "gherkin-lint",
"url": "https://github.com/vsiakka/gherkin-lint"
}
Args: {
"$rootDir": "c:\Projects\AyaHealthcare\Applications\QaAutomation",
"$file": "/c:/Projects/AyaHealthcare/Applications/QaAutomation/cypress/e2e/smoke/travelx/ticketing-smoke-tests.feature",
"$extension": ".feature",
"$extensionBare": "feature",
"$config": "c:\Projects\AyaHealthcare\Applications\QaAutomation\.gherkin-lintrc",
"$debug": false,
"$lint": true,
"$language": "cucumber",
"$shebang": ""
}
{
"rootDir": "c:\Projects\AyaHealthcare\Applications\QaAutomation",
"configFile": "c:\Projects\AyaHealthcare\Applications\QaAutomation\.gherkin-lintrc",
"command": [
"gherkin-lint",
"--config",
"c:\Projects\AyaHealthcare\Applications\QaAutomation\.gherkin-lintrc",
"--format",
"json",
"/c:/Projects/AyaHealthcare/Applications/QaAutomation/cypress/e2e/smoke/travelx/ticketing-smoke-tests.feature"
]
}
Error while running "gherkin-lint": spawnSync gherkin-lint ENOENT
gherkin-lint's command took 37ms

Just trying to throw things at the wall and see what would stick, I customized the command used in my settings.json so that it would add the .cmd extension to it, and that does cause it to at least no longer return the error running the command.

"linter.linters": {
"gherkin-lint": {
"command": [
"gherkin-lint.cmd",
"--config",
"$config",
"--format",
"json",
"$file"
]
}
},

But it doesn't return any issues, even if there are issues reported running gherkin-lint directly. I noticed the $file path generated always seems to have a / at the beginning, and I'm thinking perhaps that's causing a problem?

Language id: cucumber
Matching linters: [
"gherkin-lint"
]
Reading from cache? false
Linter config: {
"capabilities": [],
"command": [
"gherkin-lint.cmd",
"--config",
"$config",
"--format",
"json",
"$file"
],
"configFiles": [
".gherkin-lintrc"
],
"enabled": true,
"languages": [
"cucumber"
],
"name": "gherkin-lint",
"url": "https://github.com/vsiakka/gherkin-lint"
}
Args: {
"$rootDir": "c:\Projects\AyaHealthcare\Applications\QaAutomation",
"$file": "/c:/Projects/AyaHealthcare/Applications/QaAutomation/cypress/e2e/smoke/travelx/ticketing-smoke-tests.feature",
"$extension": ".feature",
"$extensionBare": "feature",
"$config": "c:\Projects\AyaHealthcare\Applications\QaAutomation\.gherkin-lintrc",
"$debug": false,
"$lint": true,
"$language": "cucumber",
"$shebang": ""
}
{
"rootDir": "c:\Projects\AyaHealthcare\Applications\QaAutomation",
"configFile": "c:\Projects\AyaHealthcare\Applications\QaAutomation\.gherkin-lintrc",
"command": [
"gherkin-lint.cmd",
"--config",
"c:\Projects\AyaHealthcare\Applications\QaAutomation\.gherkin-lintrc",
"--format",
"json",
"/c:/Projects/AyaHealthcare/Applications/QaAutomation/cypress/e2e/smoke/travelx/ticketing-smoke-tests.feature"
]
}
gherkin-lint's command took 493ms

If I run the command exactly as it is laid out in the output directly in my terminal, but without that slash at the beginning of the file path, gherkin-lint runs successfully and returns the list of issues:

gherkin-lint.cmd --config c:\Projects\AyaHealthcare\Applications\QaAutomation.gherkin-lintrc --format json c:/Projects/AyaHealthcare/Applications/QaAutomation/cypress/e2e/smoke/travelx/ticketing-smoke-tests.feature
[{"filePath":"c:\Projects\AyaHealthcare\Applications\QaAutomation\cypress\e2e\smoke\travelx\ticketing-smoke-tests.feature","errors":[{"message":"Missing Feature name","rule":"no-unnamed-features","line":1},{"message":"Forbidden tag @Focus on Scenario","rule":"no-restricted-tags","line":3}]}]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.