Skip to content

Conversation

@aniketmaurya
Copy link
Contributor

@aniketmaurya aniketmaurya commented Jan 26, 2021

What does this PR do?

Resolves #5649
I have integrated Vulture to CI for dead code checking.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified
  • Check that target branch and milestone match!

Did you have fun?

Make sure you had fun coding 🙃

run: |
mypy
python-vulture:
Copy link

Choose a reason for hiding this comment

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

I've been following the issue for which this PR has been raised and I wonder if it makes sense to have this as a separate workflow instead of adding it in the code formatting workflow.

Copy link
Collaborator

@Borda Borda left a comment

Choose a reason for hiding this comment

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

does it report any issue now?

@Borda Borda added feature Is an improvement or enhancement ci Continuous Integration labels Jan 26, 2021
@Borda Borda added this to the 1.2 milestone Jan 26, 2021
@Borda Borda changed the base branch from master to release/1.2-dev January 26, 2021 09:01
@Borda
Copy link
Collaborator

Borda commented Jan 26, 2021

@aniketmaurya thx for the quick PR, mind rebase it on feat 1.2

@codecov
Copy link

codecov bot commented Jan 26, 2021

Codecov Report

Merging #5654 (0966902) into master (e4ba06c) will decrease coverage by 5%.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #5654    +/-   ##
=======================================
- Coverage      93%     88%    -5%     
=======================================
  Files         199     199            
  Lines       13008   13008            
=======================================
- Hits        12044   11425   -619     
- Misses        964    1583   +619     

@aniketmaurya
Copy link
Contributor Author

does it report any issue now?

Hi @Borda, You mean in the GitHub actions? Yes, there are few dead code blocks detected by it.

@Borda
Copy link
Collaborator

Borda commented Jan 26, 2021

does it report any issue now?

Hi @Borda, You mean in the GitHub actions? Yes, there are few dead code blocks detected by it.

ok, soo it shall be fixed within the PR :]
but fist can you rebase it in release/1.2-dev?

@aniketmaurya
Copy link
Contributor Author

does it report any issue now?

Hi @Borda, You mean in the GitHub actions? Yes, there are few dead code blocks detected by it.

ok, soo it shall be fixed within the PR :]
but fist can you rebase it in release/1.2-dev?

@Borda I think I messed up something during hard reset to 1.2 :(

@Borda
Copy link
Collaborator

Borda commented Jan 26, 2021

@aniketmaurya fixed :] can you fix the code so the check pass :]

@mergify mergify bot removed the has conflicts label Jan 26, 2021
@aniketmaurya
Copy link
Contributor Author

aniketmaurya commented Jan 26, 2021

@aniketmaurya fixed :] can you fix the code so the check pass :]

Thank you @Borda
There are a total of 37 unused variables detected in different modules. Should I check and remove them or add them to whitelist? I am not familiar with all of the modules.

@rohitgr7
Copy link
Contributor

Hi @RJ722, mind review the vulture workflow CI here?

@aniketmaurya
Copy link
Contributor Author

@aniketmaurya mind resolving conflicts?

Done @edenlightning !

@carmocca carmocca modified the milestones: 1.2.x, 1.3 Mar 29, 2021
@carmocca
Copy link
Contributor

I'm not sure we should integrate this checker into Lightning, considering we have a lot of dynamism in the way we call hooks so this checker will often produce false positives.

The number of items you already had to whitelist makes me think this is not that useful for this project.

@Borda Borda modified the milestones: v1.3, v1.4 Apr 27, 2021
@Borda Borda requested a review from kaushikb11 as a code owner May 11, 2021 21:56
@mergify mergify bot added the has conflicts label Jun 1, 2021
@ethanwharris
Copy link
Member

I agree with @carmocca, seems there are a lot of false positives (and a long whitelist) so I'm not sure there is much benefit to adding this.

@Borda
Copy link
Collaborator

Borda commented Jun 1, 2021

I do not have any preference on used tool, but still thinking that we shall address dead code in our codebase...

@mergify mergify bot removed the has conflicts label Jun 2, 2021
@Borda Borda requested review from awaelchli and removed request for teddykoker June 2, 2021 09:43
@Borda Borda dismissed awaelchli’s stale review June 2, 2021 09:44

pls re-review

self._handles[module_name] = [pre_forward_handle, post_forward_handle]

def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
def __exit__(self, type: Any, value: Any, traceback: Any) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

type is a built-in keyword.
better to avoid name clash here

Copy link
Member

Choose a reason for hiding this comment

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

Vulture picks up exc_type because it doesn't match the parent signature. We have a few options:

  • leave like this, matches the parent
  • convert to _, __, ___ - standard for unused variables
  • add to whitelist (already a bit big)

@ethanwharris ethanwharris merged commit 0bad218 into Lightning-AI:master Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous Integration discussion In a discussion stage feature Is an improvement or enhancement refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add check for dead code

10 participants