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: Add Most F Rules to Worker #496

Merged
merged 2 commits into from
Jun 13, 2024
Merged

dev: Add Most F Rules to Worker #496

merged 2 commits into from
Jun 13, 2024

Conversation

ajay-sentry
Copy link
Contributor

@ajay-sentry ajay-sentry commented Jun 7, 2024

Part of the lint enhancement epic: codecov/engineering-team#1716

This is the "First" Ruff PR for worker, creating the ruff.toml file allowing us to easily configure our ruff rules moving forward, similar to API and Shared. The goal for this PR was to keep the existing "I" and "F401" rules which were already running as well as add a majority of the remaining F rules, and fix as well.

The main rules that were fixed were related to duplicate test names and imports:

Closes codecov/engineering-team#1882

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.

@@ -293,7 +293,10 @@ def _row(title, c1, c2, plus="+", minus="-", neutral=" "):
spacer = ["=" * row_w]

title = "@@%s@@" % "{text:{fill}{align}{width}}".format(
text="Coverage Diff", fill=" ", align="^", width=row_w - 4, strip=True
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Strip is an unused Param here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was already fixed after rebasing 🤷

@@ -161,32 +161,6 @@ def test_flake_consecutive_differing_outcomes_no_main_branch_specified(dbsession
assert flaky_tests[test_id] == {FlakeSymptomType.CONSECUTIVE_DIFF_OUTCOMES}


def test_flake_consecutive_differing_outcomes_no_main_branch_specified(dbsession):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joseph-sentry This test looked to be a copy of the one above it, let me know if we actually wanted to keep

Copy link
Contributor

Choose a reason for hiding this comment

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

if it's an exact copy, it's probably a slip up and can be deleted, but if they differ a bit, then it's probably a name mixup and we should rename and keep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it was an exact copy :o

@@ -68,7 +68,7 @@ def test_all_report_rows(self, mock_handle_single_row, dbsession):
def mock_handle_single_row_return_side_effect(db_session, commit, report_row):
if report_row.code is None:
return {"success": True, "errors": []}
if report_row.code is "local":
Copy link
Contributor Author

Choose a reason for hiding this comment

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

converted "is" to == which is the proper way to do this comparison

It's in a script though so idk if it really changes anything

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was already fixed after rebasing 🤷

@codecov-notifications
Copy link

codecov-notifications bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #496      +/-   ##
==========================================
+ Coverage   97.26%   97.44%   +0.18%     
==========================================
  Files         412      412              
  Lines       34424    34400      -24     
==========================================
+ Hits        33481    33522      +41     
+ Misses        943      878      -65     
Flag Coverage Δ
integration 97.44% <100.00%> (+0.18%) ⬆️
latest-uploader-overall 97.44% <100.00%> (+0.18%) ⬆️
unit 97.44% <100.00%> (+0.18%) ⬆️

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

Components Coverage Δ
NonTestCode 94.42% <ø> (+0.01%) ⬆️
OutsideTasks 97.72% <100.00%> (+0.17%) ⬆️
Files Coverage Δ
...s/notification/notifiers/tests/unit/test_checks.py 100.00% <100.00%> (+1.73%) ⬆️
.../notification/notifiers/tests/unit/test_comment.py 100.00% <100.00%> (+0.77%) ⬆️
services/report/__init__.py 92.29% <ø> (-0.02%) ⬇️
services/tests/test_flake_detector.py 100.00% <ø> (+10.00%) ⬆️
services/timeseries.py 98.98% <ø> (-0.02%) ⬇️
tasks/tests/unit/test_new_user_activated.py 100.00% <ø> (+4.49%) ⬆️
tasks/tests/unit/test_notify_task.py 100.00% <100.00%> (+2.46%) ⬆️
tasks/tests/unit/test_sync_repo_languages.py 100.00% <100.00%> (+7.43%) ⬆️
tasks/upload.py 91.20% <ø> (ø)

... and 1 file with indirect coverage changes

@codecov-qa
Copy link

codecov-qa bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.44%. Comparing base (fb91608) to head (9fce94c).

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #496      +/-   ##
==========================================
+ Coverage   97.26%   97.44%   +0.18%     
==========================================
  Files         412      412              
  Lines       34424    34400      -24     
==========================================
+ Hits        33481    33522      +41     
+ Misses        943      878      -65     
Flag Coverage Δ
integration 97.44% <100.00%> (+0.18%) ⬆️
latest-uploader-overall 97.44% <100.00%> (+0.18%) ⬆️
unit 97.44% <100.00%> (+0.18%) ⬆️

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

Components Coverage Δ
NonTestCode 94.42% <ø> (+0.01%) ⬆️
OutsideTasks 97.72% <100.00%> (+0.17%) ⬆️
Files Coverage Δ
...s/notification/notifiers/tests/unit/test_checks.py 100.00% <100.00%> (+1.73%) ⬆️
.../notification/notifiers/tests/unit/test_comment.py 100.00% <100.00%> (+0.77%) ⬆️
services/report/__init__.py 92.29% <ø> (-0.02%) ⬇️
services/tests/test_flake_detector.py 100.00% <ø> (+10.00%) ⬆️
services/timeseries.py 98.98% <ø> (-0.02%) ⬇️
tasks/tests/unit/test_new_user_activated.py 100.00% <ø> (+4.49%) ⬆️
tasks/tests/unit/test_notify_task.py 100.00% <100.00%> (+2.46%) ⬆️
tasks/tests/unit/test_sync_repo_languages.py 100.00% <100.00%> (+7.43%) ⬆️
tasks/upload.py 91.20% <ø> (ø)

... and 1 file with indirect coverage changes

Copy link

codecov-public-qa bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.44%. Comparing base (fb91608) to head (9fce94c).

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #496      +/-   ##
==========================================
+ Coverage   97.26%   97.44%   +0.18%     
==========================================
  Files         412      412              
  Lines       34424    34400      -24     
==========================================
+ Hits        33481    33522      +41     
+ Misses        943      878      -65     
Flag Coverage Δ
integration 97.44% <100.00%> (+0.18%) ⬆️
latest-uploader-overall 97.44% <100.00%> (+0.18%) ⬆️
unit 97.44% <100.00%> (+0.18%) ⬆️

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

Components Coverage Δ
NonTestCode 94.42% <ø> (+0.01%) ⬆️
OutsideTasks 97.72% <100.00%> (+0.17%) ⬆️
Files Coverage Δ
...s/notification/notifiers/tests/unit/test_checks.py 100.00% <100.00%> (+1.73%) ⬆️
.../notification/notifiers/tests/unit/test_comment.py 100.00% <100.00%> (+0.77%) ⬆️
services/report/__init__.py 92.29% <ø> (-0.02%) ⬇️
services/tests/test_flake_detector.py 100.00% <ø> (+10.00%) ⬆️
services/timeseries.py 98.98% <ø> (-0.02%) ⬇️
tasks/tests/unit/test_new_user_activated.py 100.00% <ø> (+4.49%) ⬆️
tasks/tests/unit/test_notify_task.py 100.00% <100.00%> (+2.46%) ⬆️
tasks/tests/unit/test_sync_repo_languages.py 100.00% <100.00%> (+7.43%) ⬆️
tasks/upload.py 91.20% <ø> (ø)

... and 1 file with indirect coverage changes

Copy link

codecov bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.47%. Comparing base (fb91608) to head (9fce94c).

Changes have been made to critical files, which contain lines commonly executed in production. Learn more

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #496      +/-   ##
==========================================
+ Coverage   97.28%   97.47%   +0.18%     
==========================================
  Files         443      443              
  Lines       35153    35129      -24     
==========================================
+ Hits        34200    34241      +41     
+ Misses        953      888      -65     
Flag Coverage Δ
integration 97.44% <100.00%> (+0.18%) ⬆️
latest-uploader-overall 97.44% <100.00%> (+0.18%) ⬆️
unit 97.44% <100.00%> (+0.18%) ⬆️

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

Components Coverage Δ
NonTestCode 94.48% <ø> (+0.01%) ⬆️
OutsideTasks 97.72% <100.00%> (+0.17%) ⬆️
Files Coverage Δ
...s/notification/notifiers/tests/unit/test_checks.py 100.00% <100.00%> (+1.73%) ⬆️
.../notification/notifiers/tests/unit/test_comment.py 100.00% <100.00%> (+0.72%) ⬆️
services/report/__init__.py Critical 92.30% <ø> (-0.02%) ⬇️
services/tests/test_flake_detector.py 100.00% <ø> (+10.00%) ⬆️
services/timeseries.py 98.98% <ø> (-0.02%) ⬇️
tasks/tests/unit/test_new_user_activated.py 100.00% <ø> (+4.49%) ⬆️
tasks/tests/unit/test_notify_task.py 100.00% <100.00%> (+2.46%) ⬆️
tasks/tests/unit/test_sync_repo_languages.py 100.00% <100.00%> (+7.43%) ⬆️
tasks/upload.py Critical 91.25% <ø> (ø)

... and 1 file with indirect coverage changes

This change has been scanned for critical changes. Learn more

@ajay-sentry ajay-sentry added this pull request to the merge queue Jun 13, 2024
Merged via the queue into main with commit 4840ca4 Jun 13, 2024
29 of 30 checks passed
@ajay-sentry ajay-sentry deleted the Ajay/ruff-f-rules-worker branch June 13, 2024 21:43
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.

Add Most F Rules to Worker
2 participants