standard-rspec 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,8 @@
1
1
  require "yaml"
2
+ require "rubocop-rspec"
3
+ require "rubocop-rspec_rails"
4
+ require "rubocop-capybara"
5
+ require "rubocop-factory_bot"
2
6
 
3
7
  module Standard
4
8
  module Rspec
@@ -17,48 +21,18 @@ module Standard
17
21
  end
18
22
 
19
23
  def rules(context)
20
- trick_rubocop_into_thinking_we_required_rubocop_rspec!
24
+ rules_value = begin
25
+ YAML.load_file(Pathname.new(__dir__).join("../../../config/base.yml"), aliases: true)
26
+ rescue ArgumentError
27
+ YAML.load_file(Pathname.new(__dir__).join("../../../config/base.yml"))
28
+ end
21
29
 
22
30
  LintRoller::Rules.new(
23
31
  type: :object,
24
32
  config_format: :rubocop,
25
- value: YAML.load_file(Pathname.new(__dir__).join("../../../config/base.yml"), aliases: true)
33
+ value: rules_value
26
34
  )
27
35
  end
28
-
29
- private
30
-
31
- # This is not fantastic.
32
- #
33
- # When you `require "rubocop-rspec"`, it will not only load the cops,
34
- # but it will also monkey-patch RuboCop's default_configuration, which is
35
- # something that can't be undone for the lifetime of the process.
36
- #
37
- # See: https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop-rspec.rb#L41
38
- #
39
- # As an alternative, standard-rspec loads the cops directly, and then
40
- # simply tells the RuboCop config loader that it's been loaded. This is
41
- # taking advantage of a private API of an `attr_reader` that probably wasn't
42
- # meant to be mutated externally, but it's better than the `Inject` monkey
43
- # patching that rubocop-rspec does (and many other RuboCop plugins do)
44
- def trick_rubocop_into_thinking_we_required_rubocop_rspec!
45
- without_warnings do
46
- require_relative "load_rubocop_rspec_without_the_monkey_patch"
47
- end
48
- RuboCop::ConfigLoader.default_configuration.loaded_features.add("rubocop-rspec")
49
- end
50
-
51
- # This is also not fantastic, but because loading RuboCop before loading
52
- # ActiveSupport will result in RuboCop redefining a number of ActiveSupport
53
- # methods like String#blank?, we need to suppress the warnings that are
54
- # emitted when we load the cops.
55
- def without_warnings(&blk)
56
- original_verbose = $VERBOSE
57
- $VERBOSE = nil
58
- yield
59
- ensure
60
- $VERBOSE = original_verbose
61
- end
62
36
  end
63
37
  end
64
38
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Standard
4
4
  module Rspec
5
- VERSION = "0.2.1"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
@@ -31,7 +31,9 @@ Gem::Specification.new do |spec|
31
31
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
32
  spec.require_paths = ["lib"]
33
33
 
34
- spec.add_dependency "lint_roller", "~> 1.0"
35
- spec.add_dependency "rubocop-rspec", "~> 2.22.0"
36
- spec.add_dependency "rubocop-factory_bot", "~> 2.22"
34
+ spec.add_dependency "lint_roller", ">= 1.0"
35
+ spec.add_dependency "rubocop-rspec", "~> 3.5"
36
+ spec.add_dependency "rubocop-factory_bot", "~> 2.27"
37
+ spec.add_dependency "rubocop-rspec_rails", "~> 2.31"
38
+ spec.add_dependency "rubocop-capybara", "~> 2.22"
37
39
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - shilin-anton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-11 00:00:00.000000000 Z
11
+ date: 2025-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lint_roller
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
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
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
@@ -30,16 +30,44 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.22.0
33
+ version: '3.5'
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.22.0
40
+ version: '3.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop-factory_bot
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.27'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.27'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-rspec_rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.31'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.31'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-capybara
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - "~>"
@@ -67,7 +95,6 @@ files:
67
95
  - config/base.yml
68
96
  - lib/standard-rspec.rb
69
97
  - lib/standard/rspec.rb
70
- - lib/standard/rspec/load_rubocop_rspec_without_the_monkey_patch.rb
71
98
  - lib/standard/rspec/plugin.rb
72
99
  - lib/standard/rspec/version.rb
73
100
  - standard-rspec.gemspec
@@ -94,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
121
  - !ruby/object:Gem::Version
95
122
  version: '0'
96
123
  requirements: []
97
- rubygems_version: 3.4.14
124
+ rubygems_version: 3.3.7
98
125
  signing_key:
99
126
  specification_version: 4
100
127
  summary: A Standard plugin that adds rubocop-rspec specific rules to Standard.
@@ -1,77 +0,0 @@
1
- # GENERATED FILE - DO NOT EDIT
2
- #
3
- # This file should look just like: https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop-rspec.rb
4
- # Except without the `Inject.defaults!` monkey patching.
5
- #
6
- # Because there are both necessary require statements and additional patching
7
- # of RuboCop built-in cops in this file, we need to monitor it for changes
8
- # in rubocop-rspec and keep it up to date.
9
- #
10
- # Last updated from rubocop-rspec v2.22.0
11
-
12
- # frozen_string_literal: true
13
-
14
- require "pathname"
15
- require "yaml"
16
-
17
- require "rubocop"
18
- require "rubocop-capybara"
19
- require "rubocop-factory_bot"
20
-
21
- require_path = Pathname.new(Gem.loaded_specs["rubocop-rspec"].full_require_paths.first)
22
- require require_path.join("rubocop/rspec")
23
- # require_relative 'rubocop/rspec/inject'
24
- require require_path.join("rubocop/rspec/language/node_pattern")
25
- require require_path.join("rubocop/rspec/node")
26
- require require_path.join("rubocop/rspec/version")
27
- require require_path.join("rubocop/rspec/wording")
28
-
29
- # Dependent on `RuboCop::RSpec::Language::NodePattern`.
30
- require require_path.join("rubocop/rspec/language")
31
-
32
- require require_path.join("rubocop/cop/rspec/mixin/final_end_location")
33
- require require_path.join("rubocop/cop/rspec/mixin/inside_example_group")
34
- require require_path.join("rubocop/cop/rspec/mixin/location_help")
35
- require require_path.join("rubocop/cop/rspec/mixin/metadata")
36
- require require_path.join("rubocop/cop/rspec/mixin/namespace")
37
- require require_path.join("rubocop/cop/rspec/mixin/skip_or_pending")
38
- require require_path.join("rubocop/cop/rspec/mixin/top_level_group")
39
- require require_path.join("rubocop/cop/rspec/mixin/variable")
40
-
41
- # Dependent on `RuboCop::Cop::RSpec::FinalEndLocation`.
42
- require require_path.join("rubocop/cop/rspec/mixin/comments_help")
43
- require require_path.join("rubocop/cop/rspec/mixin/empty_line_separation")
44
-
45
- require require_path.join("rubocop/cop/rspec/base")
46
- require require_path.join("rubocop/rspec/align_let_brace")
47
- require require_path.join("rubocop/rspec/concept")
48
- require require_path.join("rubocop/rspec/corrector/move_node")
49
- require require_path.join("rubocop/rspec/example")
50
- require require_path.join("rubocop/rspec/example_group")
51
- require require_path.join("rubocop/rspec/hook")
52
-
53
- # RuboCop::RSpec::Inject.defaults!
54
-
55
- require require_path.join("rubocop/cop/rspec_cops")
56
-
57
- # We have to register our autocorrect incompatibilities in RuboCop's cops
58
- # as well so we do not hit infinite loops
59
-
60
- RuboCop::Cop::Layout::ExtraSpacing.singleton_class.prepend(
61
- Module.new do
62
- def autocorrect_incompatible_with
63
- super.push(RuboCop::Cop::RSpec::AlignLeftLetBrace)
64
- .push(RuboCop::Cop::RSpec::AlignRightLetBrace)
65
- end
66
- end
67
- )
68
-
69
- RuboCop::Cop::Style::TrailingCommaInArguments.singleton_class.prepend(
70
- Module.new do
71
- def autocorrect_incompatible_with
72
- super.push(RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation)
73
- end
74
- end
75
- )
76
-
77
- RuboCop::AST::Node.include(RuboCop::RSpec::Node)