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

Add bad example for BigDecimalWithNumericArgument #144

Merged

Conversation

lucasocon
Copy link
Contributor

This PR adds the bad example in documentation for Performance/BigDecimalWithNumericArgument
Ref: https://docs.rubocop.org/rubocop-performance/cops_performance.html#performancebigdecimalwithnumericargument


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).
  • 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.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@koic
Copy link
Member

koic commented Jul 7, 2020

Thanks for opening the PR. docs/modules/ROOT/pages/cops_performance.adoc is a generated file. Can you update the following file.

--- a/docs/modules/ROOT/pages/cops_performance.adoc
+++ b/docs/modules/ROOT/pages/cops_performance.adoc
@@ -46,20 +46,14 @@ This cop identifies places where numeric argument to BigDecimal should be
 converted to string. Initializing from String is faster
 than from Numeric for BigDecimal.

+# bad
 BigDecimal(1, 2)
 BigDecimal(1.2, 3, exception: true)

-  # good
+# good
 BigDecimal('1', 2)
 BigDecimal('1.2', 3, exception: true)

-=== Examples
-
-[source,ruby]
-----
-# bad
-----
-
 == Performance/BindCall

 NOTE: Required Ruby version: 2.7

https://github.com/rubocop-hq/rubocop-performance/blob/v1.7.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb

And can you generate the doc using bundle exec rake generate_cops_documentation?

@lucasocon lucasocon force-pushed the doc-big-decimal-with-numeric-argument branch from 4620bdd to 797cbe0 Compare July 7, 2020 13:27
@lucasocon
Copy link
Contributor Author

Hey, @koic I updated the file where the documentation is generated and generated the doc.
Let me know what do you think.

@koic koic merged commit 809fae5 into rubocop:master Jul 7, 2020
@koic
Copy link
Member

koic commented Jul 7, 2020

Perfect! Thanks!

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.

2 participants