Skip to content

Commit

Permalink
ci(pre-commit): Re-enable pre-commit
Browse files Browse the repository at this point in the history
ci(ruff): add `ruff`
  • Loading branch information
eddiebergman committed May 2, 2024
2 parents dbc3076 + d6302ca commit 8482948
Show file tree
Hide file tree
Showing 76 changed files with 1,715 additions and 1,568 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: pre-commit

# This will prevent multiple runs of the same workflow from running concurrently
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
# Trigger manually
workflow_dispatch:

# Trigger on any push to the master
push:
branches:
- master

# Trigger on any push to a PR that targets master
pull_request:
branches:
- master

jobs:

run-all-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
- run: pip install pre-commit
- run: pre-commit install
- run: pre-commit run --all-files

99 changes: 47 additions & 52 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,63 +1,58 @@
default_language_version:
python: python3
files: |
(?x)^(
neps|
tests
)/.*\.py$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
files: ".*"
- id: check-case-conflict
files: ".*"
- id: check-merge-conflict
- id: end-of-file-fixer
- id: debug-statements
files: ".*"
- id: check-yaml
files: ".*"
- id: end-of-file-fixer
files: ".*"
types: ["yaml"]
- id: check-toml

- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black

- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
args: [--never]
exclude: ^(neps_examples/|tests)

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm
- mdformat-tables
- mdformat-beautysh
- mdformat-black
files: ".*"
types: ["toml"]
- id: debug-statements
files: '^src/.*\.py$'

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
rev: v1.10.0
hooks:
- id: mypy
files: |
(?x)^(
neps
)/.*\.py$
additional_dependencies:
- types-termcolor
- types-PyYAML

- repo: https://github.com/terrencepreilly/darglint
rev: v1.8.1
hooks:
- id: darglint
args: [-z=long,-v=2,--indentation=4]
files: (neps/api.py|neps/status.py|neps/optimizers/bayesian_optimization/optimizer.py)

- repo: https://github.com/PyCQA/pylint
rev: v2.17.0
hooks:
- id: pylint
- "types-pyyaml"
args:
- "--no-warn-return-any" # Disable this because it doesn't know about 3rd party imports
- "--ignore-missing-imports"
- "--show-traceback"

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.2
hooks:
- id: check-github-workflows
files: '^github/workflows/.*\.ya?ml$'
types: ["yaml"]
- id: check-dependabot
files: '^\.github/dependabot\.ya?ml$'

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --no-cache]
- id: ruff-format
Loading

0 comments on commit 8482948

Please sign in to comment.