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

DRAFT: Add ruff rules datetimez (DTZ) #60

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

cclauss
Copy link
Collaborator

@cclauss cclauss commented Feb 9, 2024

Description

Please include:

  • relevant motivation
  • a summary of the change
  • which issue is fixed.
  • any additional dependencies that are required for this change.

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:

  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation

@cclauss cclauss marked this pull request as draft February 9, 2024 10:03
Copy link

codecov bot commented Feb 9, 2024

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 ⚠️
src/whoosh/util/times.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           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           

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

@cclauss cclauss marked this pull request as ready for review February 9, 2024 10:53
Copy link

sonarqubecloud bot commented Feb 9, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarCloud

@ZeroCool940711
Copy link
Contributor

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

@cclauss
Copy link
Collaborator Author

cclauss commented Feb 9, 2024

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

@cclauss
Copy link
Collaborator Author

cclauss commented Feb 9, 2024

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

@ZeroCool940711
Copy link
Contributor

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 😄

@ZeroCool940711 ZeroCool940711 merged commit 059137a into Sygil-Dev:main Feb 9, 2024
13 of 14 checks passed
@cclauss cclauss deleted the ruff-rules-DTZ branch February 9, 2024 11:08
@cclauss
Copy link
Collaborator Author

cclauss commented Feb 9, 2024

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

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