rubocul 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/rubocop/cop/cul/capybara_screenshots.rb +24 -0
- data/lib/rubocop/cop/cul_cops.rb +3 -0
- data/lib/rubocop/cul.rb +4 -0
- data/rubocul.gemspec +2 -2
- data/rubocul_default.yml +3 -0
- data/spec/rubocop/cop/cul/capybara_screenshots_spec.rb +25 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5272e1b0c785ffbd90df920558e8437537698494f99a653148d164cca52a7b7
|
4
|
+
data.tar.gz: a0ed2e74521e3fd37bb4d52d9616498d6f04f83d8f5d9a69cdb597bb2d8d7d1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08694ca5aee43a0db0343cfce44f08da39562a51c8b60323d60d5bdd11e0e1426c96ce9d484e39503c09ac3440ead6c4e01c2f945c88ec0eb578362f8a0a2816'
|
7
|
+
data.tar.gz: 2d341f83feb549e1a3dedb21c37701eb4919ecc0745714c06821e91a29ffc023b40dfa0b6ae164223688d5af349be82a2e37819273b58ace5fa22f1e9a8536c7
|
data/README.md
CHANGED
@@ -38,3 +38,7 @@ This project depends on `bixby`, which depends on `rubocop` and `rubocop-rspec`.
|
|
38
38
|
## Configuration Suggestion
|
39
39
|
|
40
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.
|
41
|
+
|
42
|
+
## Testing
|
43
|
+
|
44
|
+
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
|
data/lib/rubocop/cul.rb
ADDED
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.
|
4
|
-
spec.authors = ["Carla Galarza", "Eric O'Hanlon"]
|
3
|
+
spec.version = '2.0.2'
|
4
|
+
spec.authors = ["Carla Galarza", "Eric O'Hanlon", "Ben Armintor"]
|
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'
|
data/rubocul_default.yml
CHANGED
@@ -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.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carla Galarza
|
8
8
|
- Eric O'Hanlon
|
9
|
+
- Ben Armintor
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2021-
|
13
|
+
date: 2021-09-15 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: bundler
|
@@ -51,8 +52,12 @@ files:
|
|
51
52
|
- LICENSE
|
52
53
|
- README.md
|
53
54
|
- Rakefile
|
55
|
+
- lib/rubocop/cop/cul/capybara_screenshots.rb
|
56
|
+
- lib/rubocop/cop/cul_cops.rb
|
57
|
+
- lib/rubocop/cul.rb
|
54
58
|
- rubocul.gemspec
|
55
59
|
- rubocul_default.yml
|
60
|
+
- spec/rubocop/cop/cul/capybara_screenshots_spec.rb
|
56
61
|
homepage: http://github.com/cul/rubocul
|
57
62
|
licenses: []
|
58
63
|
metadata: {}
|