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

Edit Type/Function Documentation in the Config Package #56

Closed
wants to merge 6 commits into from

Conversation

euniceek
Copy link

@euniceek euniceek commented May 21, 2021

Description:
This PR is first of the three PRs that will be filed to review and improve the Config package. Changes were made to update the documentation of type and func declarations in the configuration package and all of its sub-packages, with a focus on ensuring that the documentation follows the best practices recommended by Go, and that there is no grammar mistakes.

Link to tracking Issue:
Addresses part of # 3051

Copy link

@Aneurysm9 Aneurysm9 left a comment

Choose a reason for hiding this comment

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

I think the EOL comments were probably fine as they were, but no real harm in rearranging them. I'm not sure internal comments need proper punctuation and sentence structure, either. I'm fine with them, but you may get some pushback upstream depending on how used to using this style the maintainers are.

// GetServerAuthenticator attempts to select the appropriate from the list of extensions, based on the requested extension name.
// If an authenticator is not found, an error is returned.
// GetServerAuthenticator attempts to select the appropriate ServerAuthenticator from the list of extensions, based on the requested extension name.
// If authenticator is not found, an error is returned.

Choose a reason for hiding this comment

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

Suggested change
// If authenticator is not found, an error is returned.
// If an authenticator is not found, an error is returned.

I think this is correct. Alternately:

Suggested change
// If authenticator is not found, an error is returned.
// If no authenticator is found, an error is returned.

func (m *MockClientAuthenticator) Shutdown(ctx context.Context) error {
return nil
}

// RoundTripper for the MockClientAuthenticator either returns error if the mock authenticator is forced to or
// returns the supplied resultRoundTripper.
// RoundTripper for the MockClientAuthenticator either returns an error if the mock authenticator is forced to

Choose a reason for hiding this comment

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

Suggested change
// RoundTripper for the MockClientAuthenticator either returns an error if the mock authenticator is forced to
// RoundTripper for the MockClientAuthenticator either returns an error if the mock authenticator is configured to

func (m *MockClientAuthenticator) RoundTripper(base http.RoundTripper) (http.RoundTripper, error) {
if m.MustError {
return nil, errMockError
}
return m.ResultRoundTripper, nil
}

// PerRPCCredentials for the MockClientAuthenticator either returns error if the mock authenticator is forced to or
// returns the supplied resultPerRPCCredentials.
// PerRPCCredentials for the MockClientAuthenticator either returns an error if the mock authenticator is forced to

Choose a reason for hiding this comment

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

Suggested change
// PerRPCCredentials for the MockClientAuthenticator either returns an error if the mock authenticator is forced to
// PerRPCCredentials for the MockClientAuthenticator either returns an error if the mock authenticator is configured to

@@ -15,6 +15,6 @@
package configgrpc

import (
// import the gzip package with auto-registers the gzip grpc compressor
// Import the gzip package with auto-registers the gzip gRPC compressor.

Choose a reason for hiding this comment

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

Suggested change
// Import the gzip package with auto-registers the gzip gRPC compressor.
// Import the gzip package which auto-registers the gzip gRPC compressor.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for catching this!! Addressed the other comments as well :D

Comment on lines 28 to 29
// Specific exporters can embed this struct, and extend it with more fields if needed.
// When embedded in the exporter config, it must be with `mapstructure:",squash"` tag.

Choose a reason for hiding this comment

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

Suggested change
// Specific exporters can embed this struct, and extend it with more fields if needed.
// When embedded in the exporter config, it must be with `mapstructure:",squash"` tag.
// Specific exporters can embed this struct and extend it with more fields if needed.
// When embedded in the exporter config it must be with `mapstructure:",squash"` tag.

I don't think the commas are necessary here.

Choose a reason for hiding this comment

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

I agree that the first sentence does not need the comma (parallel verbs), but I believe it wouldn't hurt readability to have the second comma (Dependent clause, Independent clause)!

Suggested change
// Specific exporters can embed this struct, and extend it with more fields if needed.
// When embedded in the exporter config, it must be with `mapstructure:",squash"` tag.
// Specific exporters can embed this struct and extend it with more fields if needed.
// When embedded in the exporter config, it must be with `mapstructure:",squash"` tag.

@@ -28,7 +28,7 @@ type Extensions map[ComponentID]Extension

// ExtensionSettings defines common settings for an extension configuration.
// Specific processors can embed this struct and extend it with more fields if needed.
// When embedded in the extension config it must be with `mapstructure:",squash"` tag.
// When embedded in the extension config, it must be with `mapstructure:",squash"` tag.

Choose a reason for hiding this comment

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

Suggested change
// When embedded in the extension config, it must be with `mapstructure:",squash"` tag.
// When embedded in the extension config it must be with `mapstructure:",squash"` tag.

Choose a reason for hiding this comment

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

Same comment as above; I think it would be grammatically correct to have a comma, which may improve readability slightly!

@euniceek euniceek force-pushed the config-package-typos branch from 97a4625 to dc13524 Compare May 24, 2021 22:41
@euniceek euniceek force-pushed the config-package-typos branch from 09723e8 to 03ad2cb Compare May 26, 2021 05:29
@euniceek euniceek closed this Aug 13, 2021
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.

4 participants