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

chore: update docstrings to follow best practices #284

Merged
merged 6 commits into from
Oct 10, 2022

Conversation

poppoerika
Copy link
Contributor

This pr addresses the feedback received from Chris in this pr: #282
I moved some of the docstrings to interfaces and reference those docstrings using inheritdoc cref in the classes inherits those interfaces.

Copy link
Contributor

@malandis malandis left a comment

Choose a reason for hiding this comment

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

For the documentation in general, I recommend fully documenting the public elements of interface files. Then in the implementations, you only need to write

/// <inheritdoc />

above the methods/properties from the interface and it will resolve automatically, ie no need for a cref.

For example in IConfiguration.cs:

public interface IConfiguration
{
      /// document this one
      public ILoggerFactory LoggerFactor { get; }

Then in Configuration.cs:

public class Configuration : IConfiguration
{
     /// <inheritdoc />
     public ILoggerFactory LoggerFactory { get; }

As an example see the documention of ISimpleCacheClient.cs and SimpleCacheClient.cs

Comment on lines 15 to 16
/// <inheritdoc cref="Momento.Sdk.Config.IConfiguration.LoggerFactory" />
public ILoggerFactory LoggerFactory { get; }
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like it's trying to inherit from itself. This should (I think) reference Microsoft.Extensions.Logging.ILoggerFactory instead, but I'm wondering if these crefs are necessary at all? It looked like <inheritdoc /> was working fine without that attribute, and I think @malandis was suggesting that usage in his comment (please correct me if I'm wrong about that).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for pointing it out!
I moved the summaries to the interfaces and forgot to remove cref. I will remove them.

public Configuration(IRetryStrategy retryStrategy, ITransportStrategy transportStrategy, ILoggerFactory? loggerFactory = null)
: this(retryStrategy, new List<IMiddleware>(), transportStrategy, loggerFactory)
{

}

/// <summary>
/// <inheritdoc cref="Momento.Sdk.Config.IConfiguration" />
/// Create a new instance of Configuration obejct with provided arguments: <see cref="Momento.Sdk.Config.IConfiguration.RetryStrategy">, <see cref="Momento.Sdk.Config.IConfiguration.Middlewares">, <see cref="Momento.Sdk.Config.IConfiguration.TransportStrategy"/>, and <see cref="Momento.Sdk.Config.IConfiguration.LoggerFactory"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

These see tags need to be closed: <see cref="foo" />

pgautier404
pgautier404 previously approved these changes Oct 7, 2022
@pgautier404 pgautier404 self-requested a review October 7, 2022 22:07
malandis
malandis previously approved these changes Oct 7, 2022
Copy link
Contributor

@malandis malandis left a comment

Choose a reason for hiding this comment

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

Thank you for your diligence on this

@poppoerika poppoerika merged commit ce0dec3 into main Oct 10, 2022
@poppoerika poppoerika deleted the chore/update-docstrings-feedback branch October 10, 2022 16:20
@@ -0,0 +1,4167 @@
Targeting a max of 100000 requests per second (delay between requests: 10)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this file be committed? Looks like the output of a local run

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.

3 participants