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

fix 'NoneType' object is not subscriptable #160

Merged
merged 2 commits into from
Oct 25, 2023

Conversation

giovanni-guidini
Copy link
Contributor

Fix for https://l.codecov.dev/hqZ1Ci (Sentry issue)

The error itself is TypeError: 'NoneType' object is not subscriptable.
This was happening because if we don't have static analysis for a file
the lines relevant for that file might be None, and we we're not checking
this condition prior to starting to access the dict items.

The fix itself is very simple, but I wanted to add type hints and better
tests too, so they're in the change as well.

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.

Fix for https://l.codecov.dev/hqZ1Ci (Sentry issue)

The error itself is `TypeError: 'NoneType' object is not subscriptable`.
This was happening because if we don't have static analysis for a file
the lines relevant for that file might be `None`, and we we're not checking
this condition prior to starting to access the dict items.

The fix itself is very simple, but I wanted to add type hints and better
tests too, so they're in the change as well.
@codecov-staging
Copy link

codecov-staging bot commented Oct 25, 2023

Codecov Report

Merging #160 (7146497) into main (9bc093f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #160   +/-   ##
=======================================
  Coverage   98.39%   98.39%           
=======================================
  Files         348      348           
  Lines       27479    27500   +21     
=======================================
+ Hits        27037    27058   +21     
  Misses        442      442           
Flag Coverage Δ
integration 98.39% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 98.39% <100.00%> (+<0.01%) ⬆️
unit 98.39% <100.00%> (+<0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 96.89% <100.00%> (+<0.01%) ⬆️
OutsideTasks 98.18% <ø> (ø)
Files Coverage Δ
tasks/label_analysis.py 98.84% <100.00%> (+0.04%) ⬆️
tasks/tests/unit/test_label_analysis.py 100.00% <100.00%> (ø)

@codecov-qa
Copy link

codecov-qa bot commented Oct 25, 2023

Codecov Report

Merging #160 (7146497) into main (9bc093f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #160   +/-   ##
=======================================
  Coverage   98.39%   98.39%           
=======================================
  Files         348      348           
  Lines       27479    27500   +21     
=======================================
+ Hits        27037    27058   +21     
  Misses        442      442           
Flag Coverage Δ
integration 98.39% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 98.39% <100.00%> (+<0.01%) ⬆️
unit 98.39% <100.00%> (+<0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 96.89% <100.00%> (+<0.01%) ⬆️
OutsideTasks 98.18% <ø> (ø)
Files Coverage Δ
tasks/label_analysis.py 98.84% <100.00%> (+0.04%) ⬆️
tasks/tests/unit/test_label_analysis.py 100.00% <100.00%> (ø)

@codecov-public-qa
Copy link

codecov-public-qa bot commented Oct 25, 2023

Codecov Report

Merging #160 (7146497) into main (9bc093f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #160   +/-   ##
=======================================
  Coverage   98.39%   98.39%           
=======================================
  Files         348      348           
  Lines       27479    27500   +21     
=======================================
+ Hits        27037    27058   +21     
  Misses        442      442           
Flag Coverage Δ
integration 98.39% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 98.39% <100.00%> (+<0.01%) ⬆️
unit 98.39% <100.00%> (+<0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 96.89% <100.00%> (+<0.01%) ⬆️
OutsideTasks 98.18% <ø> (ø)
Files Coverage Δ
tasks/label_analysis.py 98.84% <100.00%> (+0.04%) ⬆️
tasks/tests/unit/test_label_analysis.py 100.00% <100.00%> (ø)

@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Merging #160 (7146497) into main (9bc093f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #160   +/-   ##
=======================================
  Coverage   98.35%   98.35%           
=======================================
  Files         374      374           
  Lines       27975    27996   +21     
=======================================
+ Hits        27514    27535   +21     
  Misses        461      461           
Flag Coverage Δ
integration 98.39% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 98.39% <100.00%> (+<0.01%) ⬆️
unit 98.39% <100.00%> (+<0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 96.79% <100.00%> (+<0.01%) ⬆️
OutsideTasks 98.18% <ø> (ø)
Files Coverage Δ
tasks/label_analysis.py 98.84% <100.00%> (+0.04%) ⬆️
tasks/tests/unit/test_label_analysis.py 100.00% <100.00%> (ø)
Related Entrypoints
run/app.tasks.label_analysis.process_request

@giovanni-guidini giovanni-guidini merged commit db1ffbf into main Oct 25, 2023
29 of 30 checks passed
@giovanni-guidini giovanni-guidini deleted the gio/fix-label-analysis-file-is-none branch October 25, 2023 16:31
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