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

[MRG] Apply Repo-Review suggestions #1982

Merged
merged 2 commits into from
Dec 30, 2023

Conversation

DimitriPapadopoulos
Copy link
Contributor

Describe the changes

Apply some Repo-Review suggestions.

I went for the low-hanging fruits, other changes are more invasive and deserve a PR of their own, such as enabling more ruff rules (#1771).

  • PC100: Has pre-commit-hooks
    Must have https://github.com/pre-commit/pre-commit-hooks repo in .pre-commit-config.yaml
  • PC110: Uses black or ruff-format
    Use https://github.com/psf/black-pre-commit-mirror instead of https://github.com/psf/black in .pre-commit-config.yaml
  • PC140: Uses mypy
    Must have https://github.com/pre-commit/mirrors-mypy repo in .pre-commit-config.yaml
  • PC140: Uses mypy
    Must have https://github.com/pre-commit/mirrors-mypy repo in .pre-commit-config.yaml
  • PC191: Ruff show fixes if fixes enabled
    If --fix is present, --show-fixes must be too.
  • MY104: MyPy enables ignore-without-code
    Must have "ignore-without-code" in enable_error_code = [...]. This will force all skips in your project to include the error code, which makes them more readable, and avoids skipping something unintended.
    [tool.mypy]
    enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
  • MY105: MyPy enables redundant-expr
    Must have "redundant-expr" in enable_error_code = [...]. This helps catch useless lines of code, like checking the same condition twice.
    [tool.mypy]
    enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
  • MY106: MyPy enables truthy-bool
    Must have "truthy-bool" in enable_error_code = []. This catches mistakes in using a value as truthy if it cannot be falsey.
    [tool.mypy]
    enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
  • RF003: src directory specified if used
    Must specify src directory if it exists.
    [tool.ruff]
    src = ["src"]
  • RF202: Use (new) lint config section
    • ignore should be set as lint.ignore instead
    • mccabe should be set as lint.mccabe instead
    • per-file-ignores should be set as lint.per-file-ignores instead
    • pylint should be set as lint.pylint instead
    • select should be set as lint.select instead

Tasks

  • Unit tests added that reproduce the issue or prove feature is working
  • Fix or feature added
  • Code typed and mypy shows no errors
  • Documentation updated (if relevant)
    • No warnings during build
    • Preview link (CircleCI -> Artifacts -> doc/_build/html/index.html)
  • Unit tests passing and overall coverage the same or better

Copy link

codecov bot commented Dec 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f3a1a44) 97.95% compared to head (fd6a0aa) 97.97%.
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1982      +/-   ##
==========================================
+ Coverage   97.95%   97.97%   +0.02%     
==========================================
  Files          63       63              
  Lines       10836    10968     +132     
==========================================
+ Hits        10614    10746     +132     
  Misses        222      222              

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

* PC100: Has pre-commit-hooks
  Must have https://github.com/pre-commit/pre-commit-hooks repo in
  .pre-commit-config.yaml
* PC110: Uses black or ruff-format
  Use https://github.com/psf/black-pre-commit-mirror instead of
  https://github.com/psf/black in .pre-commit-config.yaml
* PC140: Uses mypy
  Must have https://github.com/pre-commit/mirrors-mypy repo in
  .pre-commit-config.yaml
* PC191: Ruff show fixes if fixes enabled
  If --fix is present, --show-fixes must be too.
* MY102: MyPy show_error_codes deprecated
  Must not have show_error_codes. Use hide_error_codes instead
  (since MyPy v0.990).
* MY104: MyPy enables ignore-without-code
  Must have "ignore-without-code" in enable_error_code = [...].
  This will force all skips in your project to include the error
  code, which makes them more readable, and avoids skipping
  something unintended.
* MY105: MyPy enables redundant-expr
  Must have "redundant-expr" in enable_error_code = [...].
  This helps catch useless lines of code, like checking the
  same condition twice.
* MY106: MyPy enables truthy-bool
  Must have "truthy-bool" in enable_error_code = [].
  This catches mistakes in using a value as truthy if it
  cannot be falsey.
* RF003: src directory specified if used
  Must specify src directory if it exists.
* RF202: Use (new) lint config section
  - ignore should be set as lint.ignore instead
  - mccabe should be set as lint.mccabe instead
  - per-file-ignores should be set as lint.per-file-ignores instead
  - pylint should be set as lint.pylint instead
  - select should be set as lint.select instead
@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review December 26, 2023 12:46
@DimitriPapadopoulos DimitriPapadopoulos changed the title Apply Repo-Review suggestions [MRG] Apply Repo-Review suggestions Dec 26, 2023
Copy link
Member

@darcymason darcymason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - looks like this can help keep things more up-to-date. I'm approving bit will leave open in case @mrbean-bremen or @scaramallion have any comments.

.pre-commit-config.yaml Outdated Show resolved Hide resolved
@scaramallion scaramallion merged commit cf173eb into pydicom:main Dec 30, 2023
9 checks passed
@DimitriPapadopoulos DimitriPapadopoulos deleted the repo-review branch December 30, 2023 21:54
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.

None yet

3 participants