Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruff: maintain configuration, format examples and labgrid.protocols #1523

Merged
merged 5 commits into from
Oct 21, 2024

Conversation

Bastian-Krause
Copy link
Member

Description
Thinking and arguing about formatting is usually tedious work. To move a step closer to enforced formatting, maintain ruff's configuration centrally, run ruff format on examples/ and labgrid/protocols/ (these shouldn't cause too much friction) and enforce formatting on more code ruff is already happy about.

Checklist

  • PR has been tested

@Bastian-Krause
Copy link
Member Author

Rebased on latest master.

…end excludes

ruff's "exclude" documentation [1] reads:

  "Note that you'll typically want to use extend-exclude to modify the
  excluded paths."

Do that.

The default for the "respect-gitignore" setting [2] is "true", so we can
safely drop entries that are already specified there.

[1] https://docs.astral.sh/ruff/settings/#exclude
[2] https://docs.astral.sh/ruff/settings/#respect-gitignore

Signed-off-by: Bastian Krause <[email protected]>
The default value of the "include" setting is
["*.py", "*.pyi", "*.ipynb", "**/pyproject.toml"] [1].

We're only interested in pyproject.toml and *.py files, so add
pyproject.toml and the pre-formatted labgrid.remote module (previously
specified in the CI configuration only).

[1] https://docs.astral.sh/ruff/settings/#include

Signed-off-by: Bastian Krause <[email protected]>
Signed-off-by: Bastian Krause <[email protected]>
Formatted files were found via:

  $ diff --changed-group-format='%>' --unchanged-group-format='' <(ruff format --config "include = ['*.py','helpers/*']" --check | grep "Would reformat" | cut -d" " -f3) <(git ls-files *.py

For now, single __init__.py files and files in tests/ were omitted.

We should enforce formatting of more modules over time.

Signed-off-by: Bastian Krause <[email protected]>
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.6%. Comparing base (ec87797) to head (d8eac5c).
Report is 53 commits behind head on master.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #1523   +/-   ##
======================================
  Coverage    56.6%   56.6%           
======================================
  Files         168     168           
  Lines       13033   13033           
======================================
  Hits         7385    7385           
  Misses       5648    5648           
Flag Coverage Δ
3.10 56.6% <100.0%> (ø)
3.11 56.6% <100.0%> (ø)
3.12 56.6% <100.0%> (ø)
3.13 56.6% <100.0%> (ø)
3.9 56.6% <100.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Emantor Emantor merged commit 89c13b8 into labgrid-project:master Oct 21, 2024
11 checks passed
@Bastian-Krause Bastian-Krause deleted the bst/ruff branch October 21, 2024 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants