Skip to content

Commit

Permalink
Only support tags >= 9
Browse files Browse the repository at this point in the history
Loosen regex to detect unexpectedly missing version in the future.
  • Loading branch information
marco-antognini-sonarsource committed Dec 16, 2024
1 parent 69127ba commit 3b74531
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rspec-tools/rspec_tools/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

RULES_FILENAME = 'covered_rules.json'

DEPENDENCY_RE = re.compile(r'''\bdependency\s+['"](?:com|org)\.sonarsource\.[\w.-]+:(?P<plugin_name>[\w-]+):(?P<version>\d+(\.\d+)+)['"]''')
DEPENDENCY_RE = re.compile(r'''\bdependency\s+['"](?:com|org)\.sonarsource\.[\w.-]+:(?P<plugin_name>[\w-]+):(?P<version>\d+(\.\d+)+)?''')

BUNDLED_SIMPLE = r'''['"](?:com|org)\.sonarsource\.[\w.-]+:(?P<plugin_name>[\w-]+)['"]'''
BUNDLED_MULTI = r'''\(\s*group:\s*['"][\w.-]+['"],\s*name:\s*['"](?P<plugin_name2>[\w-]+)['"],\s*classifier:\s*['"][\w-]+['"]\s*\)'''
Expand Down Expand Up @@ -262,6 +262,10 @@ def get_plugin_versions(git_repo, version):
content = g.show(f'{version}:build.gradle')
versions = {}
for m in re.finditer(DEPENDENCY_RE, content):
if m['plugin_name'] in ['sonar-plugin-api', 'sonar-plugin-api-test-fixtures']:
# Ignore these "plugins". They may not have a numerical version.
continue
assert m['version'], f'Failed to find version from dependency {m[0]}'
versions[m['plugin_name']] = m['version']
return versions

Expand Down Expand Up @@ -360,7 +364,7 @@ def is_interesting_version(version):
major = int(version[:version.find('.')])
except ValueError:
return False
return major >= 8
return major >= 9

def collect_coverage_per_product():
git_repo = checkout_repo('sonar-enterprise')
Expand Down

0 comments on commit 3b74531

Please sign in to comment.