Skip to content

Commit

Permalink
fixup! Reformat files
Browse files Browse the repository at this point in the history
Signed-off-by: JafarAkhondali <[email protected]>
  • Loading branch information
JafarAkhondali committed Jul 6, 2023
1 parent 9c564db commit 5f442f0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,9 @@ Improver
^^^^^^^^^

All the Improvers must inherit from ``Improver`` superclass and implement the
``interesting_advisories`` property and the ``get_inferences`` method, unless they are not improving advisory data.
In this case they should override ``is_custom_improver`` property to True and implement the ``run`` method.
``interesting_advisories`` property and the ``get_inferences`` method,
unless they are not improving advisory data. In this case they should override
``is_custom_improver`` property to True and implement the ``run`` method.


Writing an improver
Expand Down
1 change: 0 additions & 1 deletion vulnerabilities/improver.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class Improver:
def is_custom_improver(cls):
return False


@classproperty
def qualified_name(cls):
"""
Expand Down
5 changes: 3 additions & 2 deletions vulnerabilities/improvers/add_commit_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CommitRelationImprover(Improver):
"""
Detect related commits to an advisory by applying a REGEX.
"""

def __init__(self):
# using cached insertion for memory efficiency
self.insert_chunk_size = 500
Expand All @@ -48,12 +49,12 @@ def interesting_references(self) -> QuerySet:
)

def __generate_instance(self):
commit_pattern = r'(((?P<repo>(https|http):\/\/(bitbucket|github|gitlab)\.(org|com)\/(?P<owner>[^\/]+)\/(?P<project>[^\/]*))\/(commit|commits)\/(?P<hash>\w+)#?)+)'
commit_pattern = r"(((?P<repo>(https|http):\/\/(bitbucket|github|gitlab)\.(org|com)\/(?P<owner>[^\/]+)\/(?P<project>[^\/]*))\/(commit|commits)\/(?P<hash>\w+)#?)+)"
for ref in self.interesting_references:
commit_groups = re.search(commit_pattern, ref.url)
yield Commit(
reference=ref,
hash=commit_groups.group('hash'),
hash=commit_groups.group("hash"),
)

def __insert_bulk(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion vulnerabilities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ class Commit(models.Model):
chain_urls = models.JSONField(
default=list,
help_text="List of URLS used to reach the commit",
blank = True,
blank=True,
)

class Meta:
Expand Down

0 comments on commit 5f442f0

Please sign in to comment.