rubocop-powerhome 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/CHANGELOG.md +33 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +43 -17
- data/config/default.yml +17 -0
- data/doc/dependency_decisions.yml +3 -0
- data/{README.md → docs/README.md} +0 -0
- data/lib/rubocop/cop/naming/view_component.rb +38 -0
- data/lib/rubocop/cop/naming_cops.rb +9 -0
- data/lib/rubocop/cop/style/no_helpers.rb +29 -0
- data/lib/rubocop/cop/style_cops.rb +9 -0
- data/lib/rubocop/powerhome/version.rb +1 -1
- data/lib/rubocop-powerhome.rb +3 -0
- data/mkdocs.yml +9 -0
- data/rubocop-powerhome.gemspec +5 -2
- metadata +39 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4767dc6020167a8b615233306ea599f1c4cf365fd98ea11754d6a2cdc24d2053
|
4
|
+
data.tar.gz: ecf9e2336b5f5c7e65b41e3de04d0b5aeec78e0f91d58b9508b93b79aef17173
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8034ef4be62dffc22cc653c6911f81a0cb2cddf3b0f93f380e8a5eabd214834c54c271829a415d005aa60ec55c146be1dfa68db5b1c3ec97cadb57d93ff1343b
|
7
|
+
data.tar.gz: 0b79e02933282bd833ee4f38aabe65034aa42e2fa8e19241d2eb4b94fc1f574cb2a81c8d76bd752dd28c2ccd5935e67430cbc0aafdfbd4ba49fe43782c55962e
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,36 @@
|
|
1
|
-
## [
|
1
|
+
## [0.5.0] - 2022-07-22
|
2
|
+
|
3
|
+
### Features
|
4
|
+
|
5
|
+
- Provide style guide references and helpful hints on violations. (#36)
|
6
|
+
- Ignore Metrics/BlockLength on Rspec's context and describe (#43)
|
7
|
+
|
8
|
+
### Documentation
|
9
|
+
- Fix rel links in README (#37)
|
10
|
+
- Initial portal setup (#34)
|
11
|
+
|
12
|
+
### Updates
|
13
|
+
- Lock file maintenance
|
14
|
+
- Update tj-actions/changed-files action to v24 (#47)
|
15
|
+
- Update dependency rubocop to ~> 1.32.0 (#46)
|
16
|
+
- Update dependency babel-eslint to v10 (#45)
|
17
|
+
- Update all non-major dependencies (#44)
|
18
|
+
- Update typescript-eslint monorepo to v5 (major) (#24)
|
19
|
+
- Update dependency eslint-webpack-plugin to v3 (#23)
|
20
|
+
- Update dependency eslint-plugin-jsx-control-statements to v3 (#22)
|
21
|
+
- Update dependency eslint-plugin-flowtype to v8 (#21)
|
22
|
+
- Update dependency babel-eslint to v10 (#19)
|
23
|
+
- Update all non-major dependencies (#16)
|
24
|
+
- Pin dependency babel-eslint to v (#15)
|
25
|
+
|
26
|
+
## [0.4.1] - 2022-06-02
|
27
|
+
|
28
|
+
- Fix bug in Naming/ViewComponent when class does not inherit
|
29
|
+
|
30
|
+
## [0.4.0] - 2022-06-01
|
31
|
+
|
32
|
+
- Adds Naming/ViewComponent cop
|
33
|
+
- Adds Style/NoHelpers cop
|
2
34
|
|
3
35
|
## [0.1.0] - 2022-05-18
|
4
36
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-powerhome (0.
|
4
|
+
rubocop-powerhome (0.5.0)
|
5
5
|
rubocop
|
6
6
|
rubocop-performance
|
7
7
|
rubocop-rails
|
@@ -11,24 +11,41 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activesupport (7.0.3)
|
14
|
+
activesupport (7.0.3.1)
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
16
|
i18n (>= 1.6, < 2)
|
17
17
|
minitest (>= 5.1)
|
18
18
|
tzinfo (~> 2.0)
|
19
19
|
ast (2.4.2)
|
20
|
+
byebug (11.1.3)
|
21
|
+
coderay (1.1.3)
|
20
22
|
concurrent-ruby (1.1.10)
|
21
23
|
diff-lcs (1.5.0)
|
22
|
-
i18n (1.
|
24
|
+
i18n (1.12.0)
|
23
25
|
concurrent-ruby (~> 1.0)
|
24
|
-
|
26
|
+
json (2.6.2)
|
27
|
+
license_finder (7.0.1)
|
28
|
+
bundler
|
29
|
+
rubyzip (>= 1, < 3)
|
30
|
+
thor (~> 1.2)
|
31
|
+
tomlrb (>= 1.3, < 2.1)
|
32
|
+
with_env (= 1.1.0)
|
33
|
+
xml-simple (~> 1.1.9)
|
34
|
+
method_source (1.0.0)
|
35
|
+
minitest (5.16.2)
|
25
36
|
parallel (1.22.1)
|
26
37
|
parser (3.1.2.0)
|
27
38
|
ast (~> 2.4.1)
|
28
|
-
|
39
|
+
pry (0.13.1)
|
40
|
+
coderay (~> 1.1)
|
41
|
+
method_source (~> 1.0)
|
42
|
+
pry-byebug (3.9.0)
|
43
|
+
byebug (~> 11.0)
|
44
|
+
pry (~> 0.13.0)
|
45
|
+
rack (2.2.4)
|
29
46
|
rainbow (3.1.1)
|
30
47
|
rake (13.0.6)
|
31
|
-
regexp_parser (2.
|
48
|
+
regexp_parser (2.5.0)
|
32
49
|
rexml (3.2.5)
|
33
50
|
rspec (3.11.0)
|
34
51
|
rspec-core (~> 3.11.0)
|
@@ -43,42 +60,51 @@ GEM
|
|
43
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
61
|
rspec-support (~> 3.11.0)
|
45
62
|
rspec-support (3.11.0)
|
46
|
-
rubocop (1.
|
63
|
+
rubocop (1.32.0)
|
64
|
+
json (~> 2.3)
|
47
65
|
parallel (~> 1.10)
|
48
66
|
parser (>= 3.1.0.0)
|
49
67
|
rainbow (>= 2.2.2, < 4.0)
|
50
68
|
regexp_parser (>= 1.8, < 3.0)
|
51
69
|
rexml (>= 3.2.5, < 4.0)
|
52
|
-
rubocop-ast (>= 1.
|
70
|
+
rubocop-ast (>= 1.19.1, < 2.0)
|
53
71
|
ruby-progressbar (~> 1.7)
|
54
72
|
unicode-display_width (>= 1.4.0, < 3.0)
|
55
|
-
rubocop-ast (1.
|
73
|
+
rubocop-ast (1.19.1)
|
56
74
|
parser (>= 3.1.1.0)
|
57
|
-
rubocop-performance (1.
|
75
|
+
rubocop-performance (1.14.3)
|
58
76
|
rubocop (>= 1.7.0, < 2.0)
|
59
77
|
rubocop-ast (>= 0.4.0)
|
60
|
-
rubocop-rails (2.
|
78
|
+
rubocop-rails (2.15.2)
|
61
79
|
activesupport (>= 4.2.0)
|
62
80
|
rack (>= 1.1)
|
63
81
|
rubocop (>= 1.7.0, < 2.0)
|
64
82
|
rubocop-rake (0.6.0)
|
65
83
|
rubocop (~> 1.0)
|
66
|
-
rubocop-rspec (2.
|
67
|
-
rubocop (~> 1.
|
68
|
-
rubocop-ast (>= 1.1.0)
|
84
|
+
rubocop-rspec (2.11.1)
|
85
|
+
rubocop (~> 1.19)
|
69
86
|
ruby-progressbar (1.11.0)
|
87
|
+
rubyzip (2.3.2)
|
88
|
+
thor (1.2.1)
|
89
|
+
tomlrb (2.0.3)
|
70
90
|
tzinfo (2.0.4)
|
71
91
|
concurrent-ruby (~> 1.0)
|
72
|
-
unicode-display_width (2.
|
92
|
+
unicode-display_width (2.2.0)
|
93
|
+
with_env (1.1.0)
|
94
|
+
xml-simple (1.1.9)
|
95
|
+
rexml
|
73
96
|
|
74
97
|
PLATFORMS
|
75
98
|
arm64-darwin-21
|
99
|
+
x86_64-darwin-21
|
76
100
|
x86_64-linux
|
77
101
|
|
78
102
|
DEPENDENCIES
|
103
|
+
license_finder (~> 7.0)
|
104
|
+
pry-byebug (= 3.9.0)
|
79
105
|
rake (~> 13.0)
|
80
106
|
rspec (~> 3.0)
|
81
|
-
rubocop (~> 1.
|
107
|
+
rubocop (~> 1.32.0)
|
82
108
|
rubocop-performance
|
83
109
|
rubocop-powerhome!
|
84
110
|
rubocop-rails
|
@@ -86,4 +112,4 @@ DEPENDENCIES
|
|
86
112
|
rubocop-rspec
|
87
113
|
|
88
114
|
BUNDLED WITH
|
89
|
-
2.3.
|
115
|
+
2.3.14
|
data/config/default.yml
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 2.7
|
3
3
|
NewCops: enable
|
4
|
+
DisplayStyleGuide: true
|
5
|
+
ExtraDetails: true
|
4
6
|
|
5
7
|
Gemspec/RequiredRubyVersion:
|
6
8
|
Enabled: false
|
@@ -24,6 +26,11 @@ Naming/MethodParameterName:
|
|
24
26
|
- in
|
25
27
|
- at
|
26
28
|
|
29
|
+
Naming/ViewComponent:
|
30
|
+
Description: 'This cop requires ViewComponent classes to end with Component in their classname.'
|
31
|
+
Enabled: true
|
32
|
+
VersionAdded: '0.4.0'
|
33
|
+
|
27
34
|
Rails:
|
28
35
|
Enabled: true
|
29
36
|
|
@@ -59,6 +66,11 @@ Style/HashTransformValues:
|
|
59
66
|
Style/Lambda:
|
60
67
|
EnforcedStyle: literal
|
61
68
|
|
69
|
+
Style/NoHelpers:
|
70
|
+
Description: 'This cop blocks global helper modules from existing in an application.'
|
71
|
+
Enabled: true
|
72
|
+
VersionAdded: '0.4.0'
|
73
|
+
|
62
74
|
Style/NumericPredicate:
|
63
75
|
Enabled: false
|
64
76
|
|
@@ -76,3 +88,8 @@ Style/TrailingCommaInArrayLiteral:
|
|
76
88
|
|
77
89
|
Style/TrailingCommaInHashLiteral:
|
78
90
|
EnforcedStyleForMultiline: comma
|
91
|
+
|
92
|
+
Metrics/BlockLength:
|
93
|
+
IgnoredMethods:
|
94
|
+
- describe
|
95
|
+
- context
|
File without changes
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Naming
|
6
|
+
# This cop requires ViewComponent classes to end with Component in their classname.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# # bad
|
10
|
+
# class Foo < ::ViewComponent::Base
|
11
|
+
# # ...
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# # good
|
15
|
+
# class FooComponent < ::ViewComponent::Base
|
16
|
+
# # ...
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
class ViewComponent < RuboCop::Cop::Cop
|
20
|
+
def on_class(node)
|
21
|
+
inheritance_klass = node.node_parts[1]&.source
|
22
|
+
return unless view_component_class?(inheritance_klass)
|
23
|
+
|
24
|
+
klass = node.node_parts[0]&.source
|
25
|
+
return if klass.end_with?("Component")
|
26
|
+
|
27
|
+
add_offense(node.node_parts[0], message: "End ViewComponent classnames with 'Component'")
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def view_component_class?(inheritance_klass)
|
33
|
+
inheritance_klass&.end_with?("::ApplicationComponent", "ViewComponent::Base")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Style
|
6
|
+
# This cop does not allow helpers to be placed in an application. View objects,
|
7
|
+
# specifically ViewComponent, create better Object Oriented design.
|
8
|
+
# Global helper methods tightly couple templates.
|
9
|
+
#
|
10
|
+
class NoHelpers < RuboCop::Cop::Cop
|
11
|
+
MSG = "Helpers create global view methods. Instead, use view objects to " \
|
12
|
+
"encapsulate your display logic."
|
13
|
+
|
14
|
+
def investigate(processed_source)
|
15
|
+
return if processed_source.blank?
|
16
|
+
return unless helper_path?
|
17
|
+
|
18
|
+
add_offense(processed_source.ast, message: format(MSG))
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def helper_path?
|
24
|
+
processed_source.file_path.include?("app/helpers/")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/rubocop-powerhome.rb
CHANGED
data/mkdocs.yml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
site_name: Rubocop Powerhome
|
2
|
+
site_description: Gem focused on providing standard Rubocop configuration for Power Home Remodeling ruby apps
|
3
|
+
repo_url: https://github.com/powerhome/power_linting
|
4
|
+
edit_uri: edit/main/rubocop_powerhome/docs/
|
5
|
+
nav:
|
6
|
+
- 'Home': 'README.md'
|
7
|
+
|
8
|
+
plugins:
|
9
|
+
- techdocs-core
|
data/rubocop-powerhome.gemspec
CHANGED
@@ -5,8 +5,8 @@ require_relative "lib/rubocop/powerhome/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rubocop-powerhome"
|
7
7
|
spec.version = RuboCop::Powerhome::VERSION
|
8
|
-
spec.authors = ["Carlos Palhares"]
|
9
|
-
spec.email = ["chjunior@gmail.com"]
|
8
|
+
spec.authors = ["Carlos Palhares", "Garett Arrowood"]
|
9
|
+
spec.email = ["chjunior@gmail.com", "garettarrowood@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = "Powerhome Rubocop standard rules"
|
12
12
|
spec.description = "Powerhome Rubocop standard rules"
|
@@ -41,4 +41,7 @@ Gem::Specification.new do |spec|
|
|
41
41
|
spec.add_runtime_dependency "rubocop-rake"
|
42
42
|
spec.add_runtime_dependency "rubocop-rspec"
|
43
43
|
spec.metadata["rubygems_mfa_required"] = "true"
|
44
|
+
|
45
|
+
spec.add_development_dependency "license_finder", "~> 7.0"
|
46
|
+
spec.add_development_dependency "pry-byebug", "3.9.0"
|
44
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-powerhome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Palhares
|
8
|
+
- Garett Arrowood
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2022-
|
12
|
+
date: 2022-07-22 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rubocop
|
@@ -80,9 +81,38 @@ dependencies:
|
|
80
81
|
- - ">="
|
81
82
|
- !ruby/object:Gem::Version
|
82
83
|
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: license_finder
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '7.0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '7.0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: pry-byebug
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 3.9.0
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 3.9.0
|
83
112
|
description: Powerhome Rubocop standard rules
|
84
113
|
email:
|
85
114
|
- chjunior@gmail.com
|
115
|
+
- garettarrowood@gmail.com
|
86
116
|
executables: []
|
87
117
|
extensions: []
|
88
118
|
extra_rdoc_files: []
|
@@ -92,13 +122,19 @@ files:
|
|
92
122
|
- Gemfile
|
93
123
|
- Gemfile.lock
|
94
124
|
- LICENSE.txt
|
95
|
-
- README.md
|
96
125
|
- Rakefile
|
97
126
|
- config/default.yml
|
127
|
+
- doc/dependency_decisions.yml
|
128
|
+
- docs/README.md
|
98
129
|
- lib/rubocop-powerhome.rb
|
130
|
+
- lib/rubocop/cop/naming/view_component.rb
|
131
|
+
- lib/rubocop/cop/naming_cops.rb
|
132
|
+
- lib/rubocop/cop/style/no_helpers.rb
|
133
|
+
- lib/rubocop/cop/style_cops.rb
|
99
134
|
- lib/rubocop/powerhome.rb
|
100
135
|
- lib/rubocop/powerhome/inject.rb
|
101
136
|
- lib/rubocop/powerhome/version.rb
|
137
|
+
- mkdocs.yml
|
102
138
|
- rubocop-powerhome.gemspec
|
103
139
|
- sig/rubocop/powerhome.rbs
|
104
140
|
homepage: https://github.com/powerhome/power_linting
|