-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SW-164] Add ruff and black formatting to spot_wrapper (#84)
## Change Overview This PR enforces `ruff` and `black` linting for all files in `spot_wrapper`. Pre-commit hooks have been added, and all existing code that did not meet these style requirements has been modified to do so. The configuration files added were taken from the [`spot_ros2` repository](https://github.com/bdaiinstitute/spot_ros2/). ## Testing Done I tested a few general Spot examples (move the arm, walk forward) that rely on `spot_wrapper` and the functionality was unchanged.
- Loading branch information
1 parent
f9516d8
commit 6b68c50
Showing
34 changed files
with
502 additions
and
1,032 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) 2023 Boston Dynamics AI Institute, Inc. All rights reserved. | ||
|
||
name: Util - Pre-Commit Runner | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
pre-commit: | ||
name: util_pre-commit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
- uses: pre-commit/action@v3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2023 Boston Dynamics AI Institute, Inc. All rights reserved. | ||
|
||
repos: | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
# Ruff version. | ||
rev: 'v0.0.263' | ||
hooks: | ||
- id: ruff | ||
args: ['--fix', '--config', 'pyproject.toml'] | ||
- repo: https://github.com/psf/black | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
language_version: python3.10 | ||
args: ['--config', 'pyproject.toml'] | ||
verbose: true | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: check-toml | ||
- id: end-of-file-fixer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
[tool.ruff] | ||
# Enable pycodestyle (`E`), Pyflakes (`F`), and import sorting (`I`) | ||
select = ["E", "F", "I"] | ||
ignore = [] | ||
fixable = ["ALL"] | ||
unfixable = [] | ||
exclude = [ | ||
".bzr", | ||
".direnv", | ||
".eggs", | ||
".git", | ||
".hg", | ||
".mypy_cache", | ||
".nox", | ||
".pants.d", | ||
".pytype", | ||
".ruff_cache", | ||
".svn", | ||
".tox", | ||
".venv", | ||
"__pypackages__", | ||
"_build", | ||
"buck-out", | ||
"build", | ||
"dist", | ||
"node_modules", | ||
"venv", | ||
"docker/ros", | ||
] | ||
line-length = 120 | ||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" | ||
target-version = "py38" | ||
|
||
[tool.ruff.per-file-ignores] | ||
"__init__.py" = ["F401"] | ||
|
||
[tool.ruff.mccabe] | ||
max-complexity = 10 | ||
|
||
[tool.black] | ||
line-length = 120 | ||
target-version = ['py38'] | ||
include = '\.pyi?$' | ||
force-exclude = ''' | ||
/( | ||
)/ | ||
''' | ||
preview = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.