Skip to content

Commit 6cb2a7e

Browse files
authored
Switches code linting to Ruff (#4329)
# Description Ruff can handle linting, formatting, and type-checking (where applicable), streamlining our development workflow and improving code quality. This PR replaces our current linting setup with Ruff. Subsequent MRs will look into using Ruff for formatting and import ordering. ## Type of change - Documentation update ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Mayank Mittal <[email protected]>
1 parent 857da26 commit 6cb2a7e

File tree

87 files changed

+732
-206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+732
-206
lines changed

.pre-commit-config.yaml

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,25 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
repos:
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
rev: v0.14.10
9+
hooks:
10+
# Run the linter
11+
- id: ruff
12+
args: ["--fix"]
13+
# Run the formatter
14+
# - id: ruff-format
715
- repo: https://github.com/python/black
816
rev: 24.3.0
917
hooks:
1018
- id: black
11-
- repo: https://github.com/pycqa/flake8
12-
rev: 7.1.0
19+
- repo: https://github.com/pycqa/isort
20+
rev: 5.13.2
1321
hooks:
14-
- id: flake8
15-
additional_dependencies:
16-
- flake8-simplify
17-
- flake8-return
18-
- Flake8-pyproject
22+
- id: isort
23+
name: isort (python)
1924
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: v5.0.0
25+
rev: v6.0.0
2126
hooks:
2227
- id: trailing-whitespace
2328
- id: check-symlinks
@@ -33,20 +38,8 @@ repos:
3338
- id: check-shebang-scripts-are-executable
3439
- id: detect-private-key
3540
- id: debug-statements
36-
- repo: https://github.com/pycqa/isort
37-
rev: 5.13.2
38-
hooks:
39-
- id: isort
40-
name: isort (python)
41-
- repo: https://github.com/asottile/pyupgrade
42-
rev: v3.15.1
43-
hooks:
44-
- id: pyupgrade
45-
args: ["--py310-plus"]
46-
# FIXME: This is a hack because Pytorch does not like: torch.Tensor | dict aliasing
47-
exclude: "source/isaaclab/isaaclab/envs/common.py|source/isaaclab/isaaclab/ui/widgets/image_plot.py|source/isaaclab_tasks/isaaclab_tasks/direct/humanoid_amp/motions/motion_loader.py"
4841
- repo: https://github.com/codespell-project/codespell
49-
rev: v2.2.6
42+
rev: v2.4.1
5043
hooks:
5144
- id: codespell
5245
additional_dependencies:
@@ -58,7 +51,7 @@ repos:
5851
# hooks:
5952
# - id: pyright
6053
- repo: https://github.com/Lucas-C/pre-commit-hooks
61-
rev: v1.5.1
54+
rev: v1.5.5
6255
hooks:
6356
- id: insert-license
6457
files: \.(py|ya?ml)$
@@ -70,7 +63,7 @@ repos:
7063
exclude: "source/isaaclab_mimic/|scripts/imitation_learning/isaaclab_mimic/"
7164
# Apache 2.0 license for mimic files
7265
- repo: https://github.com/Lucas-C/pre-commit-hooks
73-
rev: v1.5.1
66+
rev: v1.5.5
7467
hooks:
7568
- id: insert-license
7669
files: ^(source/isaaclab_mimic|scripts/imitation_learning/isaaclab_mimic)/.*\.py$

.vscode/tools/settings.template.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@
6363
"python.languageServer": "Pylance",
6464
// We use "black" as a formatter:
6565
"black-formatter.args": ["--line-length", "120", "--unstable"],
66-
// Use flake8 for linting
67-
"flake8.enabled": true,
68-
"flake8.args": ["--config", "${workspaceFolder}/pyproject.toml"],
66+
// Use ruff as a linter
67+
"ruff.configuration": "${workspaceFolder}/pyproject.toml",
6968
// Use docstring generator
7069
"autoDocstring.docstringFormat": "google",
7170
"autoDocstring.guessTypes": true,

docker/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
# Here we set the parts that would
7-
# be re-used between services to an
7+
# be reused between services to an
88
# extension field
99
# https://docs.docker.com/compose/compose-file/compose-file-v3/#extension-fields
1010
x-default-isaac-lab-volumes: &default-isaac-lab-volumes

0 commit comments

Comments
 (0)