rubocul 2.0.1 → 4.0.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: 450941d4c06ce5d313e3f86d1b09b08ab08b3df23e6c6c70a141122504bac941
4
- data.tar.gz: 20120e021a893929d919cdf86376b717554f1fdf60ad84159f7cab1df85297f0
3
+ metadata.gz: 42e8f4ad2c719d37160b8dd9f14c7fbbf2a3f4fac6b2c11f3a9b31f4ae04940b
4
+ data.tar.gz: ed2cb2718291193ec8eea912aedc00f78ddfd15241a828f934a57f25fe5566cb
5
5
  SHA512:
6
- metadata.gz: 7291594ff302fe7d7b4f222994782ea9cae1f38f929a2b8754ec293a1d079c85b7776bc8d308cce0fc9057d414fb8b1ca9fe268974221c4e89636d3fb62e0d9a
7
- data.tar.gz: 379f38a6b19acadf599671008e9f86110ec2eecd9b4358dfbace92809010df8c496bcfbe8eb037bc157b335415ca919b432c6000b7237bbd60de2b610fe7b19c
6
+ metadata.gz: 90bd6f30944251d6a6f8178e5542299752b94fd7b6900eb2fd8ddde95fef7837e76c1565e2536e0740b94168e52673d32c766d6b70299e732395372ba60bb991
7
+ data.tar.gz: 77b4f3d4a23fc7055d1df9856efbd42aa7043c16b8be720db5eee9df32b05dc88ae9236b34756911a235d2810bd77d90f186de45dea2972ddbeec69618bb1473
data/README.md CHANGED
@@ -7,7 +7,7 @@ RuboCop defaults for Columbia University Libraries projects.
7
7
  Add this line to your Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'rubocul', '~> 2.0'
10
+ gem 'rubocul', '~> 4.0'
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -21,8 +21,8 @@ inherit_gem:
21
21
  rubocul: rubocul_default.yml
22
22
 
23
23
  AllCops:
24
- TargetRubyVersion: 2.5.3 # Update to your version of ruby
25
- TargetRailsVersion: 5.2.3 # Update to your version of rails
24
+ TargetRubyVersion: 3.1.0 # Update to your version of ruby
25
+ TargetRailsVersion: 7.0.1 # Update to your version of rails
26
26
  ```
27
27
 
28
28
  ## .rubocop_todo.yml
@@ -31,10 +31,11 @@ Understandably, it can be difficult to address all rubocop issues when adding ru
31
31
  ```
32
32
  rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 10000
33
33
  ```
34
- ## Versioning & Dependencies
35
-
36
- This project depends on `bixby`, which depends on `rubocop` and `rubocop-rspec`. `bixby` supports versions its dependent gems pessimistically. Therefore we also support version of `bixby` pessimistically. Once we get a release candidate we will match major version numbers with `bixby` major version numbers.
37
34
 
38
35
  ## Configuration Suggestion
39
36
 
40
- If a member of our team would like to suggest a change to our configuration, please open a github pull request with your change and an explanation of why you think it's necessary/valuable. Please add your new configuration to the `rubocop_default.yml` file.
37
+ If you'd like to propose a change to our configuration, please open a github pull request with the change (in rubocop_default, or the appropriate rubocup_rules_* file) with an explanation of why it would be useful.
38
+
39
+ ## Testing
40
+
41
+ Note that testing of custom rubocop rules is not currently set up for this gem, but is planned for the future. We have a test in the spec directory that we'll eventually want to run once tests are ready to go.
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module CUL
6
+ # Do not commit specs that call `page.save_screenshot`
7
+ class CapybaraScreenshots < RuboCop::Cop::Cop
8
+ MSG = 'Remove debugging/instrumentation such as `page#save_screenshot` before committing.'
9
+ # This cop uses a node matcher for matching node pattern.
10
+ # See https://github.com/rubocop/rubocop-ast/blob/master/docs/modules/ROOT/pages/node_pattern.adoc
11
+ #
12
+ # For example
13
+ def_node_matcher :called_forbidden_method?, <<-PATTERN
14
+ (send (send nil? :page) :save_screenshot)
15
+ PATTERN
16
+
17
+ def on_send(node)
18
+ return unless called_forbidden_method?(node)
19
+ add_offense(node, location: :expression, message: MSG)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'cul/capybara_screenshots'
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubocop'
4
+ require_relative 'cop/cul_cops'
data/rubocul.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'rubocul'
3
- spec.version = '2.0.1'
4
- spec.authors = ["Carla Galarza", "Eric O'Hanlon"]
3
+ spec.version = '4.0.0'
4
+ spec.authors = ["Eric O'Hanlon", "Ben Armintor", "Carla Galarza"]
5
5
 
6
6
  spec.summary = 'A style configuration for Rubocop'
7
7
  spec.description = 'Recommended Rubocop configuration for Ruby projects created by the Columbia University Libraries'
@@ -12,5 +12,10 @@ Gem::Specification.new do |spec|
12
12
 
13
13
  spec.add_development_dependency 'bundler', '~> 2.0'
14
14
 
15
- spec.add_dependency 'bixby', '2.0.0'
15
+ spec.add_dependency 'rubocop', '~> 1.25.1'
16
+ spec.add_dependency 'rubocop-ast'
17
+ spec.add_dependency 'rubocop-performance'
18
+ spec.add_dependency 'rubocop-rails'
19
+ spec.add_dependency 'rubocop-rspec'
20
+ spec.add_dependency 'rubocop-graphql'
16
21
  end
data/rubocul_default.yml CHANGED
@@ -1,35 +1,69 @@
1
- inherit_gem:
2
- bixby: bixby_default.yml
3
-
4
- inherit_mode:
5
- merge:
6
- - Exclude
1
+ require:
2
+ - rubocop-performance
3
+ - ./lib/rubocop/cul.rb
7
4
 
8
5
  AllCops:
6
+ TargetRubyVersion: 2.7
7
+ # Disable any new "pending" cops that are introduced in a minor version update of rubocop.
8
+ # We only want to opt into these explicitly, or accept them when we update to a new MAJOR
9
+ # version of rubocop. See: https://docs.rubocop.org/rubocop/versioning.html#pending-cops
10
+ NewCops: disable
11
+ # DisabledByDefault: true
12
+ DisplayCopNames: true
9
13
  Exclude:
10
- - 'app/javascript/**/*'
14
+ - 'db/**/*'
15
+ - 'script/**/*'
16
+ - 'bin/**/*'
17
+ - 'tmp/**/*'
18
+ - 'vendor/**/*'
11
19
  - 'node_modules/**/*'
20
+ - 'app/javascript/**/*'
12
21
 
13
- # Turning off until we can support multiple enforced styles (key and table). This is available in newer version of rubocop.
14
- Layout/AlignHash:
15
- Enabled: false
22
+ inherit_from:
23
+ - rubocul_rules_bundler.yml
24
+ - rubocul_rules_performance.yml
25
+ - rubocul_rules_rails.yml
26
+ - rubocul_rules_rspec.yml
27
+ - rubocul_rules_security.yml
16
28
 
17
- # In Rubocop 0.68 (a newer version than we're using right now), the IndentHash rule has been renamed to IndentFirstHashElement.
18
- Layout/IndentHash:
19
- EnforcedStyle: consistent
29
+ Layout/HashAlignment:
30
+ SupportedHashRocketStyles:
31
+ - key
32
+ - table
33
+ SupportedColonStyles:
34
+ - key
35
+ - table
20
36
 
21
- RSpec/MessageSpies:
37
+ Style/RedundantSelf:
22
38
  Enabled: false
23
39
 
40
+ Style/HashSyntax:
41
+ # We may change this at some point, but it'll take some getting used to. To be safe, we're
42
+ # forcing explicit hash literal values for now.
43
+ EnforcedShorthandSyntax: never
44
+
45
+ Layout/FirstHashElementIndentation:
46
+ EnforcedStyle: consistent
47
+
24
48
  Style/BlockDelimiters:
25
49
  EnforcedStyle: braces_for_chaining
26
50
 
27
- Style/RedundantSelf:
51
+ Style/ClassAndModuleChildren:
52
+ Enabled: false
53
+
54
+ Style/WordArray:
55
+ Enabled: false
56
+
57
+ Style/SymbolArray:
58
+ Enabled: false
59
+
60
+ RSpec/ExpectInHook:
28
61
  Enabled: false
29
62
 
30
63
  Metrics/BlockLength:
31
64
  Exclude:
32
65
  - 'spec/**/*'
33
66
 
34
- Rails/HasAndBelongsToMany:
67
+ # TODO: Decide how we feel about this later
68
+ Naming/VariableNumber:
35
69
  Enabled: false
@@ -0,0 +1,9 @@
1
+ Bundler/DuplicatedGem:
2
+ Include:
3
+ - '**/Gemfile'
4
+ - '**/gems.rb'
5
+
6
+ Bundler/OrderedGems:
7
+ Include:
8
+ - '**/Gemfile'
9
+ - '**/gems.rb'
@@ -0,0 +1,2 @@
1
+ require:
2
+ - rubocop-graphql
@@ -0,0 +1,2 @@
1
+ require:
2
+ - rubocop-performance
@@ -0,0 +1,8 @@
1
+ require:
2
+ - rubocop-rails
3
+
4
+ Rails:
5
+ Enabled: true
6
+
7
+ Rails/HasAndBelongsToMany:
8
+ Enabled: false
@@ -0,0 +1,2 @@
1
+ require:
2
+ - rubocop-rspec
@@ -0,0 +1,3 @@
1
+ Security/JSONLoad:
2
+ # See: https://github.com/samvera-labs/bixby/blob/f39116f714cf54880864960c22f2f937149f2f48/bixby_default.yml#L899-L900
3
+ AutoCorrect: false
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ require 'rubocop'
3
+ require 'rubocop/cul'
4
+
5
+ RSpec.describe RuboCop::Cop::CUL::CapybaraScreenshots do
6
+ subject(:cop) { described_class.new(config) }
7
+
8
+ let(:config) { RuboCop::Config.new }
9
+
10
+ # TODO: Write test code
11
+ #
12
+ # For example
13
+ it 'registers an offense when using calling `page#save_screenshot`' do
14
+ expect_offense(<<-RUBY.strip_indent)
15
+ page.save_screenshot
16
+ ^^^^^^^^^^^^^^^^^^^^ Remove debugging/instrumentation such as `page#save_screenshot` before committing.
17
+ RUBY
18
+ end
19
+
20
+ it 'does not register an offense when using `page#good_method`' do
21
+ expect_no_offenses(<<-RUBY.strip_indent)
22
+ page.good_method
23
+ RUBY
24
+ end
25
+ end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocul
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Carla Galarza
8
7
  - Eric O'Hanlon
8
+ - Ben Armintor
9
+ - Carla Galarza
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2021-04-05 00:00:00.000000000 Z
13
+ date: 2022-02-25 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: bundler
@@ -26,19 +27,89 @@ dependencies:
26
27
  - !ruby/object:Gem::Version
27
28
  version: '2.0'
28
29
  - !ruby/object:Gem::Dependency
29
- name: bixby
30
+ name: rubocop
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: 1.25.1
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: 1.25.1
43
+ - !ruby/object:Gem::Dependency
44
+ name: rubocop-ast
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: rubocop-performance
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ - !ruby/object:Gem::Dependency
72
+ name: rubocop-rails
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: rubocop-rspec
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ - !ruby/object:Gem::Dependency
100
+ name: rubocop-graphql
30
101
  requirement: !ruby/object:Gem::Requirement
31
102
  requirements:
32
- - - '='
103
+ - - ">="
33
104
  - !ruby/object:Gem::Version
34
- version: 2.0.0
105
+ version: '0'
35
106
  type: :runtime
36
107
  prerelease: false
37
108
  version_requirements: !ruby/object:Gem::Requirement
38
109
  requirements:
39
- - - '='
110
+ - - ">="
40
111
  - !ruby/object:Gem::Version
41
- version: 2.0.0
112
+ version: '0'
42
113
  description: Recommended Rubocop configuration for Ruby projects created by the Columbia
43
114
  University Libraries
44
115
  email:
@@ -51,8 +122,18 @@ files:
51
122
  - LICENSE
52
123
  - README.md
53
124
  - Rakefile
125
+ - lib/rubocop/cop/cul/capybara_screenshots.rb
126
+ - lib/rubocop/cop/cul_cops.rb
127
+ - lib/rubocop/cul.rb
54
128
  - rubocul.gemspec
55
129
  - rubocul_default.yml
130
+ - rubocul_rules_bundler.yml
131
+ - rubocul_rules_graphql.yml
132
+ - rubocul_rules_performance.yml
133
+ - rubocul_rules_rails.yml
134
+ - rubocul_rules_rspec.yml
135
+ - rubocul_rules_security.yml
136
+ - spec/rubocop/cop/cul/capybara_screenshots_spec.rb
56
137
  homepage: http://github.com/cul/rubocul
57
138
  licenses: []
58
139
  metadata: {}
@@ -71,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
152
  - !ruby/object:Gem::Version
72
153
  version: '0'
73
154
  requirements: []
74
- rubygems_version: 3.0.8
155
+ rubygems_version: 3.3.5
75
156
  signing_key:
76
157
  specification_version: 4
77
158
  summary: A style configuration for Rubocop