-
Notifications
You must be signed in to change notification settings - Fork 674
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
MF-1718 - Use static code analysis in CI #1729
Conversation
7d87065
to
add3d9f
Compare
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #1729 +/- ##
==========================================
- Coverage 70.60% 70.37% -0.24%
==========================================
Files 146 146
Lines 11421 11425 +4
==========================================
- Hits 8064 8040 -24
- Misses 2716 2733 +17
- Partials 641 652 +11
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
ee40c35
to
f156cb8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the linter version in CI script and extract it to the variable (like GOLANGCI_LINT_VERSION=v1.52.2
). Also, please check the linter config here and find the best combination of linters for us.
Removing These two can be useful :- |
fe294ae
to
21c55cc
Compare
6020ca8
to
9aded14
Compare
cmd/certs/main.go
Outdated
@@ -169,13 +169,14 @@ func loadCertificates(conf config, logger mflog.Logger) (tls.Certificate, *x509. | |||
} | |||
|
|||
block, _ := pem.Decode(b) | |||
if block == nil { | |||
switch block { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using if
in this case is fine, preferable even. What was linter's remark?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was not happy with the block == nil {}
, so I had to change the format to reverse the check to block != nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you, please, send me the exact golangci-lint
command to test this? The command we have in CI script (golangci-lint run --no-config --disable-all --enable gosimple --enable errcheck --enable govet --enable unused --enable goconst --timeout 3m
) does not show me any problems with original code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer highlighted after updating the linter, so I've reverted back to original.
Maybe they fixed the linter in the update.
But when I use the original
block, _ := pem.Decode(b)
if block == nil {
logger.Fatal("No PEM data found, failed to decode CA")
}
caCert, err = x509.ParseCertificate(block.Bytes) <--- IDE warns here about possible nil pointer dereference even after checking for nil above
if err != nil {
return tlsCert, caCert, errors.Wrap(errFailedCertDecode, err)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dborovcanin Should I leave this as it was(original code) or change to switch statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it as it is.
4169b81
to
2ecced5
Compare
2ecced5
to
1c6a2af
Compare
1c6a2af
to
10300e9
Compare
cmd/certs/main.go
Outdated
@@ -169,13 +169,14 @@ func loadCertificates(conf config, logger mflog.Logger) (tls.Certificate, *x509. | |||
} | |||
|
|||
block, _ := pem.Decode(b) | |||
if block == nil { | |||
switch block { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you, please, send me the exact golangci-lint
command to test this? The command we have in CI script (golangci-lint run --no-config --disable-all --enable gosimple --enable errcheck --enable govet --enable unused --enable goconst --timeout 3m
) does not show me any problems with original code.
e5e6e2d
to
3f7eddd
Compare
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
Signed-off-by: aryan <aryangodara03@gmail.com>
e8b1078
to
d121bd0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What does this do?
This PR makes the golangci-lint test pass.
Which issue(s) does this PR fix/relate to?
Resolves #1718
List any changes that modify/break current functionality
Behaviour of some functions has changed, and has to be discussed before finalising
Have you included tests for your changes?
No new tests
Did you document any new/modified functionality?
N/A
Notes
N/A