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

fix(solve-bug-in-linting): Updated the linting command to check only stable errors according to ruff and ignore others #383

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions zt_backend/utils/linting.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
RUFF_COMMAND = [
"ruff",
"check",
"--preview",
"--output-format=json",
"--extend-ignore=E402", # Ignore import position errors
"--extend-ignore=E,W", # Ignore unwanted errors
"-",
]

Expand All @@ -37,13 +38,13 @@ async def run_ruff_linting(text: str) -> List[Dict]:
stdout, stderr = process.communicate(input=text)

if stderr:
logger.error(f"Error running Ruff: {stderr.decode()}")
logger.error(f"Error running Ruff: {stderr}")
return []

try:
return json.loads(stdout)
except json.JSONDecodeError:
logger.error(f"Error decoding Ruff output: {stdout.decode()}")
logger.error(f"Error decoding Ruff output: {stdout}")
return []


Expand Down
Loading