Skip to content

Added linters to the project #12

Added linters to the project

Added linters to the project #12

Workflow file for this run

name: Linting
on:
push:
branches:
- main
paths:
- "**.js"
- "**.html"
- "**.css"
- "**.py"
pull_request:
branches:
- main
paths:
- "**.js"
- "**.html"
- "**.css"
- "**.py"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 14
- name: Checkout code
uses: actions/checkout@v2
- name: Get modified files
id: get_modified_files
run: echo "::set-output name=files::$(git diff --name-only HEAD^)"
- name: Install dependencies
run: npm ci # For JavaScript linting (replace with your package manager command)
- name: Run ESLint
run: npx eslint ${{ steps.get_modified_files.outputs.files }} --ext .js --fix
- name: Run HTMLHint
run: |
for file in ${{ steps.get_modified_files.outputs.files }}; do
htmlhint --rules .htmlhintrc "$file" || true
done
- name: Run Stylelint
run: npx stylelint ${{ steps.get_modified_files.outputs.files }} --quiet --fix
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Python dependencies
run: pip install -r requirements.txt # For Python linting (replace with your command)
- name: Run Pylint
run: |
for file in ${{ steps.get_modified_files.outputs.files }}; do
pylint --disable=all --enable=warning --rcfile=.pylintrc "$file" || true
done