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

Fix ruff issues [Rebase & FF] #646

Merged
merged 3 commits into from
Oct 1, 2024
Merged

Conversation

makubacki
Copy link
Member

@makubacki makubacki commented Sep 30, 2024

pyproject.toml: Update ruff deprecated settings

Addresses these deprecated messages from ruff:

warning: The top-level linter settings are deprecated in favour of
their counterparts in the `lint` section. Please update the
following options in `pyproject.toml`:

  - 'ignore' -> 'lint.ignore'
  - 'select' -> 'lint.select'
  - 'flake8-annotations' -> 'lint.flake8-annotations'
  - 'pydocstyle' -> 'lint.pydocstyle'

Fix ruff issues

Runs ruff format . on the workspace.


test.unit: Prevent bare except ruff errors

Allows ruff to pass in the repo with no problem. Since these are unit
tests, no investment is made to change behavior of the exception
handler.


Note: @Javagedes is going to follow up with a PR to update additional documentation and checks for using ruff format moving forward.

@makubacki makubacki self-assigned this Sep 30, 2024
@makubacki
Copy link
Member Author

@Javagedes, it seems strange this wasn't done already. Was there a reason?

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 83.69863% with 238 lines in your changes missing coverage. Please review.

Project coverage is 81.31%. Comparing base (ce85203) to head (092ce53).
Report is 109 commits behind head on master.

Files with missing lines Patch % Lines
edk2toollib/acpi/dmar_parser.py 67.30% 34 Missing ⚠️
edk2toollib/uefi/fmp_capsule_header.py 29.41% 24 Missing ⚠️
.../uefi/authenticated_variables_structure_support.py 83.20% 21 Missing ⚠️
edk2toollib/uefi/edk2/variable_format.py 35.48% 20 Missing ⚠️
edk2toollib/acpi/ivrs_parser.py 94.09% 18 Missing ⚠️
edk2toollib/uefi/bmp_object.py 45.45% 18 Missing ⚠️
edk2toollib/windows/policy/firmware_policy.py 87.21% 17 Missing ⚠️
edk2toollib/utility_functions.py 64.70% 12 Missing ⚠️
edk2toollib/tpm/tpm2_defs.py 8.33% 11 Missing ⚠️
edk2toollib/uefi/edk2/fmp_payload_header.py 41.66% 7 Missing ⚠️
... and 19 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #646      +/-   ##
==========================================
- Coverage   81.43%   81.31%   -0.13%     
==========================================
  Files          56       45      -11     
  Lines        7514     7486      -28     
==========================================
- Hits         6119     6087      -32     
- Misses       1395     1399       +4     

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

@Javagedes
Copy link
Contributor

@Javagedes, it seems strange this wasn't done already. Was there a reason?

@makubacki you ran ruff on the workspace instead of just edk2toollib (Which is fine if you want to start doing that instead).

Also, I'm not sure why the single to double quotes rule was applied. That is Q000 and I don't have that rule set enabled.

@makubacki
Copy link
Member Author

@Javagedes, it seems strange this wasn't done already. Was there a reason?

@makubacki you ran ruff on the workspace instead of just edk2toollib (Which is fine if you want to start doing that instead).

Also, I'm not sure why the single to double quotes rule was applied. That is Q000 and I don't have that rule set enabled.

That makes sense. I'd prefer we just run it on the whole workspace. It better encompasses the goals of formatting imo to have all the code consistent. I'm also trying to figure the quote thing out.

@makubacki makubacki force-pushed the fix_ruff_issues branch 4 times, most recently from 86eada9 to ab2f27a Compare October 1, 2024 00:52
@makubacki
Copy link
Member Author

Pushed two times without realizing the last commit was silently undoing what I kept amending into the second commit to fix CI. It should actually work now.

Addresses these deprecated messages from ruff:

```
warning: The top-level linter settings are deprecated in favour of
their counterparts in the `lint` section. Please update the
following options in `pyproject.toml`:

  - 'ignore' -> 'lint.ignore'
  - 'select' -> 'lint.select'
  - 'flake8-annotations' -> 'lint.flake8-annotations'
  - 'pydocstyle' -> 'lint.pydocstyle'
```

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Runs `ruff format .` on the workspace.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Allows ruff to pass in the repo with no problem. Since these are unit
tests, no investment is made to change behavior of the exception
handler.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
@Javagedes Javagedes merged commit 44bb090 into tianocore:master Oct 1, 2024
12 checks passed
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