Sygil-Dev / whoosh-reloaded

Whoosh is a fast, featureful full-text indexing and searching library implemented in pure Python.
https://sygil-dev.github.io/whoosh-reloaded/
Other
120 stars 15 forks source link

DRAFT: Add ruff rules datetimez (DTZ) #60

Closed cclauss closed 9 months ago

cclauss commented 9 months ago

Description

Please include:

Closes: # (issue) Let's try to limit the use of naive datetimes.

% ruff --select=DTZ --statistics

40  DTZ001  The use of `datetime.datetime()` without `tzinfo` argument is not allowed
 4  DTZ005  The use of `datetime.datetime.now()` without `tz` argument is not allowed
 2  DTZ006  The use of `datetime.datetime.fromtimestamp()` without `tz` argument is not allowed
 1  DTZ002  The use of `datetime.datetime.today()` is not allowed, use `datetime.datetime.now(tz=)` instead
 1  DTZ003  The use of `datetime.datetime.utcnow()` is not allowed, use `datetime.datetime.now(tz=)` instead

Checklist:

codecov[bot] commented 9 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (4074baf) 80.97% compared to head (a73cb50) 80.97%.

Files Patch % Lines
src/whoosh/qparser/dateparse.py 66.66% 1 Missing :warning:
src/whoosh/util/times.py 75.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #60 +/- ## ======================================= Coverage 80.97% 80.97% ======================================= Files 133 133 Lines 29496 29496 Branches 5066 5066 ======================================= Hits 23884 23884 Misses 4737 4737 Partials 875 875 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 9 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarCloud

ZeroCool940711 commented 9 months ago

Looks really good, should I merge it or is it still a WIP?

cclauss commented 9 months ago

Merge. I will try to keep PRs in draft mode until they are ready for review.

cclauss commented 9 months ago

We can fix the SonarCloud issue when we add ruff rules B.

ZeroCool940711 commented 9 months ago

Merge. I will try to keep PRs in draft mode until they are ready for review.

Understood. I guess what confused me was the title since it says DRAFT in it, I didn't notice you already made it ready for review and was no longer a draft 😄

cclauss commented 9 months ago

My mistake. I should have updated the title. Thx.