KEMBAR78
Fix broken doc style of `Style/BracesAroundHashParameters` cop by koic · Pull Request #4880 · rubocop/rubocop · GitHub
Skip to content

Conversation

@koic
Copy link
Member

@koic koic commented Oct 19, 2017

This PR fixes the broken document style that good and bad are displayed in the sidebar.
https://rubocop.readthedocs.io/en/latest/cops_style/#bad

broken_document_style_of_style_braces_around_hash_parameters


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Used the same coding conventions as the rest of the project.
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • All tests(rake spec) are passing.
  • The new code doesn't generate RuboCop offenses that are checked by rake internal_investigation.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Updated cop documentation with rake generate_cops_documentation (required only when you've added a new cop or changed the configuration/documentation of an existing cop).

@pocke
Copy link
Collaborator

pocke commented Oct 19, 2017

Could you check yard doc also?
See #4870

We can the yard doc for this cop with yard server and visit http://localhost:8808/docs/RuboCop/Cop/Style/BracesAroundHashParameters .

@koic koic force-pushed the fix_broken_document_style_of_style_braces_around_hash_parameters branch from 6ca1306 to 1b6cefb Compare October 19, 2017 06:52
@koic
Copy link
Member Author

koic commented Oct 19, 2017

I was not checking with yard server. And, I overlooked that PR #4870 💦
However, this PR can regain the lost Example header.

Before

broken_document_style_of_style_braces_around_hash_parameters_before

After

broken_document_style_of_style_braces_around_hash_parameters_after

This will result in a unified format.

@koic
Copy link
Member Author

koic commented Oct 19, 2017

On the other hand, if it seems preferable not to use @example, as in #4870 discussion, I will close this PR.

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 19, 2017

It seem it was a mistake on our part to be using examples for listing code and bad cases, or at least this is the impression I had from this PR. Not sure what exactly would be the best course of action in general. I'd certainly prefer us to be consistent about this.

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 19, 2017

The documentation for @example is vague, so I'm not quite sure http://www.rubydoc.info/gems/yard/file/docs/Tags.md#example

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 19, 2017

And here we have the option of the @lsegal himself (yard's author) https://gitter.im/lsegal/yard?at=59e530ea32e080696eeb2e38

@koic
Copy link
Member Author

koic commented Oct 20, 2017

Thank you for the pointer to the information.
As an attempt, I wrote about explanations of 3 styles in both overview description section and examples section.

refine_document_style_of_style_braces_around_hash_parameters

Example codes are described only in Example section.

Explanations of 3 styles are redundant😓 , but it seems that description section and examples section role are separated. WDYT?

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 20, 2017

This seems like a reasonable option as well 957d86d

@lsegal
Copy link

lsegal commented Oct 20, 2017

FYI, examples can have title lines in which you can summarize the purpose, instead of in comments.

@koic koic force-pushed the fix_broken_document_style_of_style_braces_around_hash_parameters branch from f524ff8 to 5c1720c Compare October 21, 2017 22:33
@koic
Copy link
Member Author

koic commented Oct 21, 2017

I appreciate your advice.

First, I made the text of the explanation section simple. Next, I wrote the supported styles on the title line of @example.

broken_document_style_of_style_braces_around_hash_parameters

I could not replace all the explanation with the code comment because I did not understand the text wrapping of title line (The length exceeds 80) 💦 But these are summaries so it may be good as well.

@bbatsov bbatsov merged commit 882bead into rubocop:master Oct 22, 2017
@bbatsov
Copy link
Collaborator

bbatsov commented Oct 22, 2017

Looks great! I guess we should adopt this style consistently for cops with multiple supported styles.

@koic koic deleted the fix_broken_document_style_of_style_braces_around_hash_parameters branch October 23, 2017 01:56
koic added a commit to koic/rubocop that referenced this pull request Nov 1, 2017
Follow up of rubocop#4880 (comment).

This commit is a change of document format.

Because there are many cops to be changed, this commit applied
a new style to some Layout department cops first.
bbatsov pushed a commit that referenced this pull request Nov 2, 2017
Follow up of #4880 (comment).

This commit is a change of document format.

Because there are many cops to be changed, this commit applied
a new style to some Layout department cops first.
koic added a commit to koic/rubocop that referenced this pull request Nov 5, 2017
Follow up of rubocop#4880 (comment).

This commit is a change of document format. Cops of `naming` department
are the target.

Since example of `Naming/HeredocDelimiterCase` cop was the opposite of
`bad` and `good`, it was rearranged for unification.
Also added `default` information based on `config/default.yml`.
bbatsov pushed a commit that referenced this pull request Nov 5, 2017
Follow up of #4880 (comment).

This commit is a change of document format. Cops of `naming` department
are the target.

Since example of `Naming/HeredocDelimiterCase` cop was the opposite of
`bad` and `good`, it was rearranged for unification.
Also added `default` information based on `config/default.yml`.
koic added a commit to koic/rubocop that referenced this pull request Nov 6, 2017
Follow up of rubocop#4880 (comment).

This commit applied a new style to some `Style` department cops, the same
policy as rubocop#4978.
bbatsov pushed a commit that referenced this pull request Nov 7, 2017
Follow up of #4880 (comment).

This commit applied a new style to some `Style` department cops, the same
policy as #4978.
koic added a commit to koic/rubocop that referenced this pull request Nov 8, 2017
Follow up of rubocop#4880 (comment).

This commit is a change of document format. Cops of `Lint` department
are the target.
bbatsov pushed a commit that referenced this pull request Jun 9, 2018
Follow up of #4880 (comment)
and #5699.

This commit is a change of document format for `Layout/FirstParameterIndentation` cop.

This PR uses `# rubocop:disable Metrics/LineLength` because line length of
the following line exceeds 80.

```diff
+      # @example EnforcedStyle: special_for_inner_method_call_in_parentheses (default)
```

Descriptions of `EnforcedStyle` are quoted from default.yml.
https://github.com/rubocop-hq/rubocop/blob/v0.57.1/config/default.yml#L365-L381
koic added a commit that referenced this pull request Sep 24, 2018
Follow up of #4880 (comment).

This commit is a change of document format for `Rails/Delegate` cop.
koic added a commit to rubocop/rubocop-rails that referenced this pull request Oct 26, 2018
Follow up of rubocop/rubocop#4880 (comment).

This commit is a change of document format for `Rails/ActionFilter` cop.
koic added a commit to rubocop/rubocop-rails that referenced this pull request Oct 26, 2018
Follow up of rubocop/rubocop#4880 (comment).

This commit is a change of document format for `Rails/Date` cop.
koic added a commit to rubocop/rubocop-rails that referenced this pull request Oct 26, 2018
Follow up of rubocop/rubocop#4880 (comment).

This commit is a change of document format for `Rails/RequestReferer` cop.
koic added a commit to rubocop/rubocop-rails that referenced this pull request Oct 26, 2018
Follow up of rubocop/rubocop#4880 (comment).

This is only document change.

This commit adds an example of `EnforcedStyle` to `Rails/TimeZone`.
koic added a commit to rubocop/rubocop-rails that referenced this pull request Oct 26, 2018
Follow up of rubocop/rubocop#4880 (comment).

This commit is a change of document format for `Rails/UniqBeforePluck` cop.
koic added a commit to rubocop/rubocop-rails that referenced this pull request Oct 26, 2018
Follow up of rubocop/rubocop#4880 (comment).

This commit is a change of document format for `Rails/Delegate` cop.
koic added a commit to koic/rubocop that referenced this pull request Oct 2, 2019
Follow up of rubocop#4880 (comment).

This PR is a change of document format for `Style/MethodCallWithArgsParentheses` cop.
bbatsov pushed a commit that referenced this pull request Oct 3, 2019
Follow up of #4880 (comment).

This PR is a change of document format for `Style/MethodCallWithArgsParentheses` cop.
koic added a commit to koic/rubocop that referenced this pull request Oct 3, 2019
Follow up of rubocop#4880 (comment).

This PR is a change of document format for `Lint/Void` cop.
bbatsov pushed a commit that referenced this pull request Oct 3, 2019
Follow up of #4880 (comment).

This PR is a change of document format for `Lint/Void` cop.
koic added a commit to koic/rubocop that referenced this pull request Oct 26, 2019
Follow up of rubocop#4880 (comment).

This PR is a change of document format for `Style/NonNilCheck` cop.
bbatsov pushed a commit that referenced this pull request Oct 27, 2019
Follow up of #4880 (comment).

This PR is a change of document format for `Style/NonNilCheck` cop.
koic added a commit to koic/rubocop that referenced this pull request Nov 14, 2019
Follow up of rubocop#4880 (comment).

This PR is a change of document format for `Style/NumericLiterals` cop.
bbatsov pushed a commit that referenced this pull request Nov 14, 2019
Follow up of #4880 (comment).

This PR is a change of document format for `Style/NumericLiterals` cop.
koic added a commit to koic/rubocop that referenced this pull request Aug 29, 2021
Follow up of rubocop#4880 (comment)

This PR is a change of document format for `Style/CaseEquality` cop.
bbatsov pushed a commit that referenced this pull request Aug 29, 2021
Follow up of #4880 (comment)

This PR is a change of document format for `Style/CaseEquality` cop.
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