Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyright always reports unused violations even after disabling them #94

Open
vikigenius opened this issue Jun 12, 2024 · 3 comments
Open

Comments

@vikigenius
Copy link

from typing import Literal


class MyService(object):
    """My Service."""

    def __init__(self, env: Literal["prod", "dev", "stg"] = "stg", country: Literal["us", "ca"] = "us") -> None:
        super().__init__()
        a = 4

I have the following in my pyproject.toml

[tool.pyright]
include = ["src"]
exclude = ["notebooks"]
reportUnusedVariable = false
reportUnusedImport = false

And pyright still complains about all 3 env is not accessed country is not accessed and a is not accessed

@seagle0128
Copy link
Collaborator

Did pyright server report the events?

@vikigenius
Copy link
Author

@seagle0128 yep. Here are the server logs. They seem to be reported with a severity of 4 which is not any of error, warning, info.

[Trace - 05:41:47 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/void/Projects/Research/lexutilair/src/lexutilair/prs.py",
  "version": 0,
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 8,
          "character": 23
        },
        "end": {
          "line": 8,
          "character": 26
        }
      },
      "message": "\"env\" is not accessed",
      "severity": 4,
      "source": "Pyright",
      "tags": [
        1
      ]
    },
    {
      "range": {
        "start": {
          "line": 8,
          "character": 67
        },
        "end": {
          "line": 8,
          "character": 74
        }
      },
      "message": "\"country\" is not accessed",
      "severity": 4,
      "source": "Pyright",
      "tags": [
        1
      ]
    }
  ]
}

The logs doesn't show a is not accessed because I added it later as a test and didn't recapture the logs.

@seagle0128
Copy link
Collaborator

So it's an issue of pyright server or configuration issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants