standard-rails 0.2.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +38 -26
- data/README.md +12 -7
- data/config/base.yml +95 -801
- data/lib/standard/rails/load_rubocop_rails_without_the_monkey_patch.rb +9 -1
- data/lib/standard/rails/plugin.rb +24 -6
- data/lib/standard/rails/version.rb +1 -1
- metadata +5 -5
@@ -7,7 +7,7 @@
|
|
7
7
|
# of RuboCop built-in cops in this file, we need to monitor it for changes
|
8
8
|
# in rubocop-rails and keep it up to date.
|
9
9
|
#
|
10
|
-
# Last updated from rubocop-rails v2.
|
10
|
+
# Last updated from rubocop-rails v2.23.1
|
11
11
|
|
12
12
|
# frozen_string_literal: true
|
13
13
|
|
@@ -29,6 +29,14 @@ require require_path.join("rubocop/cop/rails_cops")
|
|
29
29
|
|
30
30
|
RuboCop::Cop::Style::HashExcept.minimum_target_ruby_version(2.0)
|
31
31
|
|
32
|
+
RuboCop::Cop::Style::InverseMethods.singleton_class.prepend(
|
33
|
+
Module.new do
|
34
|
+
def autocorrect_incompatible_with
|
35
|
+
super.push(RuboCop::Cop::Rails::NegateInclude)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
)
|
39
|
+
|
32
40
|
RuboCop::Cop::Style::MethodCallWithArgsParentheses.singleton_class.prepend(
|
33
41
|
Module.new do
|
34
42
|
def autocorrect_incompatible_with
|
@@ -5,6 +5,7 @@ module Standard
|
|
5
5
|
class Plugin < LintRoller::Plugin
|
6
6
|
def initialize(config)
|
7
7
|
@config = config
|
8
|
+
@merges_upstream_metadata = LintRoller::Support::MergesUpstreamMetadata.new
|
8
9
|
end
|
9
10
|
|
10
11
|
def about
|
@@ -26,18 +27,35 @@ module Standard
|
|
26
27
|
LintRoller::Rules.new(
|
27
28
|
type: :object,
|
28
29
|
config_format: :rubocop,
|
29
|
-
value:
|
30
|
+
value: without_extended_rule_configs(
|
31
|
+
rules_with_config_applied
|
32
|
+
)
|
30
33
|
)
|
31
34
|
end
|
32
35
|
|
33
36
|
private
|
34
37
|
|
35
38
|
def rules_with_config_applied
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
@merges_upstream_metadata.merge(
|
40
|
+
YAML.load_file(Pathname.new(__dir__).join("../../../config/base.yml")).tap do |rules|
|
41
|
+
if @config.key?("target_rails_version")
|
42
|
+
rules["AllCops"]["TargetRailsVersion"] = @config["target_rails_version"]
|
43
|
+
end
|
44
|
+
end,
|
45
|
+
YAML.load_file(Pathname.new(Gem.loaded_specs["rubocop-rails"].full_gem_path).join("config/default.yml"))
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
# rubocop-rails adds additional options to a couple out-of-the-box cops
|
50
|
+
# but Standard (1) doesn't enable these to begin with and (2) doesn't
|
51
|
+
# allow rules' configs to be edited once they are defined, so we'll just
|
52
|
+
# remove them here
|
53
|
+
#
|
54
|
+
# See: https://github.com/standardrb/standard-rails/issues/25#issuecomment-1881127173
|
55
|
+
def without_extended_rule_configs(rules)
|
56
|
+
rules.reject { |(name,_)|
|
57
|
+
["Style/InvertibleUnlessCondition", "Lint/SafeNavigationChain"].include?(name)
|
58
|
+
}.to_h
|
41
59
|
end
|
42
60
|
|
43
61
|
# This is not fantastic.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standard-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lint_roller
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.23.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.23.1
|
41
41
|
description:
|
42
42
|
email:
|
43
43
|
- searls@gmail.com
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
|
-
rubygems_version: 3.
|
85
|
+
rubygems_version: 3.4.21
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: A Standard plugin that adds Rails-specific rules to Standard
|