mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Allow space separated package patterns in framework-aggregated reports
This commit is contained in:
@@ -11,8 +11,7 @@ Java framework & library support
|
||||
`Apache Commons IO <https://commons.apache.org/proper/commons-io/>`_,``org.apache.commons.io``,,22,,,,,,,,
|
||||
`Apache Commons Lang <https://commons.apache.org/proper/commons-lang/>`_,``org.apache.commons.lang3``,,370,,,,,,,,
|
||||
`Apache Commons Text <https://commons.apache.org/proper/commons-text/>`_,``org.apache.commons.text``,,272,,,,,,,,
|
||||
`Apache HttpComponents <https://hc.apache.org/>`_,``org.apache.hc.core5.*``,2,66,1,,,1,,,,
|
||||
`Apache HttpComponents <https://hc.apache.org/>`_,``org.apache.http``,3,67,2,,,2,,,,
|
||||
`Apache HttpComponents <https://hc.apache.org/>`_,"``org.apache.hc.core5.*``, ``org.apache.http``",5,133,3,,,3,,,,
|
||||
`Google Guava <https://guava.dev/>`_,``com.google.common.*``,,107,6,,6,,,,,
|
||||
Java Standard Library,``java.*``,3,313,15,13,,,,,,2
|
||||
Java extensions,``javax.*``,22,8,12,,,,,1,1,
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
Framework name,URL,Package prefix
|
||||
Framework name,URL,Package prefixes
|
||||
Java Standard Library,,java.*
|
||||
Java extensions,,javax.*
|
||||
Google Guava,https://guava.dev/,com.google.common.*
|
||||
Apache Commons IO,https://commons.apache.org/proper/commons-io/,org.apache.commons.io
|
||||
Apache Commons Lang,https://commons.apache.org/proper/commons-lang/,org.apache.commons.lang3
|
||||
Apache Commons Text,https://commons.apache.org/proper/commons-text/,org.apache.commons.text
|
||||
Apache HttpComponents,https://hc.apache.org/,org.apache.hc.core5.*
|
||||
Apache HttpComponents,https://hc.apache.org/,org.apache.http
|
||||
Apache HttpComponents,https://hc.apache.org/,org.apache.hc.core5.* org.apache.http
|
||||
Android,,android.*
|
||||
Spring,https://spring.io/,org.springframework.*
|
||||
|
@@ -48,20 +48,23 @@ class FrameworkCollection:
|
||||
return framework
|
||||
return None
|
||||
|
||||
def get_patterns(self):
|
||||
return self.package_patterns
|
||||
|
||||
def get_frameworks(self):
|
||||
return self.frameworks
|
||||
|
||||
def __package_match(self, package: packages.Package, pattern):
|
||||
def __package_match_single(self, package: packages.Package, pattern):
|
||||
return (pattern.endswith("*") and package.name.startswith(pattern[:-1])) or (not pattern.endswith("*") and pattern == package.name)
|
||||
|
||||
def __package_match(self, package: packages.Package, pattern):
|
||||
patterns = pattern.split(" ")
|
||||
return any(self.__package_match_single(package, pattern) for pattern in patterns)
|
||||
|
||||
def get_package_filter(self, framework: Framework):
|
||||
"""
|
||||
Returns a lambda filter that holds for packages that match the current framework.
|
||||
|
||||
The pattern is either full name, such as "org.hibernate", or a prefix, such as "java.*"
|
||||
The pattern is either full name, such as "org.hibernate", or a prefix, such as "java.*".
|
||||
Patterns can also contain a space separated list of patterns, such as "java.sql javax.swing".
|
||||
|
||||
Package patterns might overlap, in case of 'org.apache.commons.io' and 'org.apache.*', the statistics for
|
||||
the latter will not include the statistics for the former.
|
||||
"""
|
||||
@@ -69,4 +72,4 @@ class FrameworkCollection:
|
||||
self.__package_match(p, framework.package_pattern) and \
|
||||
all(
|
||||
len(framework.package_pattern) >= len(pattern) or
|
||||
not self.__package_match(p, pattern) for pattern in self.get_patterns())
|
||||
not self.__package_match(p, pattern) for pattern in self.package_patterns)
|
||||
|
||||
@@ -207,7 +207,8 @@ for config in configs:
|
||||
row_prefix + "`" + framework.name + " <" + framework.url + ">`_")
|
||||
|
||||
# Add the package name to the row
|
||||
row.append("``" + framework.package_pattern + "``")
|
||||
row.append(", ".join("``{0}``".format(p)
|
||||
for p in framework.package_pattern.split(" ")))
|
||||
|
||||
# Collect statistics on the current framework
|
||||
def collect_framework(): return collect_package_stats(
|
||||
|
||||
Reference in New Issue
Block a user