Skip to content

Commit

Permalink
misc/ci.py: To make local dev easier, ignore files from .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Apr 27, 2024
1 parent 6659750 commit f5b04af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: dnf install -y ninja-build cmake gtest-devel re2c clang
run: dnf install -y ninja-build cmake gtest-devel re2c clang python3-GitPython
- name: Linting
run: misc/ci.py
- name: Configure with CMake
Expand Down
5 changes: 3 additions & 2 deletions misc/ci.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3

import git
import os

ignores = [
'.git/',
'misc/afl-fuzz-tokens/',
'ninja_deps',
'src/depfile_parser.cc',
'src/lexer.cc',
]
Expand All @@ -17,10 +17,11 @@ def error(path: str, msg: str) -> None:
error_count += 1
print('\x1b[1;31m{}\x1b[0;31m{}\x1b[0m'.format(path, msg))

repo = git.Repo('.')
for root, directory, filenames in os.walk('.'):
for filename in filenames:
path = os.path.join(root, filename)[2:]
if any([path.startswith(x) for x in ignores]):
if any([path.startswith(x) for x in ignores]) or repo.ignored(path):
continue
with open(path, 'rb') as file:
line_nr = 1
Expand Down

0 comments on commit f5b04af

Please sign in to comment.