rf-stylez 0.2.19 → 0.2.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/lib/rf/stylez/version.rb +1 -1
- data/lib/rubocop/cop/lint/no_bang_state_machine_events.rb +36 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f947c02144438a08cc3a6ab32813f99efb017b1cb1269412fb03bf0ea36234b5
|
4
|
+
data.tar.gz: 017f553fc634999dd2d6fc69f47c17276079da327994ab9b17dba2f310804e6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eacbfc312c59943bd8a4636192c0fe5b31695bd2365cfed6a8f0fd35b3f08186c3a8c7ee0f6b2e260228ea2feda54b792f59d52310e64623ae5935c954e5ae0
|
7
|
+
data.tar.gz: 803c2bcefba0e7db0f579a22146006d95ccaa319c6f8acf920093442c505dcc7bab99620013f79a746c5b3081cb8f9802638ee85f28b2f5b0a10cde1a1df98c0
|
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
inherit_from: ./ruby/rubocop.yml
|
data/lib/rf/stylez/version.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Lint
|
6
|
+
# @example
|
7
|
+
# # bad - will define `!`-ended method that won't raise
|
8
|
+
# state_machine :state do
|
9
|
+
# event :started! do
|
10
|
+
# ...
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# # good
|
15
|
+
# state_machine :state do
|
16
|
+
# event :started do
|
17
|
+
# ...
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
class NoBangStateMachineEvents < Cop
|
21
|
+
MSG = 'Event names ending with a `!` define `!`-ended methods that do not raise'
|
22
|
+
|
23
|
+
def_node_matcher :is_state_machine_event?, '(send nil? :event (sym $_))'
|
24
|
+
def_node_matcher :is_state_machine?, '(block (send nil? :state_machine ...) ...)'
|
25
|
+
|
26
|
+
def on_send(node)
|
27
|
+
return unless (event_name = is_state_machine_event?(node))
|
28
|
+
return unless is_state_machine?(node.parent.parent)
|
29
|
+
return unless event_name.match?(/\w+!$/)
|
30
|
+
|
31
|
+
add_offense(node)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rf-stylez
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emanuel Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- ".circleci/config.yml"
|
105
105
|
- ".gitignore"
|
106
106
|
- ".rspec"
|
107
|
+
- ".rubocop.yml"
|
107
108
|
- ".travis.yml"
|
108
109
|
- Gemfile
|
109
110
|
- LICENSE
|
@@ -113,6 +114,7 @@ files:
|
|
113
114
|
- bin/setup
|
114
115
|
- lib/rf/stylez.rb
|
115
116
|
- lib/rf/stylez/version.rb
|
117
|
+
- lib/rubocop/cop/lint/no_bang_state_machine_events.rb
|
116
118
|
- lib/rubocop/cop/lint/no_env.rb
|
117
119
|
- lib/rubocop/cop/lint/no_grape_api.rb
|
118
120
|
- lib/rubocop/cop/lint/no_http_party.rb
|