Skip to content

Commit

Permalink
Add format and lint checks to cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
14renus committed Jan 17, 2025
1 parent 1d9a9db commit fe0897c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Lint codebase'

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

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: pre-commit/actions@v3.0.1
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Config to automatically run checks and fixes of code format on git commit.
#
# To use, run `pre-commit install` in the root of the repository.
# See https://pre-commit.com for more information.

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.2
hooks:
# Run the linter.
- id: ruff
args: [ --fix ] # enable lint fixes
# Run the formatter.
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
args: ["--skip=*.ipynb", "--ignore-words-list=hist"]
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ ignore = [
"geoarches/backbones/weatherlearn_utils/*" = ["N"]
"geoarches/lightning_modules/__init__.py" = ["F401"]


[tool.poetry.group.test.dependencies]

[tool.codespell]
skip = "*.ipynb"
ignore-words-list = "hist"

[tool.poetry.group.dev.dependencies]
pytest = "*"
Expand Down

0 comments on commit fe0897c

Please sign in to comment.