Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxianpeng committed Dec 21, 2023
1 parent a457fe8 commit ca74e22
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,4 @@ jobs:
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
- name: Test cpp-linter-hooks
run: |
pip install pre-commit
pre-commit install
pre-commit try-repo . -c testing/.pre-commit-config.yaml --files testing/main.c | tee result.txt || true
grep -e "Failed" result.txt
if [ $? -ne 0 ]; then
exit 1
fi
run: sh testing/run.sh
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ tests/__pycache__
.coverage
__pycache__
venv
result.txt
result.txt
testing/main.c
2 changes: 0 additions & 2 deletions cpp_linter_hooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

clang_tools = ['clang-format', 'clang-tidy']
args = list(sys.argv[1:])
print(args)

expect_version = get_expect_version(args)
print(f"expect_version is {expect_version}")

for tool in clang_tools:
if expect_version:
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
coverage
pre-commit
pytest
17 changes: 17 additions & 0 deletions testing/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pre-commit install
pre-commit try-repo . -c testing/.pre-commit-config.yaml --files testing/main.c | tee result.txt || true

failed_cases=`grep -c "Failed" result.txt`

if [ $failed_cases -eq 2 ]; then
echo "=============================="
echo "Test cpp-linter-hooks success."
echo "=============================="
exit 0
rm result.txt
else
echo "============================="
echo "Test cpp-linter-hooks failed."
echo "============================="
exit 1
fi

0 comments on commit ca74e22

Please sign in to comment.