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

Tool name in description #43

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions ghlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ def long_desc(self):
def short_desc(self):
return self.json["rule"]["id"]

def tool_name(self):
return self.json["tool"]["name"]

def get_key(self):
return util.make_key(self.github_repo.repo_id + "/" + str(self.number()))

Expand Down
13 changes: 11 additions & 2 deletions jiralib.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
ALERT_NUMBER={alert_num}
REPOSITORY_KEY={repo_key}
ALERT_KEY={alert_key}
TOOL_NAME={tool_name}
"""


Expand Down Expand Up @@ -175,6 +176,7 @@ def create_issue(
alert_num,
repo_key,
alert_key,
tool_name
):
raw = self.j.create_issue(
project=self.projectkey,
Expand All @@ -189,6 +191,7 @@ def create_issue(
alert_num=alert_num,
repo_key=repo_key,
alert_key=alert_key,
tool_name=tool_name,
),
issuetype={"name": "Bug"},
labels=self.labels,
Expand All @@ -204,6 +207,7 @@ def create_issue(
alert_type=alert_type,
alert_num=alert_num,
repo_id=repo_id,
tool_name=tool_name
)
)

Expand Down Expand Up @@ -314,7 +318,7 @@ def parse_alert_info(desc):
them as a tuple. If parsing fails for one of the fields,
return a tuple of None's.
"""
failed = None, None, None, None
failed = None, None, None, None, None
m = re.search("REPOSITORY_NAME=(.*)$", desc, re.MULTILINE)
if m is None:
return failed
Expand All @@ -335,11 +339,16 @@ def parse_alert_info(desc):
return failed
repo_key = m.group(1)
m = re.search("ALERT_KEY=(.*)$", desc, re.MULTILINE)
if m is None:
return failed
tool_name = m.group(1)
m = re.search("TOOL_NAME=(.*)$", desc, re.MULTILINE)
if m is None:
return failed
alert_key = m.group(1)

return repo_id, alert_num, repo_key, alert_key, alert_type

return repo_id, alert_num, repo_key, alert_key, alert_type, tool_name


def repo_id_to_fname(repo_id):
Expand Down
1 change: 1 addition & 0 deletions sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def sync(self, alert, issues, in_direction):
alert.number(),
alert.github_repo.get_key(),
alert.get_key(),
alert.tool_name(),
)
newissue.adjust_state(alert.get_state())
return alert.get_state()
Expand Down