From c0d573dcf76a16bb2cc15c1cd08a09ea056a8ad2 Mon Sep 17 00:00:00 2001 From: Harrison Nicholls Date: Fri, 6 Sep 2024 17:36:18 +0200 Subject: [PATCH] CI --- .github/workflows/code-style.yaml | 33 +++++++++++++++++++++++++++++++ .vscode/settings.json | 6 +----- pyproject.toml | 6 +++--- 3 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/code-style.yaml diff --git a/.github/workflows/code-style.yaml b/.github/workflows/code-style.yaml new file mode 100644 index 0000000..62a58a1 --- /dev/null +++ b/.github/workflows/code-style.yaml @@ -0,0 +1,33 @@ +name: Code style + +on: + push: + branches: + - main + pull_request: + branches: + - main + types: + - opened + - reopened + - synchronize + - ready_for_review + workflow_dispatch: + +jobs: + codestyle: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v45 + + - name: Run Pre-Commit + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + uses: pre-commit/action@v3.0.1 + with: + extra_args: --files $ALL_CHANGED_FILES diff --git a/.vscode/settings.json b/.vscode/settings.json index 4a89ab4..b828420 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,14 +1,10 @@ { "editor.tabSize": 4, "editor.rulers": [ 92 ], - "python.analysis.extraPaths": ["JANUS/src/","MORS/src/"], "files.trimTrailingWhitespace": true, "files.insertFinalNewline": true, "git.ignoreLimitWarning": true, - "git.ignoredRepositories": [ - "petsc", "SPIDER" - ], "python.analysis.exclude": [ - "**/__pycache__", "petsc", ".git", "SPIDER" + "**/__pycache__", ".git", ] } diff --git a/pyproject.toml b/pyproject.toml index 7769c89..2ad2ad0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -90,9 +90,9 @@ ignore = [ "E501", # Line too long ] -# [tool.ruff.lint.isort] -# known-first-party=["calliope"] -# required-imports = ["from __future__ import annotations"] +[tool.ruff.lint.isort] +known-first-party=["calliope"] +required-imports = ["from __future__ import annotations"] [tool.ruff.format] quote-style = "single"