standard-rails 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab3080f565a9c7d7580405c2007ab6c06d1bea30f1e7dffd505d0ef9c0c390e6
4
- data.tar.gz: 77d4a5d0a5b645f86d3a13aa492eb2c7319989f515b25f06c125b689abff434b
3
+ metadata.gz: 0d8f82a084fe4ff317a8e3d62666fbaffc7ffe522aa07c7d79cad211cd545a81
4
+ data.tar.gz: 1826baad658442833a6ccbd87d201581f9cfb21e479046e8fb79deccbc1b23db
5
5
  SHA512:
6
- metadata.gz: fafc62eb0a95ff6eeb6c170218ac4297ccdba6187a6a741058fc777802542ca463f211faa44a6ccb8e019edecc117278799c1d87dcf3603a6a553102e6915a70
7
- data.tar.gz: e1ffb63b3a0d5419e975a63f6b2992e0211ba2e1bafc4b2f272b2ea9a64d0d3052495e83b22cc8c5bdaebec79fd41c67ac01cd38ff31b76cb771811dd8e2792f
6
+ metadata.gz: 7b1e95ca9e40fc91e4dc6ff21d5a5b59c65fdf3f8b1814444648f5147c171eb0b0be15d6b349e41d6e683487c61f3e4ccebbb20964cdb6c929c9c8c3f69f1ca2
7
+ data.tar.gz: c7353988d76a4bfb252395fd85960831750a07e899c0ae1f5b87c333ef5717d0755723e91cff1c6222439511cbba2dd969f7b9f6dff7e4c0791cc490f82afb5e
data/.standard.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  # For available configuration options, see:
2
2
  # https://github.com/testdouble/standard
3
- ruby_version: 2.6
3
+ ruby_version: 2.7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
- ## 0.0.1
1
+ ## [Unreleased]
2
2
 
3
- - Initial release. Doesn't actually exist as a plugin yet, but can be imported
4
- via `extend_config`. We don't recommend this, however, as all the values are
5
- currently set to rubocop-rails defaults!
3
+ ## [0.1.0]
4
+
5
+ - Configure the cops as agreed upon at RailsConf 2023
6
+
7
+ ## [0.0.1]
8
+
9
+ - Initial release
data/Gemfile CHANGED
@@ -1,8 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in standard-rails.gemspec
4
3
  gemspec
5
-
6
4
  gem "rake"
7
5
  gem "minitest"
8
6
  gem "standard"
7
+ gem "m"
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standard-rails (0.0.1)
5
- rubocop-rails (~> 2.18.0)
4
+ standard-rails (0.1.0)
5
+ lint_roller (~> 1.0)
6
+ rubocop-rails (~> 2.19.0)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
@@ -18,9 +19,14 @@ GEM
18
19
  concurrent-ruby (~> 1.0)
19
20
  json (2.6.3)
20
21
  language_server-protocol (3.17.0.3)
22
+ lint_roller (1.0.0)
23
+ m (1.6.1)
24
+ method_source (>= 0.6.7)
25
+ rake (>= 0.9.2.2)
26
+ method_source (1.0.0)
21
27
  minitest (5.18.0)
22
28
  parallel (1.22.1)
23
- parser (3.2.1.1)
29
+ parser (3.2.2.0)
24
30
  ast (~> 2.4.1)
25
31
  rack (3.0.7)
26
32
  rainbow (3.1.1)
@@ -37,32 +43,34 @@ GEM
37
43
  rubocop-ast (>= 1.26.0, < 2.0)
38
44
  ruby-progressbar (~> 1.7)
39
45
  unicode-display_width (>= 2.4.0, < 3.0)
40
- rubocop-ast (1.27.0)
46
+ rubocop-ast (1.28.0)
41
47
  parser (>= 3.2.1.0)
42
48
  rubocop-performance (1.16.0)
43
49
  rubocop (>= 1.7.0, < 2.0)
44
50
  rubocop-ast (>= 0.4.0)
45
- rubocop-rails (2.18.0)
51
+ rubocop-rails (2.19.1)
46
52
  activesupport (>= 4.2.0)
47
53
  rack (>= 1.1)
48
54
  rubocop (>= 1.33.0, < 2.0)
49
55
  ruby-progressbar (1.13.0)
50
- standard (1.25.2)
56
+ standard (1.26.0)
51
57
  language_server-protocol (~> 3.17.0.2)
52
- rubocop (= 1.48.1)
53
- rubocop-performance (= 1.16.0)
58
+ rubocop (~> 1.48.1)
59
+ rubocop-performance (~> 1.16.0)
54
60
  tzinfo (2.0.6)
55
61
  concurrent-ruby (~> 1.0)
56
62
  unicode-display_width (2.4.2)
57
63
 
58
64
  PLATFORMS
59
65
  arm64-darwin-22
66
+ x86_64-linux
60
67
 
61
68
  DEPENDENCIES
69
+ m
62
70
  minitest
63
71
  rake
64
72
  standard
65
73
  standard-rails!
66
74
 
67
75
  BUNDLED WITH
68
- 2.4.8
76
+ 2.4.10
data/README.md CHANGED
@@ -1,8 +1,35 @@
1
1
  # standard-rails
2
2
 
3
- This gem will be the first official plugin for the
4
- [standard](https://github.com/testdouble/standard) gem, which is a Ruby code
5
- linter and formatter.
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[test standard:fix]
53
+ task default: %i[copy_rubocop_rails_entry_point_and_comment_out_monkey_patch standard:fix test]