Skip to content

Commit

Permalink
Enable clazy in drone
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
  • Loading branch information
Felix Weilbach committed Jun 17, 2021
1 parent 3e77ae0 commit 3e3c124
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ steps:
path: /drone/build
commands:
- cd /drone/build
- cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_BUILD_TYPE=Debug -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address ../src
- cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clazy -DCMAKE_BUILD_TYPE=Debug -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address ../src
- name: compile
image: ghcr.io/nextcloud/continuous-integration-client:client-5.12-18
volumes:
- name: build
path: /drone/build
commands:
- cd /drone/build
- ninja
- ninja 2>1 | /drone/src/admin/linux/count_compiler_warnings.py /drone/src
- name: test
image: ghcr.io/nextcloud/continuous-integration-client:client-5.12-18
volumes:
Expand Down
40 changes: 40 additions & 0 deletions admin/linux/count_compiler_warnings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python3

# Small script that counts the warnings which the compiler emits
# and takes care that not more warnings are added.

import sys
import re
import requests


if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} REPOSITORY_PATH")
sys.exit(1)

repository_path = sys.argv[1]
warning_regex = re.compile(r'warning:', re.M)
max_allowed_warnings_count_response = requests.get(
"https://nextclouddesktopwarningscount.felixweilbach.de")

if max_allowed_warnings_count_response.status_code != 200:
print('Can not get maximum number of allowed warnings')
sys.exit(1)

max_allowed_warnings_count = int(max_allowed_warnings_count_response.content)

print("Max number of allowed warnings:", max_allowed_warnings_count)

warnings_count = 0

for line in sys.stdin:
if warning_regex.findall(line):
warnings_count += 1

print(line, end="")

if warnings_count > max_allowed_warnings_count:
print("Error: Too many warnings! You probably introduced a new warning!")
sys.exit(1)

print("Total number of warnings:", warnings_count)

0 comments on commit 3e3c124

Please sign in to comment.