rubocop-github 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -4
- data/STYLEGUIDE.md +1 -1
- data/config/default.yml +28 -10
- data/config/default_pending.yml +110 -0
- data/config/rails_pending.yml +82 -0
- data/lib/rubocop/cop/github/avoid_object_send_with_dynamic_method.rb +77 -0
- data/lib/rubocop/cop/github/rails_controller_render_literal.rb +1 -1
- data/lib/rubocop/cop/github/render_literal_helpers.rb +2 -1
- data/lib/rubocop-github.rb +1 -0
- data/lib/version.rb +3 -0
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e158f9c46a8771d2dced9060e0ca5ede3e55ffddb13d6e8cfa8c6b7bfdce2888
|
4
|
+
data.tar.gz: c0b8bbed2b058338dd2e39e9050943aed6b69683c88af4f615d733276f1f1582
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aafbf512fdadbffcac228fc45fc4877cfb6ea10bd3b35a7673eea11e8010888d1e7dd4686632a4239a63fd9d431a8e9a844dfcac4a62a129c8b410461cfe5389
|
7
|
+
data.tar.gz: e1961e828dbb86115b9969ba92c2a7bda764f9607effc0a25a3b729d4c21677fa0b25dedb126f25e0b7838a173eec30d782f264f4326723dc17a0a3367203e04
|
data/README.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
# RuboCop GitHub
|
1
|
+
# RuboCop GitHub
|
2
|
+
|
3
|
+
[](https://github.com/github/rubocop-github/actions/workflows/test.yml)
|
4
|
+
[](https://github.com/github/rubocop-github/actions/workflows/build.yml)
|
5
|
+
[](https://github.com/github/rubocop-github/actions/workflows/lint.yml)
|
6
|
+
[](https://github.com/github/rubocop-github/actions/workflows/release.yml)
|
2
7
|
|
3
8
|
This repository provides recommended RuboCop configuration and additional Cops for use on GitHub open source and internal Ruby projects, and is the home of [GitHub's Ruby Style Guide](./STYLEGUIDE.md).
|
4
9
|
|
@@ -16,10 +21,10 @@ Inherit all of the stylistic rules and cops through an inheritance declaration i
|
|
16
21
|
|
17
22
|
```yaml
|
18
23
|
# .rubocop.yml
|
19
|
-
|
24
|
+
inherit_gem:
|
20
25
|
rubocop-github:
|
21
|
-
|
22
|
-
|
26
|
+
- config/default.yml # generic Ruby rules and cops
|
27
|
+
- config/rails.yml # Rails-specific rules and cops
|
23
28
|
```
|
24
29
|
|
25
30
|
Alternatively, only require the additional custom cops in your `.rubocop.yml` without inheriting/enabling the other stylistic rules:
|
data/STYLEGUIDE.md
CHANGED
@@ -678,7 +678,7 @@ end
|
|
678
678
|
|
679
679
|
* Never put a space between a method name and the opening parenthesis.
|
680
680
|
<a name="no-spaces-method-parens"></a><sup>[[link](#no-spaces-method-parens)]</sup>
|
681
|
-
* <a href="https://docs.rubocop.org/rubocop/
|
681
|
+
* <a href="https://docs.rubocop.org/rubocop/cops_lint.html#lintparenthesesasgroupedexpression">RuboCop rule: Lint/ParenthesesAsGroupedExpression</a>
|
682
682
|
|
683
683
|
``` ruby
|
684
684
|
# bad
|
data/config/default.yml
CHANGED
@@ -44,6 +44,9 @@ Gemspec/RequiredRubyVersion:
|
|
44
44
|
Gemspec/RubyVersionGlobalsUsage:
|
45
45
|
Enabled: false
|
46
46
|
|
47
|
+
GitHub/AvoidObjectSendWithDynamicMethod:
|
48
|
+
Enabled: true
|
49
|
+
|
47
50
|
GitHub/InsecureHashAlgorithm:
|
48
51
|
Enabled: true
|
49
52
|
|
@@ -68,10 +71,10 @@ Layout/BlockAlignment:
|
|
68
71
|
Layout/BlockEndNewline:
|
69
72
|
Enabled: true
|
70
73
|
|
71
|
-
# TODO: Enable this since it's in the styleguide.
|
72
74
|
Layout/CaseIndentation:
|
73
|
-
Enabled:
|
75
|
+
Enabled: true
|
74
76
|
StyleGuide: https://github.com/github/rubocop-github/blob/main/STYLEGUIDE.md#indent-when-as-start-of-case
|
77
|
+
EnforcedStyle: end
|
75
78
|
|
76
79
|
Layout/ClassStructure:
|
77
80
|
Enabled: false
|
@@ -216,6 +219,7 @@ Layout/LineEndStringConcatenationIndentation:
|
|
216
219
|
|
217
220
|
Layout/LineLength:
|
218
221
|
Enabled: false
|
222
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/STYLEGUIDE.md#line-length
|
219
223
|
|
220
224
|
Layout/MultilineArrayBraceLayout:
|
221
225
|
Enabled: false
|
@@ -290,7 +294,10 @@ Layout/SpaceAroundMethodCallOperator:
|
|
290
294
|
Enabled: false
|
291
295
|
|
292
296
|
Layout/SpaceAroundOperators:
|
293
|
-
Enabled:
|
297
|
+
Enabled: true
|
298
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/STYLEGUIDE.md#spaces-operators
|
299
|
+
Exclude:
|
300
|
+
- "**/*.erb"
|
294
301
|
|
295
302
|
Layout/SpaceBeforeBlockBraces:
|
296
303
|
Enabled: true
|
@@ -324,7 +331,8 @@ Layout/SpaceInsideBlockBraces:
|
|
324
331
|
Enabled: true
|
325
332
|
|
326
333
|
Layout/SpaceInsideHashLiteralBraces:
|
327
|
-
Enabled:
|
334
|
+
Enabled: true
|
335
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/STYLEGUIDE.md#spaces-operators
|
328
336
|
|
329
337
|
Layout/SpaceInsideParens:
|
330
338
|
Enabled: true
|
@@ -561,7 +569,9 @@ Lint/OutOfRangeRegexpRef:
|
|
561
569
|
Enabled: false
|
562
570
|
|
563
571
|
Lint/ParenthesesAsGroupedExpression:
|
564
|
-
|
572
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/STYLEGUIDE.md#no-spaces-method-parens
|
573
|
+
Exclude:
|
574
|
+
- "**/*.erb"
|
565
575
|
|
566
576
|
Lint/PercentStringArray:
|
567
577
|
Enabled: false
|
@@ -995,9 +1005,8 @@ Style/AccessorGrouping:
|
|
995
1005
|
Style/Alias:
|
996
1006
|
Enabled: false
|
997
1007
|
|
998
|
-
# TODO: Enable this since it's in the styleguide.
|
999
1008
|
Style/AndOr:
|
1000
|
-
Enabled:
|
1009
|
+
Enabled: true
|
1001
1010
|
StyleGuide: https://github.com/github/rubocop-github/blob/main/STYLEGUIDE.md#no-and-or-or
|
1002
1011
|
|
1003
1012
|
Style/ArgumentsForwarding:
|
@@ -1035,6 +1044,7 @@ Style/BlockDelimiters:
|
|
1035
1044
|
|
1036
1045
|
Style/CaseEquality:
|
1037
1046
|
Enabled: true
|
1047
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/STYLEGUIDE.md#type-checking-is-a-kind-of
|
1038
1048
|
|
1039
1049
|
Style/CaseLikeIf:
|
1040
1050
|
Enabled: false
|
@@ -1055,10 +1065,12 @@ Style/ClassMethods:
|
|
1055
1065
|
Enabled: true
|
1056
1066
|
|
1057
1067
|
Style/ClassMethodsDefinitions:
|
1058
|
-
Enabled:
|
1068
|
+
Enabled: true
|
1069
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/STYLEGUIDE.md#classes
|
1059
1070
|
|
1060
1071
|
Style/ClassVars:
|
1061
1072
|
Enabled: false
|
1073
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/STYLEGUIDE.md#class-variables
|
1062
1074
|
|
1063
1075
|
Style/CollectionCompact:
|
1064
1076
|
Enabled: false
|
@@ -1371,7 +1383,10 @@ Style/NestedParenthesizedCalls:
|
|
1371
1383
|
Enabled: false
|
1372
1384
|
|
1373
1385
|
Style/NestedTernaryOperator:
|
1374
|
-
Enabled:
|
1386
|
+
Enabled: true
|
1387
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/STYLEGUIDE.md#one-expression-per-branch
|
1388
|
+
Exclude:
|
1389
|
+
- "**/*.erb"
|
1375
1390
|
|
1376
1391
|
Style/Next:
|
1377
1392
|
Enabled: false
|
@@ -1422,7 +1437,10 @@ Style/OptionalBooleanParameter:
|
|
1422
1437
|
Enabled: false
|
1423
1438
|
|
1424
1439
|
Style/OrAssignment:
|
1425
|
-
Enabled:
|
1440
|
+
Enabled: true
|
1441
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/STYLEGUIDE.md#memoize-away
|
1442
|
+
Exclude:
|
1443
|
+
- "**/*.erb"
|
1426
1444
|
|
1427
1445
|
Style/ParallelAssignment:
|
1428
1446
|
Enabled: false
|
data/config/default_pending.yml
CHANGED
@@ -4,3 +4,113 @@ Style/OperatorMethodCall: # new in 1.37
|
|
4
4
|
Enabled: false
|
5
5
|
Style/RedundantStringEscape: # new in 1.37
|
6
6
|
Enabled: false
|
7
|
+
Gemspec/DevelopmentDependencies: # new in 1.44
|
8
|
+
Enabled: false
|
9
|
+
Lint/DuplicateMatchPattern: # new in 1.50
|
10
|
+
Enabled: false
|
11
|
+
Lint/ItWithoutArgumentsInBlock: # new in 1.59
|
12
|
+
Enabled: false
|
13
|
+
Lint/LiteralAssignmentInCondition: # new in 1.58
|
14
|
+
Enabled: false
|
15
|
+
Lint/MixedCaseRange: # new in 1.53
|
16
|
+
Enabled: false
|
17
|
+
Lint/RedundantRegexpQuantifiers: # new in 1.53
|
18
|
+
Enabled: false
|
19
|
+
Lint/UselessRescue: # new in 1.43
|
20
|
+
Enabled: false
|
21
|
+
Metrics/CollectionLiteralLength: # new in 1.47
|
22
|
+
Enabled: false
|
23
|
+
Style/ArrayIntersect: # new in 1.40
|
24
|
+
Enabled: false
|
25
|
+
Style/ComparableClamp: # new in 1.44
|
26
|
+
Enabled: false
|
27
|
+
Style/ConcatArrayLiterals: # new in 1.41
|
28
|
+
Enabled: false
|
29
|
+
Style/DataInheritance: # new in 1.49
|
30
|
+
Enabled: false
|
31
|
+
Style/DirEmpty: # new in 1.48
|
32
|
+
Enabled: false
|
33
|
+
Style/ExactRegexpMatch: # new in 1.51
|
34
|
+
Enabled: false
|
35
|
+
Style/FileEmpty: # new in 1.48
|
36
|
+
Enabled: false
|
37
|
+
Style/MapIntoArray: # new in 1.63
|
38
|
+
Enabled: false
|
39
|
+
Style/MapToSet: # new in 1.42
|
40
|
+
Enabled: false
|
41
|
+
Style/MinMaxComparison: # new in 1.42
|
42
|
+
Enabled: false
|
43
|
+
Style/RedundantArrayConstructor: # new in 1.52
|
44
|
+
Enabled: false
|
45
|
+
Style/RedundantConstantBase: # new in 1.40
|
46
|
+
Enabled: false
|
47
|
+
Style/RedundantCurrentDirectoryInPath: # new in 1.53
|
48
|
+
Enabled: false
|
49
|
+
Style/RedundantDoubleSplatHashBraces: # new in 1.41
|
50
|
+
Enabled: false
|
51
|
+
Style/RedundantEach: # new in 1.38
|
52
|
+
Enabled: false
|
53
|
+
Style/RedundantFilterChain: # new in 1.52
|
54
|
+
Enabled: false
|
55
|
+
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
56
|
+
Enabled: false
|
57
|
+
Style/RedundantLineContinuation: # new in 1.49
|
58
|
+
Enabled: false
|
59
|
+
Style/RedundantRegexpArgument: # new in 1.53
|
60
|
+
Enabled: false
|
61
|
+
Style/RedundantRegexpConstructor: # new in 1.52
|
62
|
+
Enabled: false
|
63
|
+
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
|
64
|
+
Enabled: false
|
65
|
+
Style/SingleLineDoEndBlock: # new in 1.57
|
66
|
+
Enabled: false
|
67
|
+
Style/SuperWithArgsParentheses: # new in 1.58
|
68
|
+
Enabled: false
|
69
|
+
Style/YAMLFileRead: # new in 1.53
|
70
|
+
Enabled: false
|
71
|
+
Performance/MapMethodChain: # new in 1.19
|
72
|
+
Enabled: false
|
73
|
+
Gemspec/AddRuntimeDependency: # new in 1.65
|
74
|
+
Enabled: false
|
75
|
+
Lint/ConstantReassignment: # new in 1.70
|
76
|
+
Enabled: false
|
77
|
+
Lint/DuplicateSetElement: # new in 1.67
|
78
|
+
Enabled: false
|
79
|
+
Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69
|
80
|
+
Enabled: false
|
81
|
+
Lint/NumericOperationWithConstantResult: # new in 1.69
|
82
|
+
Enabled: false
|
83
|
+
Lint/SharedMutableDefault: # new in 1.70
|
84
|
+
Enabled: false
|
85
|
+
Lint/UnescapedBracketInRegexp: # new in 1.68
|
86
|
+
Enabled: false
|
87
|
+
Lint/UselessDefined: # new in 1.69
|
88
|
+
Enabled: false
|
89
|
+
Lint/UselessNumericOperation: # new in 1.66
|
90
|
+
Enabled: false
|
91
|
+
Style/AmbiguousEndlessMethodDefinition: # new in 1.68
|
92
|
+
Enabled: false
|
93
|
+
Style/BitwisePredicate: # new in 1.68
|
94
|
+
Enabled: false
|
95
|
+
Style/CombinableDefined: # new in 1.68
|
96
|
+
Enabled: false
|
97
|
+
Style/DigChain: # new in 1.69
|
98
|
+
Enabled: false
|
99
|
+
Style/FileNull: # new in 1.69
|
100
|
+
Enabled: false
|
101
|
+
Style/FileTouch: # new in 1.69
|
102
|
+
Enabled: false
|
103
|
+
Style/ItAssignment: # new in 1.70
|
104
|
+
Enabled: false
|
105
|
+
Style/KeywordArgumentsMerging: # new in 1.68
|
106
|
+
Enabled: false
|
107
|
+
Style/RedundantInterpolationUnfreeze: # new in 1.66
|
108
|
+
Enabled: false
|
109
|
+
Style/SafeNavigationChainLength: # new in 1.68
|
110
|
+
Enabled: false
|
111
|
+
Style/SendWithLiteralMethodName: # new in 1.64
|
112
|
+
Enabled: false
|
113
|
+
Style/SuperArguments: # new in 1.64
|
114
|
+
Enabled: false
|
115
|
+
Performance/StringBytesize: # new in 1.23
|
116
|
+
Enabled: false
|
data/config/rails_pending.yml
CHANGED
@@ -18,3 +18,85 @@ Rails/WhereMissing: # new in 2.16
|
|
18
18
|
Enabled: false
|
19
19
|
Rails/WhereNotWithMultipleConditions: # new in 2.17
|
20
20
|
Enabled: false
|
21
|
+
Gemspec/DevelopmentDependencies: # new in 1.44
|
22
|
+
Enabled: false
|
23
|
+
Lint/DuplicateMatchPattern: # new in 1.50
|
24
|
+
Enabled: false
|
25
|
+
Lint/ItWithoutArgumentsInBlock: # new in 1.59
|
26
|
+
Enabled: false
|
27
|
+
Lint/LiteralAssignmentInCondition: # new in 1.58
|
28
|
+
Enabled: false
|
29
|
+
Lint/MixedCaseRange: # new in 1.53
|
30
|
+
Enabled: false
|
31
|
+
Lint/RedundantRegexpQuantifiers: # new in 1.53
|
32
|
+
Enabled: false
|
33
|
+
Lint/UselessRescue: # new in 1.43
|
34
|
+
Enabled: false
|
35
|
+
Metrics/CollectionLiteralLength: # new in 1.47
|
36
|
+
Enabled: false
|
37
|
+
Style/ArrayIntersect: # new in 1.40
|
38
|
+
Enabled: false
|
39
|
+
Style/ComparableClamp: # new in 1.44
|
40
|
+
Enabled: false
|
41
|
+
Style/ConcatArrayLiterals: # new in 1.41
|
42
|
+
Enabled: false
|
43
|
+
Style/DataInheritance: # new in 1.49
|
44
|
+
Enabled: false
|
45
|
+
Style/DirEmpty: # new in 1.48
|
46
|
+
Enabled: false
|
47
|
+
Style/ExactRegexpMatch: # new in 1.51
|
48
|
+
Enabled: false
|
49
|
+
Style/FileEmpty: # new in 1.48
|
50
|
+
Enabled: false
|
51
|
+
Style/MapIntoArray: # new in 1.63
|
52
|
+
Enabled: false
|
53
|
+
Style/MapToSet: # new in 1.42
|
54
|
+
Enabled: false
|
55
|
+
Style/MinMaxComparison: # new in 1.42
|
56
|
+
Enabled: false
|
57
|
+
Style/RedundantArrayConstructor: # new in 1.52
|
58
|
+
Enabled: false
|
59
|
+
Style/RedundantConstantBase: # new in 1.40
|
60
|
+
Enabled: false
|
61
|
+
Style/RedundantCurrentDirectoryInPath: # new in 1.53
|
62
|
+
Enabled: false
|
63
|
+
Style/RedundantDoubleSplatHashBraces: # new in 1.41
|
64
|
+
Enabled: false
|
65
|
+
Style/RedundantEach: # new in 1.38
|
66
|
+
Enabled: false
|
67
|
+
Style/RedundantFilterChain: # new in 1.52
|
68
|
+
Enabled: false
|
69
|
+
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
70
|
+
Enabled: false
|
71
|
+
Style/RedundantLineContinuation: # new in 1.49
|
72
|
+
Enabled: false
|
73
|
+
Style/RedundantRegexpArgument: # new in 1.53
|
74
|
+
Enabled: false
|
75
|
+
Style/RedundantRegexpConstructor: # new in 1.52
|
76
|
+
Enabled: false
|
77
|
+
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
|
78
|
+
Enabled: false
|
79
|
+
Style/SingleLineDoEndBlock: # new in 1.57
|
80
|
+
Enabled: false
|
81
|
+
Style/SuperWithArgsParentheses: # new in 1.58
|
82
|
+
Enabled: false
|
83
|
+
Style/YAMLFileRead: # new in 1.53
|
84
|
+
Enabled: false
|
85
|
+
Performance/MapMethodChain: # new in 1.19
|
86
|
+
Enabled: false
|
87
|
+
Rails/DangerousColumnNames: # new in 2.21
|
88
|
+
Enabled: false
|
89
|
+
Rails/EnvLocal: # new in 2.22
|
90
|
+
Enabled: false
|
91
|
+
Rails/RedundantActiveRecordAllMethod: # new in 2.21
|
92
|
+
Enabled: false
|
93
|
+
Rails/ResponseParsedBody: # new in 2.18
|
94
|
+
Enabled: false
|
95
|
+
Rails/ThreeStateBooleanColumn: # new in 2.19
|
96
|
+
Enabled: false
|
97
|
+
Rails/UnusedRenderContent: # new in 2.21
|
98
|
+
Enabled: false
|
99
|
+
Rails/EnumSyntax: # new in 2.26
|
100
|
+
Enabled: false
|
101
|
+
Rails/WhereRange: # new in 2.25
|
102
|
+
Enabled: false
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubocop"
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Cop
|
7
|
+
module GitHub
|
8
|
+
# Public: A Rubocop to discourage using methods like Object#send that allow you to dynamically call other
|
9
|
+
# methods on a Ruby object, when the method being called is itself completely dynamic. Instead, explicitly call
|
10
|
+
# methods by name.
|
11
|
+
#
|
12
|
+
# Examples:
|
13
|
+
#
|
14
|
+
# # bad
|
15
|
+
# foo.send(some_variable)
|
16
|
+
#
|
17
|
+
# # good
|
18
|
+
# case some_variable
|
19
|
+
# when "bar"
|
20
|
+
# foo.bar
|
21
|
+
# else
|
22
|
+
# foo.baz
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# # fine
|
26
|
+
# foo.send(:bar)
|
27
|
+
# foo.public_send("some_method")
|
28
|
+
# foo.__send__("some_#{variable}_method")
|
29
|
+
class AvoidObjectSendWithDynamicMethod < Base
|
30
|
+
MESSAGE_TEMPLATE = "Avoid using Object#%s with a dynamic method name."
|
31
|
+
SEND_METHODS = %i(send public_send __send__).freeze
|
32
|
+
CONSTANT_TYPES = %i(sym str const).freeze
|
33
|
+
|
34
|
+
def on_send(node)
|
35
|
+
return unless send_method?(node)
|
36
|
+
return if method_being_sent_is_constrained?(node)
|
37
|
+
add_offense(source_range_for_method_call(node), message: MESSAGE_TEMPLATE % node.method_name)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def send_method?(node)
|
43
|
+
SEND_METHODS.include?(node.method_name)
|
44
|
+
end
|
45
|
+
|
46
|
+
def method_being_sent_is_constrained?(node)
|
47
|
+
method_name_being_sent_is_constant?(node) || method_name_being_sent_is_dynamic_string_with_constants?(node)
|
48
|
+
end
|
49
|
+
|
50
|
+
def method_name_being_sent_is_constant?(node)
|
51
|
+
method_being_sent = node.arguments.first
|
52
|
+
# e.g., `worker.send(:perform)` or `base.send("extend", Foo)`
|
53
|
+
CONSTANT_TYPES.include?(method_being_sent.type)
|
54
|
+
end
|
55
|
+
|
56
|
+
def method_name_being_sent_is_dynamic_string_with_constants?(node)
|
57
|
+
method_being_sent = node.arguments.first
|
58
|
+
return false unless method_being_sent.type == :dstr
|
59
|
+
|
60
|
+
# e.g., `foo.send("can_#{action}?")`
|
61
|
+
method_being_sent.child_nodes.any? { |child_node| CONSTANT_TYPES.include?(child_node.type) }
|
62
|
+
end
|
63
|
+
|
64
|
+
def source_range_for_method_call(node)
|
65
|
+
begin_pos =
|
66
|
+
if node.receiver # e.g., for `foo.send(:bar)`, `foo` is the receiver
|
67
|
+
node.receiver.source_range.end_pos
|
68
|
+
else # e.g., `send(:bar)`
|
69
|
+
node.source_range.begin_pos
|
70
|
+
end
|
71
|
+
end_pos = node.loc.selector.end_pos
|
72
|
+
Parser::Source::Range.new(processed_source.buffer, begin_pos, end_pos)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -9,7 +9,7 @@ module RuboCop
|
|
9
9
|
class RailsControllerRenderLiteral < Base
|
10
10
|
include RenderLiteralHelpers
|
11
11
|
|
12
|
-
MSG = "render must be used with a string literal or an instance of a Class"
|
12
|
+
MSG = "render must be used with a string literal or an instance of a Class, and use literals for locals keys"
|
13
13
|
|
14
14
|
def_node_matcher :ignore_key?, <<-PATTERN
|
15
15
|
(pair (sym {
|
@@ -41,7 +41,8 @@ module RuboCop
|
|
41
41
|
PATTERN
|
42
42
|
|
43
43
|
def hash_with_literal_keys?(hash)
|
44
|
-
hash.
|
44
|
+
hash.children.all? { |child| child.pair_type? } &&
|
45
|
+
hash.pairs.all? { |pair| literal?(pair.key) }
|
45
46
|
end
|
46
47
|
|
47
48
|
def render_view_component?(node)
|
data/lib/rubocop-github.rb
CHANGED
data/lib/version.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description:
|
97
|
+
description: Code style checking for GitHub Ruby repositories
|
98
98
|
email: engineering@github.com
|
99
99
|
executables: []
|
100
100
|
extensions: []
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/rubocop-github-rails.rb
|
115
115
|
- lib/rubocop-github.rb
|
116
116
|
- lib/rubocop/cop/github.rb
|
117
|
+
- lib/rubocop/cop/github/avoid_object_send_with_dynamic_method.rb
|
117
118
|
- lib/rubocop/cop/github/insecure_hash_algorithm.rb
|
118
119
|
- lib/rubocop/cop/github/rails_controller_render_action_symbol.rb
|
119
120
|
- lib/rubocop/cop/github/rails_controller_render_literal.rb
|
@@ -126,10 +127,14 @@ files:
|
|
126
127
|
- lib/rubocop/cop/github/render_literal_helpers.rb
|
127
128
|
- lib/rubocop/github.rb
|
128
129
|
- lib/rubocop/github/inject.rb
|
130
|
+
- lib/version.rb
|
129
131
|
homepage: https://github.com/github/rubocop-github
|
130
132
|
licenses:
|
131
133
|
- MIT
|
132
|
-
metadata:
|
134
|
+
metadata:
|
135
|
+
source_code_uri: https://github.com/github/rubocop-github
|
136
|
+
documentation_uri: https://github.com/github/rubocop-github
|
137
|
+
bug_tracker_uri: https://github.com/github/rubocop-github/issues
|
133
138
|
post_install_message:
|
134
139
|
rdoc_options: []
|
135
140
|
require_paths:
|
@@ -138,14 +143,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
143
|
requirements:
|
139
144
|
- - ">="
|
140
145
|
- !ruby/object:Gem::Version
|
141
|
-
version:
|
146
|
+
version: 3.0.0
|
142
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
148
|
requirements:
|
144
149
|
- - ">="
|
145
150
|
- !ruby/object:Gem::Version
|
146
151
|
version: '0'
|
147
152
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
153
|
+
rubygems_version: 3.4.6
|
149
154
|
signing_key:
|
150
155
|
specification_version: 4
|
151
156
|
summary: RuboCop GitHub
|