Skip to content

Commit

Permalink
Fix Violation.to_github_annotation method
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalq97 committed Dec 4, 2024
1 parent 97e73b9 commit c98b4d7
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions riff/violation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ class Violation(NamedTuple):

def to_github_annotation(self: "Violation") -> str:
relativized_path = self.path.relative_to(Path.cwd())
first_part = f"::error title=Ruff ({self.error_code}),file={self.path},line={self.line_start},"
"col={self.column_start},endLine={self.line_end},endColumn={self.column_end}::"

second_part = f"{relativized_path}:{self.line_start}:"
if self.column_start:
second_part += f"{self.column_start}:"
return f"{first_part}{second_part} {self.error_code} {self.message}"
return f'::error file={relativized_path},line={self.line_start},col={self.column_start},endLine={self.line_end},endColumn={self.column_end}::"Ruff ({self.error_code})"'

@staticmethod
def parse(raw: dict) -> "Violation":
Expand Down

0 comments on commit c98b4d7

Please sign in to comment.