standard-rails 0.0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.standard.yml +1 -1
- data/CHANGELOG.md +10 -4
- data/Gemfile +1 -2
- data/Gemfile.lock +42 -20
- data/README.md +31 -3
- data/Rakefile +42 -1
- data/config/base.yml +483 -115
- data/lib/standard/rails/load_rubocop_rails_without_the_monkey_patch.rb +46 -0
- data/lib/standard/rails/plugin.rb +76 -0
- data/lib/standard/rails/version.rb +1 -1
- data/lib/standard/rails.rb +3 -7
- data/lib/standard-rails.rb +1 -0
- metadata +24 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 652768c12a7064d7e370409ff8a9efd695a8b890fadd85191a88374d3fc93819
|
4
|
+
data.tar.gz: 217a54e55bfad2efaa9732b1d04025ce64d3da1c932239b209bc6ae391b6a06b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f04acf06d0e03e96bbdbd4c5ef84e71ff5d03f663e7e97abf9752b1e9ea7a8502b5599487f210216a5f3c93e9f417509ebc805c419d9ba47e5c741fc9e465018
|
7
|
+
data.tar.gz: 104b2c885ec6f826175f08d11da339ef23d22230ad8a33cbe88d75cc448b7a6479e2754486469d528f3219ec98d6a9c26000734a0b067405069a28e66fb484e4
|
data/.standard.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
-
## 0.0
|
1
|
+
## [0.2.0]
|
2
2
|
|
3
|
-
-
|
4
|
-
|
5
|
-
|
3
|
+
- Update Rubocop Rails to [v2.20.2](https://github.com/rubocop/rubocop-rails/releases/tag/v2.20.2)
|
4
|
+
|
5
|
+
## [0.1.0]
|
6
|
+
|
7
|
+
- Configure the cops as agreed upon at RailsConf 2023
|
8
|
+
|
9
|
+
## [0.0.1]
|
10
|
+
|
11
|
+
- Initial release
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,68 +1,90 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
standard-rails (0.0
|
5
|
-
|
4
|
+
standard-rails (0.2.0)
|
5
|
+
lint_roller (~> 1.0)
|
6
|
+
rubocop-rails (~> 2.20.2)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
activesupport (7.0.
|
11
|
+
activesupport (7.0.7.2)
|
11
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
13
|
i18n (>= 1.6, < 2)
|
13
14
|
minitest (>= 5.1)
|
14
15
|
tzinfo (~> 2.0)
|
15
16
|
ast (2.4.2)
|
17
|
+
base64 (0.1.1)
|
16
18
|
concurrent-ruby (1.2.2)
|
17
|
-
i18n (1.
|
19
|
+
i18n (1.14.1)
|
18
20
|
concurrent-ruby (~> 1.0)
|
19
21
|
json (2.6.3)
|
20
22
|
language_server-protocol (3.17.0.3)
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
lint_roller (1.1.0)
|
24
|
+
m (1.6.1)
|
25
|
+
method_source (>= 0.6.7)
|
26
|
+
rake (>= 0.9.2.2)
|
27
|
+
method_source (1.0.0)
|
28
|
+
minitest (5.20.0)
|
29
|
+
parallel (1.23.0)
|
30
|
+
parser (3.2.2.3)
|
24
31
|
ast (~> 2.4.1)
|
25
|
-
|
32
|
+
racc
|
33
|
+
racc (1.7.1)
|
34
|
+
rack (3.0.8)
|
26
35
|
rainbow (3.1.1)
|
27
36
|
rake (13.0.6)
|
28
|
-
regexp_parser (2.
|
29
|
-
rexml (3.2.
|
30
|
-
rubocop (1.
|
37
|
+
regexp_parser (2.8.1)
|
38
|
+
rexml (3.2.6)
|
39
|
+
rubocop (1.56.2)
|
40
|
+
base64 (~> 0.1.1)
|
31
41
|
json (~> 2.3)
|
42
|
+
language_server-protocol (>= 3.17.0)
|
32
43
|
parallel (~> 1.10)
|
33
|
-
parser (>= 3.2.
|
44
|
+
parser (>= 3.2.2.3)
|
34
45
|
rainbow (>= 2.2.2, < 4.0)
|
35
46
|
regexp_parser (>= 1.8, < 3.0)
|
36
47
|
rexml (>= 3.2.5, < 4.0)
|
37
|
-
rubocop-ast (>= 1.
|
48
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
38
49
|
ruby-progressbar (~> 1.7)
|
39
50
|
unicode-display_width (>= 2.4.0, < 3.0)
|
40
|
-
rubocop-ast (1.
|
51
|
+
rubocop-ast (1.29.0)
|
41
52
|
parser (>= 3.2.1.0)
|
42
|
-
rubocop-performance (1.
|
53
|
+
rubocop-performance (1.19.0)
|
43
54
|
rubocop (>= 1.7.0, < 2.0)
|
44
55
|
rubocop-ast (>= 0.4.0)
|
45
|
-
rubocop-rails (2.
|
56
|
+
rubocop-rails (2.20.2)
|
46
57
|
activesupport (>= 4.2.0)
|
47
58
|
rack (>= 1.1)
|
48
59
|
rubocop (>= 1.33.0, < 2.0)
|
49
60
|
ruby-progressbar (1.13.0)
|
50
|
-
standard (1.
|
61
|
+
standard (1.31.0)
|
51
62
|
language_server-protocol (~> 3.17.0.2)
|
52
|
-
|
53
|
-
rubocop
|
63
|
+
lint_roller (~> 1.0)
|
64
|
+
rubocop (~> 1.56.0)
|
65
|
+
standard-custom (~> 1.0.0)
|
66
|
+
standard-performance (~> 1.2)
|
67
|
+
standard-custom (1.0.2)
|
68
|
+
lint_roller (~> 1.0)
|
69
|
+
rubocop (~> 1.50)
|
70
|
+
standard-performance (1.2.0)
|
71
|
+
lint_roller (~> 1.1)
|
72
|
+
rubocop-performance (~> 1.19.0)
|
54
73
|
tzinfo (2.0.6)
|
55
74
|
concurrent-ruby (~> 1.0)
|
56
75
|
unicode-display_width (2.4.2)
|
57
76
|
|
58
77
|
PLATFORMS
|
78
|
+
arm64-darwin-20
|
59
79
|
arm64-darwin-22
|
80
|
+
x86_64-linux
|
60
81
|
|
61
82
|
DEPENDENCIES
|
83
|
+
m
|
62
84
|
minitest
|
63
85
|
rake
|
64
86
|
standard
|
65
87
|
standard-rails!
|
66
88
|
|
67
89
|
BUNDLED WITH
|
68
|
-
2.4.
|
90
|
+
2.4.10
|
data/README.md
CHANGED
@@ -1,8 +1,35 @@
|
|
1
1
|
# standard-rails
|
2
2
|
|
3
|
-
This gem
|
4
|
-
|
5
|
-
|
3
|
+
This gem provides a [lint_roller](https://github.com/standardrb/lint_roller)
|
4
|
+
plugin configuration for the
|
5
|
+
[rubocop-rails](https://github.com/rubocop/rubocop-rails) ruleset, for use
|
6
|
+
as an extension to the [Standard Ruby
|
7
|
+
gem](https://github.com/standardrb/standard).
|
8
|
+
|
9
|
+
To install it, you'll want to start by adding it to your Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem "standard-rails"
|
13
|
+
```
|
14
|
+
|
15
|
+
## Configuration
|
16
|
+
|
17
|
+
In your `.standard.yml` file, you can simply list `standard-rails` as a plugin:
|
18
|
+
|
19
|
+
```yaml
|
20
|
+
plugins:
|
21
|
+
- standard-rails
|
22
|
+
```
|
23
|
+
|
24
|
+
Even though it'll usually be inferred automatically, you can specify the exact
|
25
|
+
version of Rails you want the rules to run against by converting the string to
|
26
|
+
a nested hash:
|
27
|
+
|
28
|
+
```yaml
|
29
|
+
plugins:
|
30
|
+
- standard-rails:
|
31
|
+
target_rails_version: 7.0
|
32
|
+
```
|
6
33
|
|
7
34
|
## Code of Conduct
|
8
35
|
|
@@ -12,3 +39,4 @@ including (but not limited to) one-on-one communications, public posts/comments,
|
|
12
39
|
code reviews, pull requests, and GitHub issues. If violations occur, Test Double
|
13
40
|
will take any action they deem appropriate for the infraction, up to and
|
14
41
|
including blocking a user from the organization's repositories.
|
42
|
+
|
data/Rakefile
CHANGED
@@ -7,6 +7,47 @@ Rake::TestTask.new(:test) do |t|
|
|
7
7
|
t.test_files = FileList["test/**/*_test.rb"]
|
8
8
|
end
|
9
9
|
|
10
|
+
task :copy_rubocop_rails_entry_point_and_comment_out_monkey_patch do
|
11
|
+
gem_spec = Gem.loaded_specs["rubocop-rails"]
|
12
|
+
gem_require_path = Pathname.new(gem_spec.full_require_paths.first)
|
13
|
+
entry_point_contents = File.read(gem_require_path.join("rubocop-rails.rb"))
|
14
|
+
already_printed_load_path_veriable = false
|
15
|
+
entry_point_without_monkey_patch = entry_point_contents.split("\n").map { |line|
|
16
|
+
if line.include?("Inject.defaults!") || line.include?("rails/inject")
|
17
|
+
line.prepend("# ")
|
18
|
+
elsif line.include?("require_relative")
|
19
|
+
relative_path = line.match(/require_relative ['"](.*)['"]/)[1]
|
20
|
+
|
21
|
+
if !already_printed_load_path_veriable
|
22
|
+
already_printed_load_path_veriable = true
|
23
|
+
[
|
24
|
+
"require_path = Pathname.new(Gem.loaded_specs[\"rubocop-rails\"].full_require_paths.first)",
|
25
|
+
"require require_path.join(#{relative_path.inspect})"
|
26
|
+
]
|
27
|
+
else
|
28
|
+
"require require_path.join(#{relative_path.inspect})"
|
29
|
+
end
|
30
|
+
else
|
31
|
+
line
|
32
|
+
end
|
33
|
+
}.flatten.join("\n")
|
34
|
+
|
35
|
+
File.write "lib/standard/rails/load_rubocop_rails_without_the_monkey_patch.rb", <<~RUBY
|
36
|
+
# GENERATED FILE - DO NOT EDIT
|
37
|
+
#
|
38
|
+
# This file should look just like: https://github.com/rubocop/rubocop-rails/blob/master/lib/rubocop-rails.rb
|
39
|
+
# Except without the `Inject.defaults!` monkey patching.
|
40
|
+
#
|
41
|
+
# Because there are both necessary require statements and additional patching
|
42
|
+
# of RuboCop built-in cops in this file, we need to monitor it for changes
|
43
|
+
# in rubocop-rails and keep it up to date.
|
44
|
+
#
|
45
|
+
# Last updated from #{gem_spec.name} v#{gem_spec.version}
|
46
|
+
|
47
|
+
#{entry_point_without_monkey_patch}
|
48
|
+
RUBY
|
49
|
+
end
|
50
|
+
|
10
51
|
require "standard/rake"
|
11
52
|
|
12
|
-
task default: %i[
|
53
|
+
task default: %i[copy_rubocop_rails_entry_point_and_comment_out_monkey_patch standard:fix test]
|