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

add lint test:-confusing-naming #5507

Closed
wants to merge 6 commits into from

Conversation

hellspawn679
Copy link
Contributor

@hellspawn679 hellspawn679 commented Jun 2, 2024

Which problem is this PR solving?

Description of the changes

  • fixes the make lint check that was failing

How was this change tested?

Checklist

Signed-off-by: Your Name <[email protected]>
@hellspawn679 hellspawn679 requested a review from a team as a code owner June 2, 2024 18:18
@hellspawn679 hellspawn679 requested a review from jkowall June 2, 2024 18:18
Copy link

codecov bot commented Jun 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.21%. Comparing base (3f82224) to head (e2ad0f7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5507      +/-   ##
==========================================
+ Coverage   96.20%   96.21%   +0.01%     
==========================================
  Files         327      327              
  Lines       16011    16011              
==========================================
+ Hits        15403    15405       +2     
+ Misses        434      433       -1     
+ Partials      174      173       -1     
Flag Coverage Δ
badger_v1 8.05% <15.38%> (ø)
badger_v2 1.93% <0.00%> (ø)
cassandra-3.x-v1 16.43% <38.46%> (ø)
cassandra-3.x-v2 1.85% <0.00%> (ø)
cassandra-4.x-v1 16.43% <38.46%> (ø)
cassandra-4.x-v2 1.85% <0.00%> (ø)
elasticsearch-7-v1 18.89% <61.53%> (ø)
elasticsearch-8-v1 19.08% <61.53%> (+0.01%) ⬆️
elasticsearch-8-v2 19.07% <61.53%> (-0.02%) ⬇️
grpc_v1 9.47% <15.38%> (-0.02%) ⬇️
grpc_v2 7.52% <15.38%> (-0.02%) ⬇️
kafka 9.78% <15.38%> (ø)
opensearch-1-v1 18.93% <61.53%> (ø)
opensearch-2-v1 18.94% <61.53%> (ø)
opensearch-2-v2 18.93% <61.53%> (-0.02%) ⬇️
unittests 93.91% <100.00%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yurishkuro
Copy link
Member

there are no lint rules that are currently failing on the main branch. Where do these come from?

@hellspawn679
Copy link
Contributor Author

there are no lint rules that are currently failing on the main branch. Where do these come from?

when I run make lint locally I was getting these error's

INFO [runner] linters took 727.619655ms with stages: goanalysis_metalinter: 702.156146ms 
cmd/anonymizer/app/anonymizer/anonymizer.go:129:12: G306: Expect WriteFile permissions to be 0600 or less (gosec)
        if err := os.WriteFile(filepath.Clean(a.mappingFile), dat, os.ModePerm); err != nil {
                  ^
cmd/internal/flags/admin_test.go:59:2: negative-positive: use assert.Positive (testifylint)
        assert.Greater(t, port, 0)

@yurishkuro
Copy link
Member

you may have different version of the tools, try make install-test-tools

@hellspawn679 hellspawn679 changed the title fix lint test add lint test:-confusing-naming Jun 3, 2024
Signed-off-by: Your Name <[email protected]>
@yurishkuro yurishkuro added the changelog:ci Change related to continuous integration / testing label Jun 3, 2024
@@ -44,7 +44,7 @@ var _ component.Host = (*otelHost)(nil) // API check
// StartOTLPReceiver starts OpenTelemetry OTLP receiver listening on gRPC and HTTP ports.
func StartOTLPReceiver(options *flags.CollectorOptions, logger *zap.Logger, spanProcessor processor.SpanProcessor, tm *tenancy.Manager) (receiver.Traces, error) {
otlpFactory := otlpreceiver.NewFactory()
return startOTLPReceiver(
return start_OTLP_Receiver(
Copy link
Member

Choose a reason for hiding this comment

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

This is not what the linter was complaining about. Your names violate Go coding practices.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so how should i fix this naming problem (Warns on methods with names that differ only by capitalization) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will it be okay if i name it like startOTLPReceiverInternal

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is fine to use startOTLPReceiver as of camelCase which is generally used in Go.

Copy link
Member

Choose a reason for hiding this comment

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

startOTLPReceiverInternal seems ok, but this needs to be decided on a case by case basis, there may be better options in other situations.

@yurishkuro
Copy link
Member

Most of the changes proposed are much worse than what we have.

@yurishkuro yurishkuro closed this Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:ci Change related to continuous integration / testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants