Skip to content

Commit

Permalink
csv: Rename filename column as path in CSV output of check-fixmes
Browse files Browse the repository at this point in the history
It's a (relative) path, not a mere filename.
  • Loading branch information
dbaty committed Apr 12, 2024
1 parent 0760f7b commit 29dbfb3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/check_oldies/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def py_assignee_regex(self):

@dataclasses.dataclass
class Annotation:
filename: str
path: str
line_no: int
line_content: str
age: int = None
Expand All @@ -88,12 +88,12 @@ def must_warn(self):
def to_text(self):
return (
f"{self.assignee: <15} - {self.age: >4} days - "
f"{self.filename}:{self.line_no}: {self.line_content.strip()}"
f"{self.path}:{self.line_no}: {self.line_content.strip()}"
)

def to_dict(self):
return {
"filename": self.filename,
"path": self.path,
"line_no": self.line_no,
"assignee": self.assignee,
"line_content": self.line_content,
Expand Down Expand Up @@ -196,7 +196,7 @@ def get_annotations(config: Config):

for annotation in annotations:
last_committer, last_modification = get_line_blame(
annotation.filename, annotation.line_no, cwd=config.path
annotation.path, annotation.line_no, cwd=config.path
)
last_committer = get_login_from_committer_email(last_committer)
match = config.py_assignee_regex.search(annotation.line_content)
Expand Down
2 changes: 1 addition & 1 deletion src/check_oldies/check_fixmes.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def main():
annotations = check_oldies.annotations.get_annotations(config)
if config.only_old:
annotations = [a for a in annotations if a.is_old]
annotations.sort(key=lambda f: (f.assignee, -f.age, f.filename, f.line_no))
annotations.sort(key=lambda f: (f.assignee, -f.age, f.path, f.line_no))
has_old_annotations = any(ann for ann in annotations if ann.is_old)

ok_msg = err_msg = ""
Expand Down
2 changes: 1 addition & 1 deletion src/check_oldies/forget_me_not.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def generate_emails(reports_by_email, config):
config.email_body_annotation_line_template.format(
age=annotation.age,
repo=annotation.repository,
path=annotation.filename,
path=annotation.path,
line_no=annotation.line_no,
line_content=annotation.line_content.strip(),
)
Expand Down

0 comments on commit 29dbfb3

Please sign in to comment.