Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .github/workflows/lint-prettier-cli.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/lint-ruff.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/lint-yaml.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Lint (via prek)
# All linting and formatting hooks are defined in .pre-commit-config.yaml
# and run together via prek:
# - ruff Python linting and formatting
# - prettier Markdown, JSON, YAML, and other non-Python files
# - yamllint YAML style and syntax
# ---
# Action failing?
# Install prek: download from https://github.com/j178/prek/releases
# Run locally: prek run --all-files
---
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: j178/prek-action@v1
40 changes: 40 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Pre-commit hooks configuration
# ---
# Managed by prek (https://prek.j178.dev) — a fast, Rust-based, drop-in
# replacement for pre-commit. Uses the same .pre-commit-config.yaml format.
#
# Install prek:
# Download from https://github.com/j178/prek/releases
# or: cargo install prek
#
# Install git hooks (run once after cloning):
# prek install
#
# Run all hooks manually without committing:
# prek run --all-files

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.3
hooks:
# Linter — auto-fixes violations where possible before the commit lands
- id: ruff
args: [--fix]
# Formatter — enforces consistent code style
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
# Formatter for Markdown, JSON, YAML, and other non-Python files
- id: prettier
additional_dependencies:
# The pre-commit mirror doesn't update prettier anymore,
# so need to specify real version like this
- prettier@3.8.1

- repo: https://github.com/adrienverge/yamllint
rev: v1.38.0
hooks:
- id: yamllint
args: ["-d", "{extends: default, rules: {line-length: {max: 120}}}"]
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
If you would like to contribute to this project...

## Developer Setup

### Pre-commit hooks

This project uses [prek](https://prek.j178.dev) to manage git pre-commit hooks (a fast, Rust-based drop-in for `pre-commit`).

Install prek from the [releases page](https://github.com/j178/prek/releases), then install the hooks into your local clone:

```bash
prek install
```

After that, ruff linting and formatting checks run automatically on every `git commit`. To run all hooks manually at any time:

```bash
prek run --all-files
```

**Thank you, any suggestions and / or contributions are very appreciated**

If you would like to suggest a change, please go to the issues tab and fill out and issue. If you would like to contribute with code, follow the steps below:
Expand Down
1 change: 1 addition & 0 deletions SPRINTLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -526,3 +526,4 @@ _Empty sprint_
- Configure Renovate ([#876](https://github.com/ScilifelabDataCentre/dds_cli/pull/876))
- replace click-pathlib dependency with `click.Path(path_type=pathlib.Path)`([#926](https://github.com/ScilifelabDataCentre/dds_cli/pull/926))
- Switch from pylint+black to ruff([#927](https://github.com/ScilifelabDataCentre/dds_cli/pull/927))
- Add pre-commit config to repository ([#932](https://github.com/ScilifelabDataCentre/dds_cli/pull/932))
Loading