-
Notifications
You must be signed in to change notification settings - Fork 739
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 issues flagged by golangci-lint #3621
Conversation
openrtb_ext/request_wrapper_test.go
Outdated
@@ -706,6 +706,7 @@ func TestCloneUserExt(t *testing.T) { | |||
eids[1].UIDs[0].AType = 0 | |||
eids[0].UIDs = append(eids[0].UIDs, openrtb2.UID{ID: "Z", AType: 2}) | |||
eids = append(eids, openrtb2.EID{Source: "Blank"}) | |||
// TODO: double-check why we fill eids but don't use it |
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.
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.
(TODO(dmitris) - still open, wait for @hhhjort's response)
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 I get an update on this TODO please?
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.
I admit I don't fully understand this test - but I added the nolint comment:
eids = append(eids, openrtb2.EID{Source: "Blank"}) //nolint: ineffassign, staticcheck // this value of
eids is never used (staticcheck)
and remove TODO. /cc @hhhjort if you want to double-check it works as intended.
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.
Oh, yes, the clone tests. We start with a userext object and a manual copy of that object. (copy/paste of the code lines) We then make a clone of that object using the clone code we wish to test. Next we "mutate" the original, edit it first starting from the outermost reaches, working in towards the root trying to catch a change that the clone code does not protect against. Above we first edit the objects in the UIDs array, in case the clone array has pointers to the items. Then we append, which should replace the array itself, to make sure this doesn't somehow leak over to the clone.
In the end we make all sorts of changes to the original object. We don't care about those shanges, we aren't testing our ability to make these changes. We are only testing that the clone remains independent of all those changes, that the clone is still equal to the manual copy. Thus we get warnings that we don't use the edits we made to the original userext.
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 I get an update on this TODO please?
@AlexBVolcy
It has been removed, the code now:
mutator: func(t *testing.T, userExt *UserExt) {
eids := *userExt.eids
eids[0].UIDs[1].ID = "G2"
eids[1].UIDs[0].AType = 0
eids[0].UIDs = append(eids[0].UIDs, openrtb2.UID{ID: "Z", AType: 2})
eids = append(eids, openrtb2.EID{Source: "Blank"}) //nolint: ineffassign, staticcheck // this value of `eids` is never used (staticcheck)
userExt.eids = nil
},
addressed most of the feedback, added a couple of @SyntaxNode do you want me to resolve the addressed comments or would you or the commenter resolve them when satisfied with the change? Thanks. |
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.
For future reference, please don’t force push your changes as it makes the PR harder to review. Thank You!
So you don't want PRs rebased on the latest trunk version? I usually ty to "rebase early and often" to ensure that the merged version wouldn't have any surprises, and to keep the PR commits on top of the commits list / |
@AlexBVolcy - regarding adapters/tappx/tappx.go, |
for reference: these are remaining issues flagged by |
openrtb_ext/request_wrapper_test.go
Outdated
@@ -706,6 +706,7 @@ func TestCloneUserExt(t *testing.T) { | |||
eids[1].UIDs[0].AType = 0 | |||
eids[0].UIDs = append(eids[0].UIDs, openrtb2.UID{ID: "Z", AType: 2}) | |||
eids = append(eids, openrtb2.EID{Source: "Blank"}) | |||
// TODO: double-check why we fill eids but don't use it |
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 I get an update on this TODO please?
server/server_test.go
Outdated
@@ -181,6 +178,7 @@ func TestRunServer(t *testing.T) { | |||
} | |||
|
|||
func TestListen(t *testing.T) { | |||
// TODO(dmitris): check if the unused const 'name' can be deleted [PR3621] |
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 I get an update on this TODO? I'd prefer to not merge in TODOs if possible.
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.
I removed the unused variable and removed the TODO
line in 5430f6c.
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.
Strange, I still see the TODO in the latest version of the code, could you double check this?
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.
double-checked, no TODO
s in server/server_test.go
(or any files underneath server/
) in the PR branch:
$ git log -1 && grep TODO server/server_test.go
commit ea94905c0a83e8c9db801f4b90a4e4a7524174da (HEAD -> golangci-lint, ds/golangci-lint)
Author: Dmitry S <dsavints@gmail.com>
Date: Mon Apr 29 17:36:37 2024 +0200
remove comment about error handling
$ rg TODO server/
$
server/server_test.go in my / PR branch.
The issues flagged by golangci-lint: https://gist.github.com/dmitris/b2b6836f2e90efa2131a74d8c5253ab7 Related to issue prebid#3519.
Hi @dmitris, we strongly prefer merging with master to rebasing once the review process has started because it makes it much easier for us to see what has changed based on comments. It can be a bit frustrating for reviewers to have to re-review everything every time something has changed. Even though commits merged in from master end up interspersed with your change commits, GitHub is smart enough to hide what has been merged in when viewing changes. We end up squashing everything anyway when we merge. |
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.
Left some more comments, I'm also going to leave one more regarding the output I get when running the golangci-lint command on this PR
server/server_test.go
Outdated
@@ -181,6 +178,7 @@ func TestRunServer(t *testing.T) { | |||
} | |||
|
|||
func TestListen(t *testing.T) { | |||
// TODO(dmitris): check if the unused const 'name' can be deleted [PR3621] |
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.
Strange, I still see the TODO in the latest version of the code, could you double check this?
@dmitris So when I run this command: I get this output:
For my understanding, is there a reason why some of these still appear and weren't addressed in this PR? Thank you :) |
@AlexBVolcy - the main reason is to limit the scope / size of the PR; my idea was to get this through and then used the experience / reviewer's comments for the "next batch" / follow-up. |
@AlexBVolcy I believe I removed all the |
@dmitris Thank you for your work on this PR. Yes you're right about the flaky test failure, we have fix coming in for that soon so don't worry. I'm giving this PR another review now, so I'll have some more feedback soon. Thank you! |
@dmitris This is looking good, I'm going to bring up in a team meeting whether the remaining issues that are being flagged by |
@dmitris Discussed with the team and confirmed that it's okay if we address the remaining |
@guscarreon - addressed your comments (except the last one, see my reply) in 6d4f03a - could you double-check and resolve the conversations, please? |
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. Thank you @dmitris for addressing our feedback
PR fixes number of issues flagged by
golangci-lint
, mostly by thegosimple
andstaticcheck
linters.The issues flagged by golangci-lint (
golangci-lint run -D errcheck -D unused -D ineffassign ./...
):https://gist.github.com/dmitris/b2b6836f2e90efa2131a74d8c5253ab7
Related to issue #3519.