Files
mongo/buildscripts/linter/ruffchecker.py
Steve McClure b4b23946cd SERVER-90570: Enable formatting checks for buildscripts directory, excluding idl (#22254)
GitOrigin-RevId: 9d997a9f44cd43a8dec7c2a17fa2dbcd875e92f6
2024-05-16 22:07:36 +00:00

36 lines
895 B
Python

"""Ruff linter support module."""
from typing import List
from . import base
class RuffChecker(base.LinterBase):
"""Ruff linter."""
def __init__(self):
# type: () -> None
"""Create a Ruff linter."""
super(RuffChecker, self).__init__("ruff", "0.4.4")
def get_lint_version_cmd_args(self) -> list[str]:
"""Get the command to run a version check."""
return ["--version"]
def get_lint_cmd_args(self, files: list[str]) -> list[str]:
"""Get the command to run a check."""
if not files:
return ["check"]
files = " ".join(files)
return ["check", files]
def get_fix_cmd_args(self, files: list[str]) -> list[str]:
"""Get the command to run a fix."""
if not files:
return ["check", "--fix"]
files = " ".join(files)
return ["check", "--fix", files]