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

dev: Enable most F rules for Ruff #574

Merged
merged 1 commit into from
May 22, 2024
Merged

Conversation

ajay-sentry
Copy link
Contributor

Purpose/Motivation

Part of the Ruff Enhancement epic, this adds all the "F" rules to our lint configuration for API, disabling a few super noisy ones that we can fix in individual PR's later. The benefit of doing it this way is we get ~40 rules "for free" that are on now checking our code :) At the cost of letting 4 of them be excluded til we have more bandwidth.

Rule list: https://docs.astral.sh/ruff/rules/#pyflakes-f

  • The F Rules are all the "PyFlakes" rules that Ruff has configured

Links to relevant tickets

codecov/engineering-team#1716

What does this PR do?

The rules we've mainly had to fix were around duplicate imports or duplicate keys in dicts. The rest we were already good on. Woohoo!

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@ajay-sentry ajay-sentry requested review from a team as code owners May 20, 2024 23:47
@@ -252,7 +253,7 @@
}

# See https://django-postgres-extra.readthedocs.io/en/master/settings.html
POSTGRES_EXTRA_DB_BACKEND_BASE: "django_prometheus.db.backends.postgresql"
POSTGRES_EXTRA_DB_BACKEND_BASE: "django_prometheus.db.backends.postgresql" # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even post import it didn't resolve this correctly; but docs here: https://django-dbbackup.readthedocs.io/en/stable/databases.html

select = ["F541", "I"]
ignore = []
select = ["F", "I"]
ignore = ["F841", "F401", "F405", "F403"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

My preferred way of tackling this initiative; then we can have separate tickets for F841, etc. or multiple PR's

Copy link
Contributor

Choose a reason for hiding this comment

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

These 4 doesn't have autofixes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They have some autofixes, but theres like 2k errors I'd have to fix across all of them. So I figured would probably be better to tackle them separately

@codecov-notifications
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.35%. Comparing base (7fe50b4) to head (7a67ccc).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #574      +/-   ##
==========================================
- Coverage   91.35%   91.35%   -0.01%     
==========================================
  Files         599      599              
  Lines       15972    15971       -1     
==========================================
- Hits        14592    14591       -1     
  Misses       1380     1380              
Flag Coverage Δ
unit 91.35% <100.00%> (-0.01%) ⬇️
unit-latest-uploader 91.35% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link

codecov-public-qa bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.35%. Comparing base (7fe50b4) to head (7a67ccc).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #574      +/-   ##
==========================================
- Coverage   91.35%   91.35%   -0.01%     
==========================================
  Files         599      599              
  Lines       15972    15971       -1     
==========================================
- Hits        14592    14591       -1     
  Misses       1380     1380              
Flag Coverage Δ
unit 91.35% <100.00%> (-0.01%) ⬇️
unit-latest-uploader 91.35% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
codecov/settings_base.py 84.94% <100.00%> (+0.08%) ⬆️
graphql_api/types/__init__.py 100.00% <100.00%> (ø)
graphql_api/types/commit/commit.py 100.00% <100.00%> (ø)
graphql_api/types/mutation/mutation.py 100.00% <ø> (ø)
services/yaml.py 100.00% <ø> (ø)

Impacted file tree graph

Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.84%. Comparing base (7fe50b4) to head (7a67ccc).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #574   +/-   ##
=====================================
  Coverage   95.84   95.84           
=====================================
  Files        777     777           
  Lines      17290   17289    -1     
=====================================
- Hits       16571   16570    -1     
  Misses       719     719           
Flag Coverage Δ
unit 91.35% <100.00%> (-0.01%) ⬇️
unit-latest-uploader 91.35% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@ajay-sentry ajay-sentry added this pull request to the merge queue May 22, 2024
Merged via the queue into main with commit e1af712 May 22, 2024
21 of 22 checks passed
@ajay-sentry ajay-sentry deleted the Ajay/enable-most-f-rules-ruff branch May 22, 2024 19:25
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