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

Unnecessary Slice-to-Slice Conversion analyzer #7321

Merged
merged 10 commits into from
Sep 23, 2020

Conversation

rkapka
Copy link
Contributor

@rkapka rkapka commented Sep 23, 2020

What type of PR is this?

Tool

What does this PR do? Why is it needed?

This PR introduces a static code analyzer that reports a diagnostic when the [:] is applied to an expression which is already of a slice type. Occurrences of such code in Prysm have been found here: https://deepsource.io/gh/rkapka/prysm/issue/CRT-A0016/occurrences/.

Which issues(s) does this PR fix?

Part of #6747

Other notes for review

N/A

@rkapka rkapka requested a review from a team as a code owner September 23, 2020 14:29
@rkapka rkapka changed the title Use slice directly Unnecessary Slice-to-Slice analyzer Sep 23, 2020
@rkapka rkapka changed the title Unnecessary Slice-to-Slice analyzer Unnecessary Slice-to-Slice Conversion analyzer Sep 23, 2020
rauljordan
rauljordan previously approved these changes Sep 23, 2020
@@ -0,0 +1,61 @@
package slicedirect
Copy link
Member

Choose a reason for hiding this comment

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

Can you add an overall package level comment?

@codecov
Copy link

codecov bot commented Sep 23, 2020

Codecov Report

Merging #7321 into master will decrease coverage by 0.11%.
The diff coverage is 79.41%.

@@            Coverage Diff             @@
##           master    #7321      +/-   ##
==========================================
- Coverage   60.01%   59.89%   -0.12%     
==========================================
  Files         416      416              
  Lines       29950    29857      -93     
==========================================
- Hits        17975    17884      -91     
- Misses       9035     9044       +9     
+ Partials     2940     2929      -11     

@prylabs-bulldozer prylabs-bulldozer bot merged commit dca93ce into master Sep 23, 2020
@delete-merged-branch delete-merged-branch bot deleted the use-slice-directly branch September 23, 2020 16:14
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