From f81c3ad79c211e0a1c9c0c29bd1b3e528e9f53ba Mon Sep 17 00:00:00 2001 From: GPatiA2 Date: Fri, 25 Apr 2025 09:07:28 +0200 Subject: [PATCH 1/2] Added isort and ruff settings to vscode to have code style compliant formatters --- .../_develop_guide/_setting_code.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/_09_development/_develop_guide/_develop_guide/_setting_code.rst b/docs/_09_development/_develop_guide/_develop_guide/_setting_code.rst index e27d2868..765cfaeb 100644 --- a/docs/_09_development/_develop_guide/_develop_guide/_setting_code.rst +++ b/docs/_09_development/_develop_guide/_develop_guide/_setting_code.rst @@ -74,6 +74,21 @@ Open your ``settings.json`` file from VSCode and add the following content to it "--max-line-length=99", "--import-order-style=google", "--show-source=true", "--statistics=true"], + "ruff.lineLength": 99, + "ruff.organizeImports": false, + "ruff.configuration" : { + "format" : { + "quote-style" : "single", + "line-ending" : "auto", + }, + }, + // isort to enforce propper import order + "isort.args": ["--line-length", "99", "--force-alphabetical-sort-within-sections", "--profile", "black", "--force-sort-within-sections"], + "pylint.args": ["--disable=B902,C816,D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404,I202", + "--max-line-length=99", "--import-order-style=google", "--show-source=true", + "--statistics=true" + ] + Newer versions of ROS 2 include upgraded flake8 (in ament_flake8), so it is preferable to use flake8 from VSCode too instead of pylint. To do so, use, instead of the 'pylint.args' settings, the following settings: From 0c3e90fe372f9c79425decd07a5e87c1773ceeb0 Mon Sep 17 00:00:00 2001 From: GPatiA2 Date: Fri, 25 Apr 2025 09:15:50 +0200 Subject: [PATCH 2/2] Added ruff and isort to python extension list --- .../_develop_guide/_develop_guide/_setting_code.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/_09_development/_develop_guide/_develop_guide/_setting_code.rst b/docs/_09_development/_develop_guide/_develop_guide/_setting_code.rst index 765cfaeb..bdcb7ea6 100644 --- a/docs/_09_development/_develop_guide/_develop_guide/_setting_code.rst +++ b/docs/_09_development/_develop_guide/_develop_guide/_setting_code.rst @@ -17,6 +17,8 @@ Install the following required extensions from the 'Extensions' tab in VSCode: * ``mine.cpplint`` * ``ms-python.autopep8`` * ``ms-python.pylint`` +* ``charliermarsh.ruff`` +* ``ms-python.isort`` .. _development_guide_code_settings: