Format Python code with ruff format#790
Conversation
.github/workflows/main.yml
Outdated
| python3 -m pip install pycodestyle | ||
| export PATH=$PATH:$HOME/.local/bin | ||
| pycodestyle examples/* | ||
| pycodestyle --max-line-length=88 examples/* |
There was a problem hiding this comment.
There was a problem hiding this comment.
The reason for 88 (not 100) was explained in that URL.
There was a problem hiding this comment.
Interesting. I used to be strongly in favor of 80 but it does make it awkward when you want to have variable names that actually explain what they are instead of acronyms or abbreviations.
There was a problem hiding this comment.
For the simple examples, I'm just going to leave it at the default pycodestyle 79 for now.
.github/workflows/main.yml
Outdated
| python3 -m pip install pycodestyle | ||
| export PATH=$PATH:$HOME/.local/bin | ||
| pycodestyle examples/* | ||
| pycodestyle --max-line-length=88 examples/* |
| class OrbitYawBehavior(Enum): | ||
| """ | ||
| Yaw behaviour during orbit flight. | ||
| Yaw behaviour during orbit flight. |
There was a problem hiding this comment.
Please read the commit message.
ruff formatshould be added to code generation processes.
There was a problem hiding this comment.
Ok, feel free to do that. It's right here:
https://github.com/mavlink/MAVSDK-Python/blob/main/other/tools/run_protoc.sh
There was a problem hiding this comment.
d747918 to
dcde9cb
Compare
julianoes
left a comment
There was a problem hiding this comment.
Alright, let me get this in and add in the other PRs on top of it.
.github/workflows/main.yml
Outdated
| python3 -m pip install pycodestyle | ||
| export PATH=$PATH:$HOME/.local/bin | ||
| pycodestyle examples/* | ||
| pycodestyle --max-line-length=88 examples/* |
There was a problem hiding this comment.
Interesting. I used to be strongly in favor of 80 but it does make it awkward when you want to have variable names that actually explain what they are instead of acronyms or abbreviations.
other/tools/run_protoc.sh
Outdated
| @@ -96,4 +96,6 @@ function generate { | |||
|
|
|||
| echo "[+] Generating plugins from " | |||
| generate | |||
| python3 -m pip install --upgrade ruff | |||
| ruff format | |||
There was a problem hiding this comment.
We should add the dependency to https://github.com/mavlink/MAVSDK-Python/blob/main/requirements-dev.txt. I'll add a commit.
.github/workflows/main.yml
Outdated
| python3 -m pip install pycodestyle | ||
| export PATH=$PATH:$HOME/.local/bin | ||
| pycodestyle examples/* | ||
| pycodestyle --max-line-length=88 examples/* |
There was a problem hiding this comment.
For the simple examples, I'm just going to leave it at the default pycodestyle 79 for now.
| class OrbitYawBehavior(Enum): | ||
| """ | ||
| Yaw behaviour during orbit flight. | ||
| Yaw behaviour during orbit flight. |
%
ruff format# https://docs.astral.sh/ruff/formatterImprove readability while removing 2,961 unnecessary lines.
ruff formatshould be added to code generation processes.