Skip to content

Commit f0e778e

Browse files
authored
feat: move ruff hooks locally; add output for ci/cd autofixes; update (#709)
ruff version; and fix new issues
1 parent 871a4bf commit f0e778e

4 files changed

Lines changed: 39 additions & 41 deletions

File tree

.pre-commit-config.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
exclude: ^(scratchpad/)
22

33
repos:
4-
- repo: https://github.com/astral-sh/ruff-pre-commit
5-
rev: v0.14.14
4+
- repo: local
65
hooks:
6+
# Moving ruff hooks to the local version allows for different behavior locally and in ci/cd pipelines.
77
- id: ruff-format
88
name: "Ruff formatter"
9-
args: [--config=pyproject.toml]
9+
entry: bash -c 'if [ "$CICD" = "1" ]; then ruff format --check --diff --quiet --config=pyproject.toml "$@"; else ruff format --quiet --config=pyproject.toml "$@"; fi' --
10+
language: system
1011
types_or: [python, jupyter]
1112
- id: ruff
1213
name: "Ruff linter"
13-
args: [--exit-non-zero-on-fix, --fix, --config=pyproject.toml]
14+
entry: bash -c 'if [ "$CICD" = "1" ]; then ruff check --no-fix --show-fixes --quiet --config=pyproject.toml "$@"; else ruff check --exit-non-zero-on-fix --fix --quiet --config=pyproject.toml "$@"; fi' --
15+
language: system
1416
types_or: [python, jupyter]
1517

1618
- repo: local

mellea/plugins/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from enum import Enum
5+
from enum import StrEnum
66
from typing import Any
77

88
try:
@@ -14,7 +14,7 @@
1414
_HAS_PLUGIN_FRAMEWORK = False
1515

1616

17-
class PluginMode(str, Enum):
17+
class PluginMode(StrEnum):
1818
"""Execution modes for Mellea plugins.
1919
2020
Execution order: SEQUENTIAL → TRANSFORM → AUDIT → CONCURRENT → FIRE_AND_FORGET
@@ -27,7 +27,7 @@ class PluginMode(str, Enum):
2727
FIRE_AND_FORGET = "fire_and_forget"
2828

2929

30-
class HookType(str, Enum):
30+
class HookType(StrEnum):
3131
"""All Mellea hook types.
3232
3333
Hook types are organized by lifecycle stage: session, component,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ all = ["mellea[backends,docling,tools,telemetry,server,sandbox,granite_retriever
113113

114114
# Code quality
115115
lint = [
116-
"ruff>=0.11.6",
116+
"ruff>=0.15.5",
117117
"isort>=6.0.0",
118118
"pre-commit>=4.2.0",
119119
"pylint>=3.3.4",

0 commit comments

Comments
 (0)