mirror of
https://github.com/catchorg/Catch2.git
synced 2025-01-16 07:08:01 +00:00
Compare commits
5 Commits
a9941d4231
...
0fa133a0c5
Author | SHA1 | Date | |
---|---|---|---|
|
0fa133a0c5 | ||
|
447b39cae0 | ||
|
851a0e907e | ||
|
93312b369e | ||
|
d913837a5d |
14
.github/workflows/validate-header-guards.yml
vendored
14
.github/workflows/validate-header-guards.yml
vendored
@ -1,7 +1,5 @@
|
||||
name: Check header guards
|
||||
|
||||
# Run this workflow every time a new commit pushed to your repository
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
@ -20,8 +18,7 @@ jobs:
|
||||
- name: Install checkguard
|
||||
run: pip install guardonce
|
||||
|
||||
# Check include guard naming convention
|
||||
- name: checkguard
|
||||
- name: Check that include guards are properly named
|
||||
run: |
|
||||
wrong_files=$(checkguard -r src/catch2/ -p "name | append _INCLUDED | upper")
|
||||
if [[ $wrong_files ]]; then
|
||||
@ -30,7 +27,10 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check duplicate files for include guard conflicts
|
||||
- name: checknames
|
||||
- name: Check that there are no duplicated filenames
|
||||
run: |
|
||||
python tools/scripts/checkDuplicateFilenames.py
|
||||
./tools/scripts/checkDuplicateFilenames.py
|
||||
|
||||
- name: Check that all source files have the correct license header
|
||||
run: |
|
||||
./tools/scripts/checkLicense.py
|
||||
|
0
tools/scripts/checkConvenienceHeaders.py
Normal file → Executable file
0
tools/scripts/checkConvenienceHeaders.py
Normal file → Executable file
0
tools/scripts/checkDuplicateFilenames.py
Normal file → Executable file
0
tools/scripts/checkDuplicateFilenames.py
Normal file → Executable file
32
tools/scripts/checkLicense.py
Executable file
32
tools/scripts/checkLicense.py
Executable file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def get_license():
|
||||
with open("src/catch2/catch_all.hpp", "r") as f:
|
||||
license = f.readlines()[0:7]
|
||||
|
||||
return license
|
||||
|
||||
|
||||
def check_license(license):
|
||||
failed = 0
|
||||
base_dir = "src/catch2/"
|
||||
|
||||
# The _ represents the list of directories in base_dir
|
||||
for root, _, files in os.walk(base_dir):
|
||||
for file in files:
|
||||
with open(root + "/" + file, "r") as f:
|
||||
file_license = f.readlines()[0:7]
|
||||
|
||||
if file_license != license:
|
||||
print("File %s does not have license" % file)
|
||||
failed = 1
|
||||
|
||||
return failed
|
||||
|
||||
|
||||
license = get_license()
|
||||
status = check_license(license)
|
||||
sys.exit(status)
|
Loading…
Reference in New Issue
Block a user