Skip to content

feat: Support basedpyright linter#990

Open
phuongfi91 wants to merge 6 commits into
trunk-io:mainfrom
NextGenContributions:feat/phuongfi91/linter-basedpyright
Open

feat: Support basedpyright linter#990
phuongfi91 wants to merge 6 commits into
trunk-io:mainfrom
NextGenContributions:feat/phuongfi91/linter-basedpyright

Conversation

@phuongfi91

Copy link
Copy Markdown

basedpyright is a fork of pyright so they should be quite similar to each other. Let's support it 😎

@trunk-io

trunk-io Bot commented Mar 6, 2025

Copy link
Copy Markdown

✨ This comment will be updated with CI stats as CI jobs run ✨
settingsfeedbackdocs ⋅ learn more about trunk.io

@EliSchleifer

Copy link
Copy Markdown
Member

can you rebase this please -

@EliSchleifer EliSchleifer self-requested a review May 14, 2026 19:51
@EliSchleifer

Copy link
Copy Markdown
Member

@phuongfi91 - can you resolve the conflicts - would like to get this in

Copilot AI review requested due to automatic review settings June 9, 2026 04:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for the basedpyright type-checker as a linter plugin, including a JSON→SARIF converter and a basic linter snapshot test.

Changes:

  • Introduce basedpyright plugin definition + lint command wiring.
  • Add a Python parser (basedpyright_to_sarif.py) to convert basedpyright JSON diagnostics into SARIF.
  • Add basic fixture input + Jest snapshot to validate emitted issues.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
linters/basedpyright/plugin.yaml Registers basedpyright tool and check command, wiring output through a custom parser.
linters/basedpyright/basedpyright_to_sarif.py Converts basedpyright --outputjson diagnostics to SARIF results.
linters/basedpyright/basedpyright.test.ts Adds a smoke test invoking the linter check harness.
linters/basedpyright/test_data/basic.in.py Adds Python source fixture intended to trigger representative diagnostics.
linters/basedpyright/test_data/basedpyright_v1.28.1_basic.check.shot Adds snapshot of expected issues emitted by basedpyright + parser.
README.md Documents basedpyright as a supported Python linter and adds link reference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +44 to +48
sarif = {
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
"version": "2.1.0",
"runs": [{"results": results}],
}

results = []

for result in json.load(sys.stdin)["generalDiagnostics"]:
}
],
"message": {
"text": result["message"].replace("Â", ""),
@@ -0,0 +1,57 @@
from typing import Callable, Iterator, Union, Optional, Enum

class A:
x: int = 0 # Regular class variable
y: ClassVar[int] = 0 # Pure class variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants