Skip to content

Commit

Permalink
Update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
yakhyo committed Mar 23, 2024
1 parent 630a2d8 commit 3ca6694
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 519 deletions.
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Note
- If you plan to add some new features that involve large changes, it is encouraged to open an issue for discussion first.
- If you are the author of some papers and would like to include your method to mmsegmentation,
please contact Yakhyokhuja Valikhujaev (yakhyo9696\[at\]gmail\[dot\]com). We will much appreciate your contribution


## Code style

Expand All @@ -32,7 +32,7 @@ We use the following tools for linting and formatting:
- [pydocstyle](https://github.com/PyCQA/pydocstyle): sort imports


We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `trailing whitespaces`,
We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `trailing whitespaces`,
fixes `end-of-files` automatically on every commit.
The config for a pre-commit hook is stored in [.pre-commit-config](../.pre-commit-config.yaml).

Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/linter.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Continuous Integration (CI) GitHub Action

name: Github Actions

on:
push:
branches: "*"
pull_request:
branches: ["main"]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
flake8 . --count --config=setup.cfg --show-source --statistics
43 changes: 16 additions & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-json
- id: requirements-txt-fixer
- id: no-commit-to-branch
args: [ '--branch', 'main' ]
args: ["--branch", "main"]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [ cython ]
- id: isort
name: isort (pyi)
types: [ pyi ]
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
language_version: python3.10
exclude: ^requirements\.txt$

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
exclude: ^requirements\.txt$

- repo: local
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args: [
"-rn", # Only display messages
"-sn", # Don't display the score
"--rcfile=.pylintrc", # Link to your config file
"--load-plugins=pylint.extensions.docparams", # Load an extension
]
- id: flake8
args: [--config=setup.cfg]
name: PEP8
Loading

0 comments on commit 3ca6694

Please sign in to comment.