Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

Enable ALL Ruff rules set by default (#2775)

Lucas Gomide8663c7e1c260
diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml
index f9853cf7c..3e1571830 100644
--- a/.github/workflows/linter.yml
+++ b/.github/workflows/linter.yml
@@ -5,12 +5,29 @@ on: [pull_request]
jobs:
lint:
runs-on: ubuntu-latest
+ env:
+ TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
steps:
- uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
- - name: Install Requirements
+ - name: Fetch Target Branch
+ run: git fetch origin $TARGET_BRANCH --depth=1
+
+ - name: Install Ruff
+ run: pip install ruff
+
+ - name: Get Changed Python Files
+ id: changed-files
run: |
- pip install ruff
+ merge_base=$(git merge-base origin/"$TARGET_BRANCH" HEAD)
+ changed_files=$(git diff --name-only --diff-filter=ACMRTUB "$merge_base" | grep '\.py$' || true)
+ echo "files<<EOF" >> $GITHUB_OUTPUT
+ echo "$changed_files" >> $GITHUB_OUTPUT
+ echo "EOF" >> $GITHUB_OUTPUT
- - name: Run Ruff Linter
- run: ruff check
+ - name: Run Ruff on Changed Files
+ if: ${{ steps.changed-files.outputs.files != '' }}
+ run: |
+ echo "${{ steps.changed-files.outputs.files }}" | tr " " "\n" | xargs -I{} ruff check "{}"
diff --git a/.ruff.toml b/.ruff.toml
index acc241bd4..4f8811cef 100644
--- a/.ruff.toml
+++ b/.ruff.toml
@@ -2,8 +2,3 @@ exclude = [
"templates",
"__init__.py",
]
-
-[lint]
-select = [
- "I", # isort rules
-]