Skip to content

Refactor few code style rules to separate docs - #20856

Merged
mavasani merged 34 commits into
dotnet:masterfrom
mavasani:FurtherStyleRefactor
Oct 2, 2020
Merged

mavasani merged 34 commits into
dotnet:masterfrom
mavasani:FurtherStyleRefactor

Conversation

@mavasani

@mavasani mavasani commented Sep 30, 2020 •

Copy link
Copy Markdown
Contributor

Summary

Creating this initial PR as the proposed structure of IDE code style rule docs.

  • Rule ID + option name based index
  • We retain the rule ID-agnostic table based on just the option groups and option names in individual Language rules, Formatting rules and Naming rules pages. This could be a preferred browsing approach for users who just want to look at options, and don't care about rule severities, and hence rule IDs.
  • All the rule specific content moves to separate idexxxx.md pages. Whenever multiple rules are used by the same option or an option group, we will create a single doc page, but have necessary id based redirects so the IDE analyzers themselves can use deterministic help links which end in idexxxx.

[Edit by gewarren to add preview link.]

Creating this initial PR as the proposed structure of IDE code style rule docs.
- Rule ID + option name based index
- We retain the rule ID-agnostic table based on just the option groups and option names in individual Language rules, Formatting rules and Naming rules pages. This could be a preferred browsing approach for users who just want to look at options, and don't care about rule severities, and hence rule IDs.
- All the rule specific content moves to separate `idexxxx.md` pages. Whenever multiple rules are used by the same option or an option group, we will create a single doc page, but have necessary id based redirects so the IDE analyzers themselves can use deterministic help links which end in `idexxxx`.
@mavasani
mavasani requested a review from a team as a code owner September 30, 2020 23:16
@dotnet-bot dotnet-bot added this to the October 2020 milestone Sep 30, 2020
Comment thread .openpublishing.redirection.json Outdated
},
{
"source_path": "docs/fundamentals/code-analysis/style-rules/ide0003.md",
"redirect_url": "/dotnet/fundamentals/code-analysis/style-rules/ide0003_ide0009.md"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Redirects needed when multiple complimentary rule IDs are clubbed with same option/option group and hence need to be in the same doc page. These redirects will allow each analyzer to specify docs/fundamentals/code-analysis/style-rules/<%RuleId%>.md by directly mapping rule ID to URI.

@@ -0,0 +1,147 @@
---
title: "'this.' and 'Me.' qualifiers (IDE0003 and IDE0009)"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Example doc page for IDE code style option group that use multiple complimentary rules, which need to be documented in a single page.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

NOTE: Almost all content here is taken from existing language-rules.md file.

@@ -0,0 +1,89 @@
---
title: "Use language keywords instead of framework type names for type references (IDE0049)"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Example IDE rule with single rule ID used for an option group.


## Index

The following pages list all the code style rules by rule ID and corresponding option(s), if any.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Rule ID + option based index.

The style rules in this section are applicable to both C# and Visual Basic.

- ["This." and "Me." qualifiers](#this-and-me)
- ["This." and "Me." qualifiers](ide0003_ide0009.md)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This table will still be retained in case user wants to browse all style rules by Option group and/or option names, without the overhead of rule IDs, which are only ever needed if user wants to change rule severity.

- [Parameter preferences](#parameter-preferences)
- dotnet\_code\_quality\_unused\_parameters

### <a name="this-and-me"></a>"This." and "Me." qualifiers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The actual rule contents moved out to separate docs which can directly be linked from the analyzer by just mapping the rule ID to URI.

Comment thread docs/fundamentals/toc.yml Resolved
@mavasani

Copy link
Copy Markdown
Contributor Author

@gewarren I cannot figure out the reason for the build failure. toc looks fine to me..

@gewarren gewarren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'll wait to approve until I can see a preview.

Comment thread docs/fundamentals/toc.yml Resolved
Co-authored-by: Genevieve Warren <[email protected]>
@mavasani

mavasani commented Oct 1, 2020

Copy link
Copy Markdown
Contributor Author

I have few more rule ports in my branch, will address this feedback and push those out by EOD day. Thanks for the review.

@mavasani

mavasani commented Oct 1, 2020

Copy link
Copy Markdown
Contributor Author

@gewarren I think I addressed your feedback. Please let me know if I missed something. Thanks!

@mavasani mavasani changed the title Refactor couple of code style rules to separate docs Refactor few code style rules to separate docs Oct 1, 2020

@gewarren gewarren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Table looks much better!

@mavasani

mavasani commented Oct 2, 2020

Copy link
Copy Markdown
Contributor Author

Thanks @gewarren!

@mavasani
mavasani merged commit 423828d into dotnet:master Oct 2, 2020
@mavasani
mavasani deleted the FurtherStyleRefactor branch October 2, 2020 17:24
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