Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Commit

Permalink
staticanalysis/bot: Append diff-id to the linting messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
abpostelnicu committed May 17, 2019
1 parent dbdea1e commit febe210
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/staticanalysis/bot/static_analysis_bot/report/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
}
COMMENT_FAILURE = '''
Code analysis found {defects_total} in this patch{extras_comments}:
Code analysis found {defects_total} in this patch diff n°{diff_id}{extras_comments}:
{defects}
'''
COMMENT_RUN_ANALYZERS = '''
Expand Down Expand Up @@ -113,7 +113,7 @@ def stats(items):
for cls, items in groups
])

def build_comment(self, issues, bug_report_url, patches=[]):
def build_comment(self, revision, issues, bug_report_url, patches=[]):
'''
Build a Markdown comment about published issues
'''
Expand Down Expand Up @@ -144,6 +144,7 @@ def pluralize(word, nb):
comment = COMMENT_FAILURE.format(
extras_comments=extras,
defects_total=pluralize('defect', nb),
diff_id=revision.diff_id,
defects='\n'.join(defects),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def publish_comment(self, revision, issues, patches):
self.api.comment(
revision.id,
self.build_comment(
revision=revision,
issues=non_coverage_issues,
patches=patches,
bug_report_url=BUG_REPORT_URL,
Expand Down
4 changes: 2 additions & 2 deletions src/staticanalysis/bot/tests/test_reporter_phabricator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import responses

VALID_CLANG_TIDY_MESSAGE = '''
Code analysis found 1 defect in this patch:
Code analysis found 1 defect in this patch diff n°42:
- 1 defect found by clang-tidy
You can run this analysis locally with:
Expand All @@ -21,7 +21,7 @@
''' # noqa

VALID_CLANG_FORMAT_MESSAGE = '''
Code analysis found 1 defect in this patch:
Code analysis found 1 defect in this patch diff n°42:
- 1 defect found by clang-format
You can run this analysis locally with:
Expand Down

0 comments on commit febe210

Please sign in to comment.