feat: refactoring #19
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Code Quality and Linting | |
| on: | |
| push: | |
| branches: [ master, feat/* ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| lint: | |
| name: Code Quality Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install linting dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black isort flake8 mypy bandit safety | |
| if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Check code formatting with Black | |
| run: | | |
| black --check --diff src/ tests/ | |
| - name: Check import sorting with isort | |
| run: | | |
| isort --check-only --diff src/ tests/ | |
| - name: Lint with flake8 | |
| run: | | |
| flake8 src/ tests/ --count --select=E9,F63,F7,F82 --show-source --statistics | |
| flake8 src/ tests/ --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics | |
| - name: Type checking with mypy | |
| run: | | |
| mypy src/refactored/ --ignore-missing-imports --no-strict-optional --disable-error-code union-attr --disable-error-code index --disable-error-code assignment --disable-error-code arg-type --disable-error-code return-value --disable-error-code call-overload --disable-error-code operator --disable-error-code attr-defined --disable-error-code misc --disable-error-code dict-item --disable-error-code import-untyped || echo "Type checking completed with warnings" | |
| - name: Security analysis with bandit | |
| run: | | |
| # Use bandit.yaml config file for exclusions and skips | |
| bandit -r src/ -f json -o bandit-report.json -c bandit.yaml | |
| bandit -r src/ --severity-level medium -c bandit.yaml | |
| - name: Dependency security check | |
| run: | | |
| safety check --json --output safety-report.json | |
| - name: Upload security reports | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: security-reports | |
| path: | | |
| bandit-report.json | |
| safety-report.json | |
| spellcheck: | |
| name: Spell Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js for cspell | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Install cspell | |
| run: npm install -g cspell | |
| - name: Run spell check | |
| run: | | |
| cspell "src/refactored/**/*.py" "tests/**/*.py" "*.md" "doc/*.md" --config cspell.json | |
| markdown-lint: | |
| name: Markdown Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js for markdownlint | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Install markdownlint-cli | |
| run: npm install -g markdownlint-cli | |
| - name: Lint Markdown files | |
| run: | | |
| markdownlint "*.md" "doc/*.md" --ignore node_modules |