diff --git a/.github/workflows/jslint.yml b/.github/workflows/jslint.yml index 27c54d0..0d5dd2c 100644 --- a/.github/workflows/jslint.yml +++ b/.github/workflows/jslint.yml @@ -23,7 +23,13 @@ jobs: run: npm install -g prettier - name: Run Prettier (JS Linting) - run: prettier --check '**/*.{js,ts,jsx,tsx,vue,css,html,json}' --log-level debug --write + run: | + FILES=$(find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.jsx" -o -name "*.tsx" -o -name "*.vue" -o -name "*.css" -o -name "*.html" -o -name "*.json" \)) + if [ -n "$FILES" ]; then + echo "$FILES" | xargs prettier --log-level debug --write + else + echo "No matching files found for linting." + fi - name: Fail on Lint Errors if: failure() diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index cb75be4..8b19aaf 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -22,13 +22,27 @@ jobs: - name: Install Python Dependencies run: | python -m pip install --upgrade pip - pip install flake8 black + pip install flake8 black diff-cover - name: Configure Flake8 - run: echo -e "[flake8]\nmax-line-length = 256\nindent-size = 4" > .flake8 + run: | + echo "[flake8]" > .flake8 + echo "max-line-length = 256" >> .flake8 + echo "indent-size = 4" >> .flake8 - - name: Run Flake8 (Python Linting) - run: flake8 . --count --show-source --statistics + - name: Get changed Python files + id: get_diff + run: | + git fetch origin ${{ github.base_ref }} + echo "changed_files=$(git diff --name-only origin/${{ github.base_ref }} -- '*.py' | tr '\n' ' ')" >> $GITHUB_OUTPUT - - name: Check Python Formatting with Black - run: black --check --diff --line-length 256 --target-version py310 --skip-string-normalization --fast . || true + - name: Run Flake8 on changed files + if: steps.get_diff.outputs.changed_files != '' + run: | + echo "Linting changed files: ${{ steps.get_diff.outputs.changed_files }}" + flake8 ${{ steps.get_diff.outputs.changed_files }} + + - name: Check Python Formatting with Black (changed files only) + if: steps.get_diff.outputs.changed_files != '' + run: | + black --check --diff --line-length 256 --target-version py310 --skip-string-normalization --fast ${{ steps.get_diff.outputs.changed_files }}