Skip to content

Commit

Permalink
Use the ruff vscode extension to format on save
Browse files Browse the repository at this point in the history
  • Loading branch information
jaagut committed Mar 22, 2024
1 parent 6d083c2 commit bce9fef
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
45 changes: 23 additions & 22 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
{
"recommendations": [
"cschlosser.doxdocgen", // Generates doxygen comments
"DavidAnson.vscode-markdownlint", // Lints markdown files
"DotJoshJohnson.xml", // XML support
"eamodio.gitlens", // Extended git highlighting
"lextudio.restructuredtext", // Rendering rst files in preview
"mohsen1.prettify-json", // JSON formatting
"ms-azuretools.vscode-docker", // Docker support
"MS-CEINTL.vscode-language-pack-de", // German language pack
"ms-iot.vscode-ros", // ROS support
"ms-python.python", // Python support
"ms-python.vscode-pylance", // Python support
"ms-vscode.cmake-tools", // CMake support
"ms-vscode.cpptools-extension-pack", // C++ support
"ms-vscode.cpptools-themes", // C++ support
"ms-vscode.cpptools", // C++ support
"njpwerner.autodocstring", // Generates docstrings
"streetsidesoftware.code-spell-checker-german", // Spell checker
"streetsidesoftware.code-spell-checker", // Spell checker
"tamasfe.even-better-toml", // TOML support
"trond-snekvik.simple-rst", // Syntax highlighting for rst files
"twxs.cmake", // CMake support
"zxh404.vscode-proto3", // Protobuf support
"charliermarsh.ruff", // Ruff linting and formatting support
"cschlosser.doxdocgen", // Generates doxygen comments
"DavidAnson.vscode-markdownlint", // Lints markdown files
"DotJoshJohnson.xml", // XML support
"eamodio.gitlens", // Extended git highlighting
"lextudio.restructuredtext", // Rendering rst files in preview
"Mastermori.dsd", // DSD support
"mohsen1.prettify-json", // JSON formatting
"ms-azuretools.vscode-docker", // Docker support
"MS-CEINTL.vscode-language-pack-de", // German language pack
"ms-iot.vscode-ros", // ROS support
"ms-python.python", // Python support
"ms-python.vscode-pylance", // Python support
"ms-vscode.cmake-tools", // CMake support
"ms-vscode.cpptools-extension-pack", // C++ support
"ms-vscode.cpptools-themes", // C++ support
"ms-vscode.cpptools", // C++ support
"njpwerner.autodocstring", // Generates docstrings
"streetsidesoftware.code-spell-checker-german", // Spell checker
"streetsidesoftware.code-spell-checker", // Spell checker
"tamasfe.even-better-toml", // TOML support
"trond-snekvik.simple-rst", // Syntax highlighting for rst files
"twxs.cmake", // CMake support
"zxh404.vscode-proto3", // Protobuf support
]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@
"valarray": "cpp",
"variant": "cpp"
},

// Tell the ROS extension where to find the setup.bash
// This also utilizes the COLCON_WS environment variable, which needs to be set
"ros.distro": "iron",
Expand All @@ -204,4 +203,6 @@
"/opt/ros/iron/lib/python3.10/site-packages"
],
"cmake.configureOnOpen": false,
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
}
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
[tool.black]
line-length = 120

[tool.ruff]
line-length = 120
# Never enforce `E501` (line length violations), as black takes care of this.

[tool.ruff.lint]
# Never enforce `E501` (line length violations)
ignore = ["E501", "UP007"]
# Additionally enable the following rules
# - pycodestyle warnings (`W`)
# - flake8-bugbear warnings (`B`)
# - isort import sorting (`I`)
# - isort import sorting (`I001`)
# - pep8-naming convenrtions (`N`)
# - pyupgrade prefer newer language constructs (`UP`)
select = ["F", "E", "B", "W", "I", "N", "UP"]
select = ["F", "E", "B", "W", "I001", "N", "UP"]
# Do not lint the following directories
exclude = ["lib"]

0 comments on commit bce9fef

Please sign in to comment.