Skip to content

Commit

Permalink
feat: use ruff
Browse files Browse the repository at this point in the history
update precommit

cleanup

fix linter action
  • Loading branch information
sainak committed Dec 7, 2023
1 parent 6ea03f9 commit 31159c3
Show file tree
Hide file tree
Showing 10 changed files with 492 additions and 697 deletions.
14 changes: 0 additions & 14 deletions .flake8

This file was deleted.

56 changes: 30 additions & 26 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
name: Lint Code Base
name: Lint

on:
push:
branches:
- master
pull_request:
branches: [master]
merge_group:

jobs:
build:
if: github.repository == 'coronasafe/care'
name: Lint Code Base
lint:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
statuses: write

steps:
- name: Checkout Code
uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

- name: Get changed files
id: changed-files
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "changed_files=$(git diff -diff-filter=ACMR --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
else
echo "changed_files=$(git diff -diff-filter=ACMR --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
fi
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"

- run: pip install --upgrade pre-commit

- uses: actions/cache@v3
with:
fetch-depth: 0
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Lint Code Base
uses: github/super-linter/slim@v5
env:
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: false
VALIDATE_PYTHON_BLACK: true
VALIDATE_PYTHON_FLAKE8: true
VALIDATE_PYTHON_ISORT: true
LINTER_RULES_PATH: /
# PYTHON_BLACK_CONFIG_FILE: "pyproject.toml"
PYTHON_FLAKE8_CONFIG_FILE: ".flake8"
PYTHON_ISORT_CONFIG_FILE: "pyproject.toml"
- name: Lint
run: pre-commit run --files ${{ steps.changed-files.outputs.changed_files }}
Loading

0 comments on commit 31159c3

Please sign in to comment.