@@ -37,9 +37,11 @@ This is GitHub's Ruby Style Guide, inspired by [RuboCop's guide][rubocop-guide].
3737
3838* Use soft-tabs with a two space indent.
3939 <a name =" default-indentation " ></a ><sup >[[ link] ( #default-indentation )] </sup >
40+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutindentationstyle " >RuboCop rule: Layout/IndentationStyle</a >
4041
4142* Indent ` when ` with the start of the ` case ` expression.
4243 <a name =" indent-when-as-start-of-case " ></a ><sup >[[ link] ( #indent-when-as-start-of-case )] </sup >
44+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutcaseindentation " >RuboCop rule: Layout/CaseIndentation</a >
4345
4446``` ruby
4547# bad
8385
8486* Never leave trailing whitespace.
8587 <a name =" trailing-whitespace " ></a ><sup >[[ link] ( #trailing-whitespace )] </sup >
88+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layouttrailingwhitespace " >RuboCop rule: Layout/TrailingWhitespace</a >
8689
8790* Use spaces around operators, after commas, colons and semicolons, around ` { `
8891 and before ` } ` .
8992 <a name =" spaces-operators " ></a ><sup >[[ link] ( #spaces-operators )] </sup >
93+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutspacearoundoperators " >RuboCop rule: Layout/SpaceAroundOperators</a >
94+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutspaceaftercomma " >RuboCop rule: Layout/SpaceAfterComma</a >
95+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutspaceaftercolon " >RuboCop rule: Layout/SpaceAfterColon</a >
96+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutspacebeforeblockbraces " >RuboCop rule: Layout/SpaceBeforeBlockBraces</a >
97+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutspaceinsidehashliteralbraces " >RuboCop rule: Layout/SpaceInsideHashLiteralBraces</a >
98+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylehashsyntax " >RuboCop rule: Style/HashSyntax</a >
99+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutspacearoundoperators " >RuboCop rule: Layout/SpaceAroundOperators</a >
90100
91101``` ruby
92102sum = 1 + 2
@@ -97,6 +107,8 @@ a, b = 1, 2
97107
98108* No spaces after ` ( ` , ` [ ` or before ` ] ` , ` ) ` .
99109 <a name =" no-spaces-braces " ></a ><sup >[[ link] ( #no-spaces-braces )] </sup >
110+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutspaceinsideparens " >RuboCop rule: Layout/SpaceInsideParens</a >
111+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutspaceinsidereferencebrackets " >RuboCop rule: Layout/SpaceInsideReferenceBrackets</a >
100112
101113``` ruby
102114some(arg).other
@@ -105,6 +117,7 @@ some(arg).other
105117
106118* No spaces after ` ! ` .
107119 <a name =" no-spaces-bang " ></a ><sup >[[ link] ( #no-spaces-bang )] </sup >
120+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutspaceafternot " >RuboCop rule: Layout/SpaceAfterNot</a >
108121
109122``` ruby
110123! array.include?(element)
@@ -114,10 +127,12 @@ some(arg).other
114127
115128* End each file with a [ newline] ( https://github.com/bbatsov/ruby-style-guide#newline-eof ) .
116129 <a name =" newline-eof " ></a ><sup >[[ link] ( #newline-eof )] </sup >
130+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layouttrailingemptylines " >RuboCop rule: Layout/TrailingEmptyLines</a >
117131
118132* Use empty lines between ` def ` s and to break up a method into logical
119133 paragraphs.
120134 <a name =" empty-lines-def " ></a ><sup >[[ link] ( #empty-lines-def )] </sup >
135+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutemptylinebetweendefs " >RuboCop rule: Layout/EmptyLineBetweenDefs</a >
121136
122137``` ruby
123138def some_method
@@ -137,12 +152,14 @@ end
137152
138153* Keep each line of code to a readable length. Unless you have a reason to, keep lines to a maximum of 118 characters. Why 118? That's the width at which the pull request diff UI needs horizontal scrolling (making pull requests harder to review).
139154 <a name =" line-length " ></a ><sup >[[ link] ( #line-length )] </sup >
155+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutlinelength " >RuboCop rule: Layout/LineLength</a >
140156
141157## Classes
142158
143159* Avoid the usage of class (` @@ ` ) variables due to their unusual behavior
144160in inheritance.
145161 <a name =" class-variables " ></a ><sup >[[ link] ( #class-variables )] </sup >
162+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleclassvars " >RuboCop rule: Style/ClassVars</a >
146163
147164``` ruby
148165class Parent
@@ -167,6 +184,7 @@ Parent.print_class_var # => will print "child"
167184* Use ` def self.method ` to define singleton methods. This makes the methods
168185 more resistant to refactoring changes.
169186 <a name =" singleton-methods " ></a ><sup >[[ link] ( #singleton-methods )] </sup >
187+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleclassmethodsdefinitions " >RuboCop rule: Style/ClassMethodsDefinitions</a >
170188
171189``` ruby
172190class TestClass
@@ -184,6 +202,7 @@ class TestClass
184202* Avoid ` class << self ` except when necessary, e.g. single accessors and aliased
185203 attributes.
186204 <a name =" class-method-definitions " ></a ><sup >[[ link] ( #class-method-definitions )] </sup >
205+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleclassmethodsdefinitions " >RuboCop rule: Style/ClassMethodsDefinitions</a >
187206
188207``` ruby
189208class TestClass
217236* Indent the ` public ` , ` protected ` , and ` private ` methods as much the
218237 method definitions they apply to. Leave one blank line above them.
219238 <a name =" access-modifier-identation " ></a ><sup >[[ link] ( #access-modifier-identation )] </sup >
239+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutaccessmodifierindentation " >RuboCop rule: Layout/AccessModifierIndentation</a >
240+ * <a href =" https://docs.rubocop.org/rubocop/cops_layout.html#layoutemptylinesaroundaccessmodifier " >RuboCop rule: Layout/EmptyLinesAroundAccessModifier</a >
220241
221242``` ruby
222243class SomeClass
234255* Avoid explicit use of ` self ` as the recipient of internal class or instance
235256 messages unless to specify a method shadowed by a variable.
236257 <a name =" self-messages " ></a ><sup >[[ link] ( #self-messages )] </sup >
258+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleredundantself " >RuboCop rule: Style/RedundantSelf</a >
237259
238260``` ruby
239261class SomeClass
251273* Prefer ` %w ` to the literal array syntax when you need an array of
252274strings.
253275 <a name =" percent-w " ></a ><sup >[[ link] ( #percent-w )] </sup >
276+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylewordarray " >RuboCop rule: Style/WordArray</a >
254277
255278``` ruby
256279# bad
@@ -268,6 +291,7 @@ STATES = %w(draft open closed)
268291
269292* Use symbols instead of strings as hash keys.
270293 <a name =" symbols-as-keys " ></a ><sup >[[ link] ( #symbols-as-keys )] </sup >
294+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylestringhashkeys " >RuboCop rule: Style/StringHashKeys</a >
271295
272296``` ruby
273297# bad
303327
304328Avoid calling ` send ` and its cousins unless you really need it. Metaprogramming can be extremely powerful, but in most cases you can write code that captures your meaning by being explicit:
305329<a name =" avoid-send " ></a ><sup >[[ link] ( #avoid-send )] </sup >
330+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylesend " >RuboCop rule: Style/Send</a >
306331
307332``` ruby
308- # avoid
333+ # avoid
309334unless [:base , :head ].include?(base_or_head)
310335 raise ArgumentError , " base_or_head must be either :base or :head"
311336end
369394
370395Use the Ruby 1.9 syntax for hash literals when all the keys are symbols:
371396<a name =" symbols-as-hash-keys " ></a ><sup >[[ link] ( #symbols-as-hash-keys )] </sup >
397+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylestringhashkeys " >RuboCop rule: Style/StringHashKeys</a >
372398
373399``` ruby
374400# bad
@@ -399,6 +425,7 @@ link_to("Account", controller: "users", action: "show", id: user)
399425
400426If you have a hash with mixed key types, use the legacy hashrocket style to avoid mixing styles within the same hash:
401427<a name =" consistent-hash-syntax " ></a ><sup >[[ link] ( #consistent-hash-syntax )] </sup >
428+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylehashsyntax " >RuboCop rule: Style/HashSyntax</a >
402429
403430``` ruby
404431
@@ -420,6 +447,7 @@ hsh = {
420447
421448[Keyword arguments](http: / /magazine.rubyist.net/ ?R uby200SpecialEn- kwarg) are recommended but not required when a method' s arguments may otherwise be opaque or non-obvious when called. Additionally, prefer them over the old "Hash as pseudo-named args" style from pre-2.0 ruby.
422449<a name="keyword-arguments"></a><sup>[[link](#keyword-arguments)]</sup>
450+ * <a href="https://docs.rubocop.org/rubocop/cops_style.html#styleoptionalbooleanparameter">RuboCop rule: Style/OptionalBooleanParameter</a>
423451
424452So instead of this:
425453
@@ -447,28 +475,34 @@ remove_member(user, skip_membership_check: true)
447475
448476* Use `snake_case` for methods and variables.
449477 <a name="snake-case-methods-vars"></a><sup>[[link](#snake-case-methods-vars)]</sup>
478+ * <a href="https://docs.rubocop.org/rubocop/cops_naming.html#namingsnakecase">RuboCop rule: Naming/SnakeCase</a>
479+ * <a href="https://docs.rubocop.org/rubocop/cops_naming.html#namingvariablename">RuboCop rule: Naming/VariableName</a>
450480
451481* Use `CamelCase` for classes and modules. (Keep acronyms like HTTP,
452482 RFC, XML uppercase.)
453483 <a name="camelcase-classes-modules"></a><sup>[[link](#camelcase-classes-modules)]</sup>
484+ * <a href="https://docs.rubocop.org/rubocop/cops_naming.html#namingclassandmodulecamelcase">RuboCop rule: Naming/ClassAndModuleCamelCase</a>
454485
455486* Use `SCREAMING_SNAKE_CASE` for other constants.
456487 <a name="screaming-snake-case-constants"></a><sup>[[link](#screaming-snake-case-constants)]</sup>
488+ * <a href="https://docs.rubocop.org/rubocop/cops_naming.html#namingconstantname">RuboCop rule: Naming/ConstantName</a>
457489
458490* The names of predicate methods (methods that return a boolean value)
459491 should end in a question mark. (i.e. `Array#empty?`).
460492 <a name="bool-methods-qmark"></a><sup>[[link](#bool-methods-qmark)]</sup>
493+ * <a href="https://docs.rubocop.org/rubocop/cops_naming.html#namingpredicatename">RuboCop rule: Naming/PredicateName</a>
461494
462495* The names of potentially "dangerous" methods (i.e. methods that modify `self` or the
463496 arguments, `exit!`, etc.) should end with an exclamation mark. Bang methods
464- should only exist if a non-bang counterpart (method name which does NOT end with !)
497+ should only exist if a non-bang counterpart (method name which does NOT end with !)
465498 also exists.
466499 <a name="dangerous-method-bang"></a><sup>[[link](#dangerous-method-bang)]</sup>
467500
468501## Percent Literals
469502
470503* Use `%w` freely.
471504 <a name="use-percent-w-freely"></a><sup>[[link](#use-percent-w-freely)]</sup>
505+ * <a href="https://docs.rubocop.org/rubocop/cops_style.html#stylewordarray">RuboCop rule: Style/WordArray</a>
472506
473507``` ruby
474508STATES = %w(draft open closed)
@@ -477,6 +511,7 @@ STATES = %w(draft open closed)
477511* Use `%()` for single-line strings which require both interpolation
478512 and embedded double-quotes. For multi-line strings, prefer heredocs.
479513 <a name="percent-parens-single-line"></a><sup>[[link](#percent-parens-single-line)]</sup>
514+ * <a href="https://docs.rubocop.org/rubocop/cops_style.html#stylebarepercentliterals">RuboCop rule: Style/BarePercentLiterals</a>
480515
481516``` ruby
482517# bad (no interpolation needed)
@@ -497,6 +532,7 @@ STATES = %w(draft open closed)
497532
498533* Use `%r` only for regular expressions matching *more than* one ' / ' character.
499534 <a name="percent-r-regular-expressions"></a><sup>[[link](#percent-r-regular-expressions)]</sup>
535+ * <a href="https://docs.rubocop.org/rubocop/cops_style.html#styleregexpliteral">RuboCop rule: Style/RegexpLiteral</a>
500536
501537``` ruby
502538# bad
@@ -515,7 +551,7 @@ STATES = %w(draft open closed)
515551* Avoid using $1-9 as it can be hard to track what they contain. Named groups
516552 can be used instead.
517553 <a name="capture-with-named-groups"></a><sup>[[link](#capture-with-named-groups)]</sup>
518-
554+ * <a href="https://docs.rubocop.org/rubocop/cops_lint.html#mixedregexpcapturetypes">RuboCop rule: Lint/MixedRegexpCaptureTypes</a>
519555``` ruby
520556# bad
521557/(regexp)/ =~ string
@@ -574,6 +610,7 @@ documentation about the libraries that the current file uses.
574610
575611* Prefer string interpolation instead of string concatenation:
576612 <a name =" string-interpolation " ></a ><sup >[[ link] ( #string-interpolation )] </sup >
613+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylestringconcatenation " >RuboCop rule: Style/StringConcatenation</a >
577614
578615``` ruby
579616# bad
@@ -587,6 +624,7 @@ email_with_name = "#{user.name} <#{user.email}>"
587624 will always work without a delimiter change, and ` ' ` is a lot more
588625 common than ` " ` in string literals.
589626 <a name =" double-quotes " ></a ><sup >[[ link] ( #double-quotes )] </sup >
627+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylestringliterals " >RuboCop rule: Style/StringLiterals</a >
590628
591629``` ruby
592630# bad
618656* Use ` def ` with parentheses when there are arguments. Omit the
619657 parentheses when the method doesn't accept any arguments.
620658 <a name =" method-parens-when-arguments " ></a ><sup >[[ link] ( #method-parens-when-arguments )] </sup >
659+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styledefwithparentheses " >RuboCop rule: Style/DefWithParentheses</a >
621660
622661 ``` ruby
623662 def some_method
635674 always use parentheses in the method invocation. For example, write
636675 ` f((3 + 2) + 1) ` .
637676 <a name =" parens-no-spaces " ></a ><sup >[[ link] ( #parens-no-spaces )] </sup >
677+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylemethodcallwithargsparentheses " >RuboCop rule: Style/MethodCallWithArgsParentheses</a >
638678
639679* Never put a space between a method name and the opening parenthesis.
640680 <a name =" no-spaces-method-parens " ></a ><sup >[[ link] ( #no-spaces-method-parens )] </sup >
681+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleparenthesesasgroupedexpression " >RuboCop rule: Style/ParenthesesAsGroupedExpression</a >
641682
642683``` ruby
643684# bad
@@ -653,6 +694,7 @@ f(3 + 2) + 1
653694
654695* Never use ` then ` for multi-line ` if/unless ` .
655696 <a name =" no-then-for-multi-line-if-unless " ></a ><sup >[[ link] ( #no-then-for-multi-line-if-unless )] </sup >
697+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylemultilineifthen " >RuboCop rule: Style/MultilineIfThen</a >
656698
657699``` ruby
658700# bad
@@ -668,10 +710,12 @@ end
668710
669711* The ` and ` and ` or ` keywords are banned. It's just not worth it. Always use ` && ` and ` || ` instead.
670712 <a name =" no-and-or-or " ></a ><sup >[[ link] ( #no-and-or-or )] </sup >
713+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleandor " >RuboCop rule: Style/AndOr</a >
671714
672715* Favor modifier ` if/unless ` usage when you have a single-line
673716 body.
674717 <a name =" favor-modifier-if-unless " ></a ><sup >[[ link] ( #favor-modifier-if-unless )] </sup >
718+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylemultilineternaryoperator " >RuboCop rule: Style/MultilineTernaryOperator</a >
675719
676720``` ruby
677721# bad
@@ -685,6 +729,7 @@ do_something if some_condition
685729
686730* Never use ` unless ` with ` else ` . Rewrite these with the positive case first.
687731 <a name =" no-else-with-unless " ></a ><sup >[[ link] ( #no-else-with-unless )] </sup >
732+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleunlesselse " >RuboCop rule: Style/UnlessElse</a >
688733
689734``` ruby
690735# bad
704749
705750* Don't use parentheses around the condition of an ` if/unless/while ` .
706751 <a name =" no-parens-if-unless-while " ></a ><sup >[[ link] ( #no-parens-if-unless-while )] </sup >
752+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleparenthesesaroundcondition " >RuboCop rule: Style/ParenthesesAroundCondition</a >
707753
708754``` ruby
709755# bad
723769 trivial. However, do use the ternary operator(` ?: ` ) over ` if/then/else/end ` constructs
724770 for single line conditionals.
725771 <a name =" trivial-ternary " ></a ><sup >[[ link] ( #trivial-ternary )] </sup >
772+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylemultilineternaryoperator " >RuboCop rule: Style/MultilineTernaryOperator</a >
726773
727774``` ruby
728775# bad
@@ -734,11 +781,13 @@ result = some_condition ? something : something_else
734781
735782* Avoid multi-line ` ?: ` (the ternary operator), use ` if/unless ` instead.
736783 <a name =" no-multiline-ternary " ></a ><sup >[[ link] ( #no-multiline-ternary )] </sup >
784+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylemultilineternaryoperator " >RuboCop rule: Style/MultilineTernaryOperator</a >
737785
738786* Use one expression per branch in a ternary operator. This
739787 also means that ternary operators must not be nested. Prefer
740788 ` if/else ` constructs in these cases.
741789 <a name =" one-expression-per-branch " ></a ><sup >[[ link] ( #one-expression-per-branch )] </sup >
790+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylenestedternaryoperator " >RuboCop rule: Style/NestedTernaryOperator</a >
742791
743792``` ruby
744793# bad
760809 doesn't introduce a new scope (unlike ` each ` ) and variables defined
761810 in its block will be visible outside it.
762811 <a name =" avoid-for " ></a ><sup >[[ link] ( #avoid-for )] </sup >
812+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylefor " >RuboCop rule: Style/For</a >
763813
764814``` ruby
765815arr = [1 , 2 , 3 ]
@@ -779,6 +829,7 @@ arr.each { |elem| puts elem }
779829 definitions" (e.g. in Rakefiles and certain DSLs). Avoid ` do...end `
780830 when chaining.
781831 <a name =" squiggly-braces " ></a ><sup >[[ link] ( #squiggly-braces )] </sup >
832+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleblockdelimiters " >RuboCop rule: Style/BlockDelimiters</a >
782833
783834``` ruby
784835names = [" Bozhidar" , " Steve" , " Sarah" ]
@@ -801,11 +852,12 @@ end.map { |name| name.upcase }
801852```
802853
803854* Some will argue that multiline chaining would look OK with the use of ` {...} ` ,
804- but they should ask themselves: is this code really readable and can't the block's
855+ but they should ask themselves: is this code really readable and can't the block's
805856 contents be extracted into nifty methods?
806857
807858* Avoid ` return ` where not required.
808859 <a name =" avoid-return " ></a ><sup >[[ link] ( #avoid-return )] </sup >
860+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleredundantreturn " >RuboCop rule: Style/RedundantReturn</a >
809861
810862``` ruby
811863# bad
821873
822874* Use spaces around the ` = ` operator when assigning default values to method parameters:
823875 <a name =" spaces-around-equals " ></a ><sup >[[ link] ( #spaces-around-equals )] </sup >
876+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylespacearoundequalsinparameterdefault " >RuboCop rule: Style/SpaceAroundEqualsInParameterDefault</a >
824877
825878``` ruby
826879# bad
@@ -853,6 +906,7 @@ if (v = next_value) == "hello" ...
853906
854907* Use ` ||= ` freely to initialize variables.
855908 <a name =" memoization-for-initialization " ></a ><sup >[[ link] ( #memoize-away )] </sup >
909+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleorassignment " >RuboCop rule: Style/OrAssignment</a >
856910
857911``` ruby
858912# set name to Bozhidar, only if it's nil or false
@@ -862,6 +916,7 @@ name ||= "Bozhidar"
862916* Don't use ` ||= ` to initialize boolean variables. (Consider what
863917 would happen if the current value happened to be ` false ` .)
864918 <a name =" no-memoization-for-boolean " ></a ><sup >[[ link] ( #no-memoization-for-boolean )] </sup >
919+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleorassignment " >RuboCop rule: Style/OrAssignment</a >
865920
866921``` ruby
867922# bad - would set enabled to true even if it was false
@@ -876,9 +931,11 @@ enabled = true if enabled.nil?
876931 one-liner scripts is discouraged. Prefer long form versions such as
877932 ` $PROGRAM_NAME ` .
878933 <a name =" no-cryptic-vars " ></a ><sup >[[ link] ( #no-cryptic-vars )] </sup >
934+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylespecialglobalvars " >RuboCop rule: Style/SpecialGlobalVars</a >
879935
880936* Use ` _ ` for unused block parameters.
881937 <a name =" underscore-unused-vars " ></a ><sup >[[ link] ( #underscore-unused-vars )] </sup >
938+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#styleunusedblockargument " >RuboCop rule: Style/UnusedBlockArgument</a >
882939
883940``` ruby
884941# bad
@@ -893,6 +950,7 @@ result = hash.map { |_, v| v + 1 }
893950 For example, ` String === "hi" ` is true and ` "hi" === String ` is false.
894951 Instead, use ` is_a? ` or ` kind_of? ` if you must.
895952 <a name =" type-checking-is-a-kind-of " ></a ><sup >[[ link] ( #type-checking-is-a-kind-of )] </sup >
953+ * <a href =" https://docs.rubocop.org/rubocop/cops_style.html#stylecaseequality " >RuboCop rule: Style/CaseEquality</a >
896954
897955 Refactoring is even better. It's worth looking hard at any code that explicitly checks types.
898956
0 commit comments