nxt_cop 2.3.0 → 2.4.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: 36425e542055540a840b751553cd953353fafe70dc6201101dfb5c72432cba54
4
- data.tar.gz: 14770d51c1893f141891cf0df314b5b0af32bbd5539a862ab0868b9bc7061729
3
+ metadata.gz: 2b196848eede14a56c47b9828efd5b5f6f5fb47f70cc259aa509536dd683e71e
4
+ data.tar.gz: e967860b4d70d8bd00abf0127c04216b61d216e71c8c1a631a055b83abd82957
5
5
  SHA512:
6
- metadata.gz: 0e1325eb79a605393bf2c985bade464459b6e035d57e8c5b3e02d638e28ff6f6f973f899ae5d006189d95216ce2908f2e2abf7db244617b33bf52bc6ed4538a0
7
- data.tar.gz: '008136f537dd440edb75742c3c1219180dd33cd745644fa1fc489b4fa2234b1d846e7668bf83c880152f8ee5bca671945dd8a6a39796d0986cfd0ca111e16e43'
6
+ metadata.gz: c81ef302a52a1acb9facb68fe1ec2a695ffaa28d95e5a671fc7ac3444304a43fc354172b72ae680a46ef90653b7ff37f7239ae4220e49a66afcd09e8bced84c4
7
+ data.tar.gz: 2419798b3be96e052a18cce5af279952015c00057ed66b02d9c987cb535ad4d5c58e4c24b836612ae34d474c927db976a74f170b2326c402949369675a51640f
@@ -0,0 +1,37 @@
1
+ # See https://circleci.com/docs/2.0/language-ruby/ for more details
2
+
3
+ version: 2.1
4
+
5
+ orbs:
6
+ ruby: circleci/ruby@2.0.1
7
+
8
+ jobs:
9
+ checks:
10
+ parallelism: 1
11
+ resource_class: small
12
+ docker:
13
+ - image: cimg/ruby:3.3.0
14
+ steps:
15
+ - checkout
16
+ - ruby/install-deps:
17
+ key: gems-v1
18
+ include-branch-in-cache-key: false
19
+ # - ruby/rubocop-check
20
+ - run:
21
+ name: RSpec Tests
22
+ command: |-
23
+ bundle exec rspec --format RspecJunitFormatter \
24
+ --out /tmp/test-results/rspec/results.xml --format progress
25
+ # actually not necessary for test results to be collected, but these files
26
+ # won't show up in the web UI otherwise
27
+ - store_artifacts:
28
+ path: /tmp/rspec/
29
+ destination: rspec
30
+ - store_test_results:
31
+ path: /tmp/rspec/
32
+
33
+ workflows:
34
+ version: 2
35
+ checks:
36
+ jobs:
37
+ - checks
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v2.4.0 2024-02-19
2
+ ## What's Changed
3
+ - Add tests for custom cops
4
+ - Removed `Rails/MissingLoggerInclude` due to maintenance burden
5
+
1
6
  # v2.3.0 2024-02-09
2
7
  ## What's Changed
3
8
  - Tree shake the config (no rules change)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nxt_cop (2.3.0)
4
+ nxt_cop (2.4.0)
5
5
  rubocop (~> 1.60.0)
6
6
  rubocop-rails (~> 2.8)
7
7
  rubocop-rspec (~> 2.12)
@@ -24,6 +24,7 @@ GEM
24
24
  bigdecimal (3.1.6)
25
25
  concurrent-ruby (1.2.3)
26
26
  connection_pool (2.4.1)
27
+ diff-lcs (1.5.1)
27
28
  drb (2.2.0)
28
29
  ruby2_keywords
29
30
  i18n (1.14.1)
@@ -42,6 +43,21 @@ GEM
42
43
  rake (13.1.0)
43
44
  regexp_parser (2.9.0)
44
45
  rexml (3.2.6)
46
+ rspec (3.13.0)
47
+ rspec-core (~> 3.13.0)
48
+ rspec-expectations (~> 3.13.0)
49
+ rspec-mocks (~> 3.13.0)
50
+ rspec-core (3.13.0)
51
+ rspec-support (~> 3.13.0)
52
+ rspec-expectations (3.13.0)
53
+ diff-lcs (>= 1.2.0, < 2.0)
54
+ rspec-support (~> 3.13.0)
55
+ rspec-mocks (3.13.0)
56
+ diff-lcs (>= 1.2.0, < 2.0)
57
+ rspec-support (~> 3.13.0)
58
+ rspec-support (3.13.0)
59
+ rspec_junit_formatter (0.6.0)
60
+ rspec-core (>= 2, < 4, != 2.12.0)
45
61
  rubocop (1.60.2)
46
62
  json (~> 2.3)
47
63
  language_server-protocol (>= 3.17.0)
@@ -81,6 +97,8 @@ DEPENDENCIES
81
97
  bundler (~> 2.1)
82
98
  nxt_cop!
83
99
  rake (~> 13.0)
100
+ rspec
101
+ rspec_junit_formatter
84
102
 
85
103
  BUNDLED WITH
86
104
  2.1.4
data/default.yml CHANGED
@@ -3,7 +3,6 @@ require:
3
3
  - rubocop-rails
4
4
  - rubocop-rspec
5
5
  - ./custom_cops/nxt_core/rails/use_of_rails_logger.rb
6
- - ./custom_cops/nxt_core/rails/missing_logger_include.rb
7
6
 
8
7
  inherit_mode:
9
8
  merge:
@@ -12,9 +11,6 @@ inherit_mode:
12
11
 
13
12
  Rails/UseOfRailsLogger:
14
13
  Description: "Custom Getsafe cop to ensure the correct logger is used"
15
- Rails/MissingLoggerInclude:
16
- Description: "Custom Getsafe cop to find missing `include` statements when using our custom logger"
17
- SafeAutoCorrect: false
18
14
 
19
15
  AllCops:
20
16
  Exclude:
@@ -1,3 +1,3 @@
1
1
  module NxtCop
2
- VERSION = '2.3.0'.freeze
2
+ VERSION = '2.4.0'.freeze
3
3
  end
data/nxt_cop.gemspec CHANGED
@@ -38,4 +38,6 @@ Gem::Specification.new do |spec|
38
38
  spec.add_dependency 'rubocop-rspec', '~> 2.12'
39
39
  spec.add_development_dependency 'bundler', '~> 2.1'
40
40
  spec.add_development_dependency 'rake', '~> 13.0'
41
+ spec.add_development_dependency 'rspec'
42
+ spec.add_development_dependency 'rspec_junit_formatter'
41
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nxt_cop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Livingstone
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-14 00:00:00.000000000 Z
11
+ date: 2024-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -80,13 +80,43 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '13.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec_junit_formatter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  description:
84
112
  email:
85
113
  executables: []
86
114
  extensions: []
87
115
  extra_rdoc_files: []
88
116
  files:
117
+ - ".circleci/config.yml"
89
118
  - ".gitignore"
119
+ - ".rspec"
90
120
  - ".rubocop.yml"
91
121
  - ".ruby-version"
92
122
  - ".tool-versions"
@@ -100,7 +130,6 @@ files:
100
130
  - bin/guard
101
131
  - bin/rspec
102
132
  - bin/setup
103
- - custom_cops/nxt_core/rails/missing_logger_include.rb
104
133
  - custom_cops/nxt_core/rails/use_of_rails_logger.rb
105
134
  - default.yml
106
135
  - lib/nxt_cop/version.rb
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module CustomCops
4
- module NxtCore
5
- module Rails
6
- # The NxtCore logger requires an include in most cases. Ensures it is present.
7
- #
8
- # @safety
9
- # This cop's autocorrection is unsafe because
10
- # `logger` may refer to an instance variable or other method of the class.
11
- class MissingLoggerInclude < RuboCop::Cop::Base
12
- extend RuboCop::Cop::AutoCorrector
13
-
14
- RESTRICT_ON_SEND = [:logger].freeze
15
-
16
- MSG = 'Missing `include Nxt::Loggable` for a class which uses the logger.'
17
-
18
- # NodePattern docs: https://github.com/rubocop/rubocop-ast/blob/master/docs/modules/ROOT/pages/node_pattern.adoc
19
- def_node_matcher :includes_nxt_loggable?, <<~PATTERN
20
- (begin <(send nil? :include (const (const nil? :Nxt) :Loggable)) ...>)
21
- PATTERN
22
-
23
- def on_send(node)
24
- return unless node.receiver.nil?
25
-
26
- class_node = node.ancestors.find(&:class_type?)
27
- return unless class_node
28
-
29
- class_definition_node = class_node.each_child_node(:begin).first
30
- return if includes_nxt_loggable?(class_definition_node)
31
-
32
- add_offense(class_node, message: MSG) do |corrector|
33
- corrector.insert_before(class_definition_node.child_nodes.first, "include Nxt::Loggable\n")
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end