@@ -163,21 +163,105 @@ jobs:
163163 with :
164164 python-version : ' 3.12'
165165
166- - name : Install linting tools
166+ - name : Install system dependencies for C++ linting
167+ run : |
168+ sudo apt-get update
169+ sudo apt-get install -y cppcheck clang-tidy || echo "C++ linting tools not available"
170+
171+ - name : Install Python linting tools
167172 run : |
168173 python3 -m pip install --upgrade pip
169- pip install flake8 black isort mypy || echo "Linting tools installation failed (optional)"
174+ pip install flake8 black isort mypy pylint
170175
171176 - name : Check Python syntax
172177 run : |
173- python3 -m py_compile python/*.py tests/*.py examples/*.py || true
174- echo "Python syntax check completed"
178+ echo "Checking Python syntax..."
179+ python3 -m py_compile python/*.py tests/*.py examples/*.py
180+ echo "Python syntax check passed"
175181
176- - name : Check for common issues
182+ - name : Run flake8 (Python linting)
177183 run : |
178- # Check for TODO/FIXME comments that might indicate incomplete work
184+ echo "Running flake8..."
185+ flake8 python/ tests/ examples/ \
186+ --max-line-length=120 \
187+ --extend-ignore=E203,E501,W503 \
188+ --exclude=__pycache__,*.pyc,build,dist \
189+ --count \
190+ --statistics || {
191+ echo "ERROR: flake8 found issues"
192+ exit 1
193+ }
194+
195+ - name : Check code formatting with black
196+ run : |
197+ echo "Checking code formatting with black..."
198+ black --check --diff python/ tests/ examples/ || {
199+ echo "ERROR: Code is not formatted with black. Run 'black python/ tests/ examples/' to fix."
200+ exit 1
201+ }
202+
203+ - name : Check import sorting with isort
204+ run : |
205+ echo "Checking import sorting with isort..."
206+ isort --check-only --diff python/ tests/ examples/ || {
207+ echo "ERROR: Imports are not sorted correctly. Run 'isort python/ tests/ examples/' to fix."
208+ exit 1
209+ }
210+
211+ - name : Run mypy (type checking)
212+ run : |
213+ echo "Running mypy type checking..."
214+ # Use --ignore-missing-imports for gradual typing adoption
215+ mypy python/ --ignore-missing-imports --no-strict-optional || {
216+ echo "WARNING: mypy found type issues (non-blocking for now)"
217+ # Don't exit 1 yet - allow gradual adoption of type hints
218+ }
219+
220+ - name : Run pylint (additional Python linting)
221+ run : |
222+ echo "Running pylint..."
223+ pylint python/*.py tests/*.py examples/*.py \
224+ --max-line-length=120 \
225+ --disable=all \
226+ --enable=errors,warnings \
227+ --ignore=__pycache__,build,dist || {
228+ echo "WARNING: pylint found issues (non-blocking)"
229+ # Don't exit 1 - use as advisory
230+ }
231+
232+ - name : Run cppcheck (C++ static analysis)
233+ run : |
234+ echo "Running cppcheck on C++ source files..."
235+ if command -v cppcheck &> /dev/null; then
236+ # Run cppcheck on each directory separately
237+ cppcheck --enable=all --suppress=missingIncludeSystem \
238+ --suppress=unusedFunction \
239+ --error-exitcode=1 \
240+ lib/ python/ include/ || {
241+ echo "ERROR: cppcheck found issues"
242+ exit 1
243+ }
244+ else
245+ echo "WARNING: cppcheck not available, skipping C++ linting"
246+ fi
247+
248+ - name : Check for common code quality issues
249+ run : |
250+ echo "Checking for common code quality issues..."
251+
252+ # Check for TODO/FIXME comments (informational)
179253 if grep -r "TODO\|FIXME" --include="*.py" --include="*.cc" --include="*.h" python/ lib/ tests/ | head -20; then
180- echo "Found TODO/FIXME comments (this is informational)"
254+ echo "INFO: Found TODO/FIXME comments (review recommended)"
255+ fi
256+
257+ # Check for debug print statements
258+ if grep -r "print(" --include="*.py" python/ tests/ examples/ | grep -v "#.*print" | head -10; then
259+ echo "WARNING: Found print() statements (consider using logging)"
260+ fi
261+
262+ # Check for hardcoded secrets or keys
263+ if grep -ri "password\|secret\|api_key\|private_key" --include="*.py" --include="*.cc" --include="*.h" python/ lib/ tests/ | grep -v "test\|example\|TODO\|FIXME" | head -5; then
264+ echo "WARNING: Potential hardcoded secrets found (review recommended)"
181265 fi
182266
183267 documentation-check :
0 commit comments