bacadra / pulsar-linter-ruff

Linting Python files using ruff
MIT License
4 stars 0 forks source link

Automatic or Default Severity Levels #2

Closed emendir closed 2 weeks ago

emendir commented 4 months ago

Currently, ruff marks all linting issues with the "Error" severity. To get around this, pulsar-linter-ruff requires the user to manually specify the severity levels of the different ruff rules, of which there are hundreds.

Can you provide sensible or official severity levels automatically or by default?

My temporary workaround was to disable pulsar-linter-ruff, install the python-lsp-ruff python-package (pip install python-lsp-ruff) and let pulsar's built-in linter package do the linting, because it automatically assigns severity levels.

asiloisad commented 4 months ago

Hi, the idea is so good. I wanted to do this from the start, but I havent't found any clue as to what severity should be applied to each rule. If you have a clue, please link it here. A manual read & assign of each rule it's out of scope 😅 https://docs.astral.sh/ruff/rules/

asiloisad commented 4 months ago

A python-lsp-ruff package has use they own simply severity classification, but imo it's naive https://github.com/python-lsp/python-lsp-ruff?tab=readme-ov-file#custom-severities. You can reuse it in my package, just type every rule letter in "Severity selection: Warning" e.g. E, F, W, Y, B, C. My package has a little advantage that add a star after severity number to tell you that this rule hasn't been classiffied yet.

There is my config for linter-ruff pulsar package. You can type it in pacakge setting or directly in config.cson:

  "linter-ruff":
    error: [
      "F821"
    ]
    ignore: [
      "B018"
      "C408"
      "E401"
      "E402"
      "E501"
      "E701"
      "E702"
      "E703"
      "E722"
      "E731"
      "E741"
      "E743"
      "ARG005"
    ]
    info: [
      "F401"
      "F403"
      "C4"
      "ARG"
      "F541"
      "F841"
      "E711"
    ]
    select: [
      "E"
      "F"
      "W191"
      "YTT"
      "B006"
      "B015"
      "B018"
      "B021"
      "C4"
      "ARG"
    ]
    warning: [
      "E713"
      "E721"
      "E714"
      "F405"
      "W191"
      "B006"
      "F811"
    ]