-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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 lint issues of not having comments for exported funcs and vars along with any remaining issues and enable remaining disabled rules #7575
.*: fix lint issues of not having comments for exported funcs and vars along with any remaining issues and enable remaining disabled rules #7575
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7575 +/- ##
=======================================
Coverage 81.73% 81.73%
=======================================
Files 361 361
Lines 27817 27816 -1
=======================================
+ Hits 22735 22736 +1
- Misses 3871 3872 +1
+ Partials 1211 1208 -3
|
a0d509d
to
bf84b2f
Compare
// A slice of traceEvent pointers representing the events recorded for | ||
// this channel. | ||
Events []*traceEvent |
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.
Hmm, should this be unexported? Its type is unexported, which is an anti-pattern. It's probably unused outside this package would be my guess/hope.
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.
its being used in channelz/internal/protoconv
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.
That's not good. We should export traceEvent
, then. If that's too hard to do in this PR, it's fine to leave it for now.
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 traceEvent
is an internal representation of a single trace event. There is already an exported TraceEvent
which is used in clientconn
. We will have to give it a different name like TraceEventInternal
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.
That's not a very descriptive choice, but yes, some other name.
Is there any linter that covers unexported types being exposed outside a package, like this case? If so I would like to turn it on.
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 is no built-in rule but revive provides framework to write custom rules or we can ask revive contributors for this
mem/buffers.go
Outdated
@@ -119,20 +122,25 @@ func Copy(data []byte, pool BufferPool) Buffer { | |||
return NewBuffer(buf, pool) | |||
} | |||
|
|||
// ReadOnlyData returns the underlying byte slice of the Buffer. |
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.
Similar as above. This type is unexported; these methods should not need comments.
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.
ea50b5f
to
18b8820
Compare
18b8820
to
551ffd4
Compare
mem/buffers.go
Outdated
// emptyBuffer is a Buffer implementation that represents an empty buffer. All | ||
// methods are no-op implementations. |
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 remove.
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.
Done
mem/buffers.go
Outdated
type emptyBuffer struct{} | ||
|
||
func (e emptyBuffer) ReadOnlyData() []byte { | ||
return 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.
Please undo this diff.
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.
Done
7ee93ab
to
c4692da
Compare
767a0f0
to
8dad889
Compare
8dad889
to
9f5e76e
Compare
db453a2
to
a1861c3
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.
Overall LGTM, modulo a few comments and nits.
// Binary client is an example client demonstrating use of advancedtls, | ||
// to set up a secure gRPC client connection with various TLS authentication | ||
// methods. |
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.
nit:
// Binary client is an example client demonstrating use of advancedtls, | |
// to set up a secure gRPC client connection with various TLS authentication | |
// methods. | |
// Binary client is an example client demonstrating use of advancedtls, to set | |
// up a secure gRPC client connection with various TLS authentication methods. |
internal/channelz/channel.go
Outdated
func (c *Channel) SubChans() map[int64]string { | ||
db.mu.RLock() | ||
defer db.mu.RUnlock() | ||
return copyMap(c.subChans) | ||
} | ||
|
||
// NestedChans returns a copy of the map of nested channels associated with the Channel. |
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.
pls wrap at 80 col
// NestedChans returns a copy of the map of nested channels associated with the Channel. | |
// NestedChans returns a copy of the map of nested channels associated with the | |
// Channel. |
internal/channelz/channel.go
Outdated
@@ -61,24 +65,29 @@ func (c *Channel) id() int64 { | |||
return c.ID | |||
} | |||
|
|||
// SubChans returns a copy of the map of sub-channels associated with the Channel. |
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.
pls wrap at 80 col:
// SubChans returns a copy of the map of sub-channels associated with the Channel. | |
// SubChans returns a copy of the map of sub-channels associated with the | |
// Channel. |
internal/channelz/channel.go
Outdated
// String returns a string representation of the ChannelMetrics, including its state, | ||
// target, and call metrics. |
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.
// String returns a string representation of the ChannelMetrics, including its state, | |
// target, and call metrics. | |
// String returns a string representation of the ChannelMetrics, including its | |
// state, target, and call metrics. |
internal/channelz/channel.go
Outdated
// NewChannelMetricForTesting creates a new instance of ChannelMetrics with specified | ||
// initial values for testing purposes. |
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.
// NewChannelMetricForTesting creates a new instance of ChannelMetrics with specified | |
// initial values for testing purposes. | |
// NewChannelMetricForTesting creates a new instance of ChannelMetrics with | |
// specified initial values for testing purposes. |
// WaitForInt64Histo waits for an int histo metric to be recorded and | ||
// verifies that the recorded metrics data matches the expected | ||
// metricsDataWant. |
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.
// WaitForInt64Histo waits for an int histo metric to be recorded and | |
// verifies that the recorded metrics data matches the expected | |
// metricsDataWant. | |
// WaitForInt64Histo waits for an int histo metric to be recorded and verifies | |
// that the recorded metrics data matches the expected metricsDataWant. |
@@ -194,19 +197,19 @@ func (b *buffer) read(buf []byte) (int, Buffer) { | |||
return n, b | |||
} | |||
|
|||
// String returns a string representation of the buffer. May be used for | |||
// debugging purposes. | |||
func (b *buffer) String() string { |
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.
mmm, interesting that this one is removed.
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.
yeah I was removing the docstrings for non exported structs
} | ||
return status.Newf(codes.Internal, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress) |
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 seems unrelated?
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 fixes one lingering superflous-else
scripts/revive.toml
Outdated
[rule.indent-error-flow] | ||
Disabled = true # TODO: Enable after existing issues are fixed | ||
|
||
|
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.
nix new line pls
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.
Done
[rule.exported] | ||
Disabled = true # TODO: Enable after existing issues are fixed | ||
[rule.redefines-builtin-id] | ||
Disabled = true # TODO: Enable after existing issues are fixed | ||
[rule.package-comments] | ||
Disabled = true # TODO: Enable after existing issues are fixed | ||
[rule.indent-error-flow] | ||
Disabled = true # TODO: Enable after existing issues are fixed |
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.
Could we keep this PR focused on that change and address the other removals in a separate PR? This will make it easier to track the history of these changes in the future.
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 think its fine to just enable the remaining ones with this PR since at this time we are sure there are no more existing issues to be fixed
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.
Modifying the PR title and merge commit to specify the PR also enable remaining disabled rules
…ed funcs and vars
a1861c3
to
5aefed2
Compare
Addresses: #7444
RELEASE NOTES: None