gl_rubocop 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +54 -0
- data/default.yml +6 -0
- data/gl_rubocop.gemspec +1 -1
- data/lib/gl_rubocop/gl_cops/unique_identifier.rb +6 -4
- data/lib/gl_rubocop/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c97906865d188f4a1807b324836b2c20f6dbd5f2cf334f3d50b825f33af1ee54
|
4
|
+
data.tar.gz: 6fa0cd4593fda7e991ce66656e14c9b4170244581a6acf285ea9e396ec27ec04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 723854e3cea8ca330f0a7a5314a4f8d509ab3fb05892d7d454ad29967e1c8e6b680d7057f10185089369cdb0eb35103ee57d7abdd06fe8dbc8cab78ff0ed9be3
|
7
|
+
data.tar.gz: 373d524cf7c4d8cc8b44d3cb4ec74ad68c25b474bb5782079d1da40ae1ed990fc9cb96c85dae14339cb0df37d427f7a8d80cbe102468add179acfcfc1ec5c3ff
|
data/README.md
CHANGED
@@ -1,2 +1,56 @@
|
|
1
1
|
# gl_rubocop
|
2
|
+
|
2
3
|
A shareable configuration of rules we use at Give Lively to lint our Ruby code.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'gl_rubocop', require: false
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
gem install gl_lint
|
23
|
+
```
|
24
|
+
|
25
|
+
And finally add this to the top of your project's RuboCop configuration file:
|
26
|
+
|
27
|
+
```yml
|
28
|
+
inherit_gem:
|
29
|
+
gl_rubocop: default.yml
|
30
|
+
```
|
31
|
+
|
32
|
+
Any `Include` or `Exclude` configuration provided will be merged with RuboCop's defaults.
|
33
|
+
|
34
|
+
For more information about inheriting configuration from a gem please check
|
35
|
+
[RuboCop's
|
36
|
+
documentation](https://docs.rubocop.org/rubocop/configuration.html#inheriting-configuration-from-a-dependency-gem).
|
37
|
+
|
38
|
+
## Making changes and publishing
|
39
|
+
|
40
|
+
1. As per our code agreements, all code changes to this gem are required to be made via pull request with final approval from at least one Give Lively engineer.
|
41
|
+
|
42
|
+
2. When creating a pull request, ensure that your code changes include an update to the gem's [version number](https://github.com/givelively/gl_rubocop/blob/main/lib/gl_rubocop/version.rb) using [semantic versioning](https://semver.org/)
|
43
|
+
|
44
|
+
3. After getting approval, merge your changes to `main`.
|
45
|
+
|
46
|
+
4. Once your CI build finishes sucessfully, pull the latest version of `main` locally.
|
47
|
+
|
48
|
+
5. Run the command `gem build`. This bundles the relevant files from the gem and prepares it to be published to [rubygems.org](https://rubygems.org/). (Note: if you are not one of the owners listed you may need to request that that this and the following step be completed by one of the gem owners listed in CODEOWNERS)
|
49
|
+
|
50
|
+
6. Once the bundle is successfully created there should be a new file created locally that looks like `gl_rubocop-<new_gem_version_number>.gem`.
|
51
|
+
|
52
|
+
7. Run the command `gem push gl_rubocop-<new_gem_version_number>.gem`.
|
53
|
+
|
54
|
+
8. Following the authorization prompts listed by the gem command.
|
55
|
+
|
56
|
+
9. Your changes have now been published to the rubygems registry.
|
data/default.yml
CHANGED
@@ -4,6 +4,7 @@ require:
|
|
4
4
|
- rubocop-rspec
|
5
5
|
- rubocop-magic_numbers
|
6
6
|
- rubocop-haml
|
7
|
+
- rubocop-rake
|
7
8
|
- ./lib/gl_rubocop/gl_cops/interactor_inherits_from_interactor_base.rb
|
8
9
|
- ./lib/gl_rubocop/gl_cops/callback_method_names.rb
|
9
10
|
- ./lib/gl_rubocop/gl_cops/prevent_erb_files.rb
|
@@ -157,6 +158,11 @@ Rails/FindEach:
|
|
157
158
|
Rails/I18nLocaleTexts:
|
158
159
|
Enabled: false
|
159
160
|
|
161
|
+
Rails/UnusedIgnoredColumns:
|
162
|
+
# This rule is incompatible with our split schema for datawarehouse models
|
163
|
+
# It is disabled by default in rubocop-rails
|
164
|
+
Enabled: false
|
165
|
+
|
160
166
|
Style/GlobalVars:
|
161
167
|
Exclude:
|
162
168
|
- 'spec/**/*'
|
data/gl_rubocop.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ['lib']
|
27
27
|
|
28
|
-
spec.add_dependency 'rubocop', '~> 1.62.
|
28
|
+
spec.add_dependency 'rubocop', '~> 1.62.1'
|
29
29
|
spec.add_dependency 'rubocop-haml', '~> 0.2.4'
|
30
30
|
spec.add_dependency 'rubocop-magic_numbers'
|
31
31
|
spec.add_dependency 'rubocop-performance'
|
@@ -4,10 +4,12 @@ module GLRubocop
|
|
4
4
|
# This cop ensures that view components include a data-test-id attribute.
|
5
5
|
#
|
6
6
|
# Good:
|
7
|
-
# {data-test-id:
|
7
|
+
# {data-test-id: 'unique-id'}
|
8
8
|
# {data-test-id: @unique_id }
|
9
|
-
# {'data-test-id':
|
9
|
+
# {'data-test-id': 'unique-id'}
|
10
10
|
# {"data-test-id": "unique-id"}
|
11
|
+
# {data: {test-id: 'unique-id'}}
|
12
|
+
# {data: {'test-id': 'unique-id'}}
|
11
13
|
#
|
12
14
|
# Bad:
|
13
15
|
# {data: {testId: "unique-id"}}
|
@@ -15,7 +17,7 @@ module GLRubocop
|
|
15
17
|
|
16
18
|
MSG = 'View components must include a data-test-id attribute'.freeze
|
17
19
|
EMPTY_MSG = 'data-test-id attribute must not be empty'.freeze
|
18
|
-
UNIQUE_IDENTIFIER = '
|
20
|
+
UNIQUE_IDENTIFIER = 'test-id'.freeze
|
19
21
|
|
20
22
|
def on_send(node)
|
21
23
|
return unless file_exists? && valid_method_name?(node)
|
@@ -42,7 +44,7 @@ module GLRubocop
|
|
42
44
|
|
43
45
|
def regex_for_indentifier_and_value
|
44
46
|
key = Regexp.quote(UNIQUE_IDENTIFIER)
|
45
|
-
/(
|
47
|
+
/(?:["']?data-#{key}["']?|data:.?\{["']?#{key}["']?):\s*(["']([^"']*)["']|@\w+)/
|
46
48
|
end
|
47
49
|
|
48
50
|
def test_id_value
|
data/lib/gl_rubocop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gl_rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Give Lively
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.62.
|
19
|
+
version: 1.62.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.62.
|
26
|
+
version: 1.62.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop-haml
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|