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

Updated API call for blocker_violations #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 6 additions & 6 deletions src/main/resources/sonar/VerifyNoBlockingViolations.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
credentials = CredentialsFallback(sonarServer, username, password).getCredentials()
content = None
RESPONSE_OK_STATUS = 200
metrics = ['blocking_violations', 'major_violations', 'sqale_index']
metrics = ['blocker_violations', 'major_violations', 'sqale_index']

sonarServerAPIUrl = sonarUrl + '/api/resources?resource=%s&metrics=%s' % (resource, ','.join(metrics))
print sonarServerAPIUrl
Expand All @@ -48,19 +48,19 @@
for item in json_data[0]['msr']:
metrics_data[item['key']] = item['val']

blocking_violations = int(metrics_data.get('blocking_violations', 0))
blocker_violations = int(metrics_data.get('blocking_violations', 0))
major_violations = int(metrics_data.get('major_violations', 0))
sqale_index = int(metrics_data.get('sqale_index', 0))

print "Metrics: blocking_violations=%s major_violations=%s sqale_index=%s\n" % (
blocking_violations, major_violations, sqale_index)
print "Metrics: blocker_violations=%s major_violations=%s sqale_index=%s\n" % (
blocker_violations, major_violations, sqale_index)

#
# blocking_violations 0
# blocker_violations 0
# major_violations 0
# sqale_index < 3000
#
if blocking_violations == 0 and major_violations < 351 and sqale_index < 9000:
if blocker_violations == 0 and major_violations < 351 and sqale_index < 9000:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make sense to make 351 and 9000 configurable?

print "pass\n"
else:
print "fail\n"
Expand Down