This is an automated email from the ASF dual-hosted git repository.
guanmingchiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/mahout.git
The following commit(s) were added to refs/heads/main by this push:
new 7e356bb40 Integrate Ruff into pre-commit config (#628)
7e356bb40 is described below
commit 7e356bb408ac7fc06a1cba27cef08db9368b100d
Author: Guan-Ming (Wesley) Chiu <[email protected]>
AuthorDate: Sun Nov 16 00:27:01 2025 +0800
Integrate Ruff into pre-commit config (#628)
---
.github/workflows/lint.yml | 50 ----------------------------------------------
.pre-commit-config.yaml | 12 +++++++++++
2 files changed, 12 insertions(+), 50 deletions(-)
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
deleted file mode 100644
index a495fed7c..000000000
--- a/.github/workflows/lint.yml
+++ /dev/null
@@ -1,50 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-name: Lint
-
-on:
- push:
- branches:
- - main
- paths:
- - "**.py"
- pull_request:
- paths:
- - "**.py"
-
-jobs:
- lint:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v5
-
- - name: Set up Python
- uses: actions/setup-python@v6
- with:
- python-version: "3.10"
-
- - name: Install Poetry
- run: pip install poetry
-
- - name: Install dependencies
- run: poetry install --extras dev
-
- - name: Run Ruff Linter
- run: poetry run ruff check .
-
- - name: Run Ruff Formatter
- run: poetry run ruff format --check .
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 65f563860..1a77115f7 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -10,6 +10,18 @@ repos:
- id: trailing-whitespace
name: trim trailing whitespace
+ # Ruff linter and formatter
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ rev: v0.14.5
+ hooks:
+ - id: ruff
+ name: ruff linting
+ files: \.py$
+ args: [--fix]
+ - id: ruff-format
+ name: ruff formatting
+ files: \.py$
+
# Check Apache license headers
- repo: https://github.com/lucas-c/pre-commit-hooks
rev: v1.5.5