From 4b9e686be88b08b407a0e71b0c8b4e6f7cbdb015 Mon Sep 17 00:00:00 2001 From: Gordon Julian Koehn Date: Tue, 24 Sep 2024 17:47:08 +0200 Subject: [PATCH] Adding Snakefmt instead of Snakemake lint (#15) --- .github/workflows/test-snake.yml | 22 ++++++++++++++++------ .pre-commit-config.yaml | 11 ++++------- pyproject.toml | 5 +++++ 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-snake.yml b/.github/workflows/test-snake.yml index afd21f7..0fcf861 100644 --- a/.github/workflows/test-snake.yml +++ b/.github/workflows/test-snake.yml @@ -16,7 +16,22 @@ jobs: poetry-version: ["1.8.3"] steps: - - uses: actions/checkout@v3 + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Lint Code Base + uses: github/super-linter/slim@v5 + env: + VALIDATE_ALL_CODEBASE: false + DEFAULT_BRANCH: branch_name + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DISABLE_ERRORS: true + PYTHON_FLAKE8_CONFIG_FILE: .flake8 + VALIDATE_PYTHON_FLAKE8: true + VALIDATE_SNAKEMAKE_SNAKEFMT: true + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -36,11 +51,6 @@ jobs: run: | pip install -e . - - name: Snakemake Linting - run: | - cd workflow - snakemake --lint -s Snakefile - - name: Snakemake Testing run: | snakemake --cores 1 --snakefile workflow/Snakefile --directory .test --verbose diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 75c6428..15b8e34 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,15 +28,12 @@ repos: language: node pass_filenames: true types: [python] + - repo: https://github.com/snakemake/snakefmt + rev: v0.10.2 + hooks: + - id: snakefmt - repo: local hooks: - - id: snakemake-lint - name: Snakemake Lint - entry: bash -c 'cd workflow && snakemake --lint' - language: system - files: (Snakefile|\.smk$) - pass_filenames: false - - id: snakemake-dryrun name: Snakemake Dry Run entry: bash -c 'cd workflow && snakemake -n' diff --git a/pyproject.toml b/pyproject.toml index 6f922ce..fefee27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,7 @@ mkdocstrings = {extras = ["python"], version = "^0.21.2"} mkdocs-gen-files = "^0.4.0" mkdocs-literate-nav = "^0.6.0" setuptools = "^74.1.2" +snakefmt = "^0.10.2" [tool.coverage.report] fail_under = 85.0 @@ -57,6 +58,10 @@ exclude = ["**/node_modules", "src/typestubs" ] +[tool.snakefmt] +line_length = 88 +include = '\.smk$|^Snakefile' + [build-system] requires = ["poetry-core"]