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

style(ruff): clear ruff check violations #175

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

IndexSeek
Copy link
Member

I was looking through the repo and wanted to clear up the remaining outstanding ruff check violations.

Many of these are minor, and I was able to clear them by adjusting the following:

[tool.ruff.lint.per-file-ignores]
"examples/*.ipynb" = ["ERA001", "I001", "T201"]

Here are the totals before the run:

$ ruff check --statistics
17      ERA001  [*] commented-out-code
 8      T201    [*] print
 8      PT001   [*] pytest-fixture-incorrect-parentheses-style
 4      I001    [*] unsorted-imports
 3      RUF100  [*] unused-noqa
 2      E501    [ ] line-too-long
 1      B008    [ ] function-call-in-default-argument
 1      RET504  [*] unnecessary-assign
 1      PTH207  [ ] glob
 1      E721    [ ] type-comparison
 1      UP031   [*] printf-string-formatting
[*] fixable with `ruff check --fix`

I'm still getting one violation after this, not sure how to get rid of this one. I might do a bit more digging later on, if this is something we will want to do. Adding # noqa: E501 wasn't resolving it.

examples/Using IbisML and DuckDB for a Kaggle competition.ipynb:cell 22:7:89: E501 Line too long (99 > 88)
  |
5 |     Args:
6 |         file_path (str): Path to the file or regex pattern to match files.
7 |         depth (int, optional): Depth of processing. If 1 or 2, additional aggregation is performed.
  |                                                                                         ^^^^^^^^^^^ E501
8 |         is_regex (bool, optional): Whether the file_path is a regex pattern.
  |

Found 1 error.

@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.35%. Comparing base (c32d604) to head (ee4ac23).

Files with missing lines Patch % Lines
ibis_ml/utils/_pprint.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #175   +/-   ##
=======================================
  Coverage   90.35%   90.35%           
=======================================
  Files          29       29           
  Lines        2083     2083           
=======================================
  Hits         1882     1882           
  Misses        201      201           

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

@deepyaman
Copy link
Collaborator

Thanks! I'll try and review tomorrow or day after.

@IndexSeek
Copy link
Member Author

Thanks! I'll try and review tomorrow or day after.

Thank you! There may be some of have been some conflicting with each other from what I found. For example, I was getting violations saying that the # noqa: SLF001 was going unused, then after removing, was getting violations running pre-commit that there were SLF001 violations.

I think these cases are squared away now.

$ ruff check
All checks passed!
$ pre-commit run --all-files
prettier.................................................................Passed
ruff.....................................................................Passed
ruff-format..............................................................Passed
Sort __all__ records.....................................................Passed

Copy link
Collaborator

@deepyaman deepyaman 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 caught a number of minor issues and made several net improvements (like the .glob() change); much appreciated!

I think the examples/*.ipynb skips are fine, but I wonder whether the extra tests/*.py ones are necessary?

pyproject.toml Outdated
@@ -86,6 +86,8 @@ ignore = [
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "F403"]
"docs/**/*.py" = ["INP001"]
"examples/*.ipynb" = ["E501", "ERA001", "I001", "T201"]
"tests/*.py" = ["PT001", "RUF100", "SLF001"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

If SLF001 is coming from the tests, maybe just do from ibis import _ up top instead?

For PT001 skip, I think that should be unnecessary with your fixes.

RUF100 also doesn't seem like it should be necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Excellent catch!

Yes, after removing "tests/*.py" = ["PT001", "RUF100", "SLF001"], I am finding that all of the ruff checks are passing without the "tests/*.py" ignores.

@deepyaman
Copy link
Collaborator

Actually, can you bump the Ruff version in .pre-commit-config.yaml? Because Ruff is running in CI, but it's not catching some of these things I assume because of the old version?

@deepyaman
Copy link
Collaborator

I'm still getting one violation after this, not sure how to get rid of this one. I might do a bit more digging later on, if this is something we will want to do. Adding # noqa: E501 wasn't resolving it.

examples/Using IbisML and DuckDB for a Kaggle competition.ipynb:cell 22:7:89: E501 Line too long (99 > 88)
  |
5 |     Args:
6 |         file_path (str): Path to the file or regex pattern to match files.
7 |         depth (int, optional): Depth of processing. If 1 or 2, additional aggregation is performed.
  |                                                                                         ^^^^^^^^^^^ E501
8 |         is_regex (bool, optional): Whether the file_path is a regex pattern.
  |

Found 1 error.

We can just wrap this after "is". :)

@IndexSeek
Copy link
Member Author

I'm still getting one violation after this, not sure how to get rid of this one. I might do a bit more digging later on, if this is something we will want to do. Adding # noqa: E501 wasn't resolving it.

examples/Using IbisML and DuckDB for a Kaggle competition.ipynb:cell 22:7:89: E501 Line too long (99 > 88)
  |
5 |     Args:
6 |         file_path (str): Path to the file or regex pattern to match files.
7 |         depth (int, optional): Depth of processing. If 1 or 2, additional aggregation is performed.
  |                                                                                         ^^^^^^^^^^^ E501
8 |         is_regex (bool, optional): Whether the file_path is a regex pattern.
  |

Found 1 error.

We can just wrap this after "is". :)

🤦 - I should have thought of this! Thank you!

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.

3 participants