rf-stylez 0.2.11 → 0.2.12
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +20 -2
- data/lib/rf/stylez/version.rb +1 -1
- data/lib/rubocop/cop/lint/no_http_party.rb +2 -8
- data/lib/rubocop/cop/lint/obscure.rb +44 -0
- data/rf-stylez.gemspec +1 -0
- data/ruby/rubocop.yml +2 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7df6e0db6c26722063fd17eaeba95892bdc7a83a3f9157f246f91aeea104d671
|
4
|
+
data.tar.gz: a0b68384bc85436ed593a5fbbe734896b08498ea50d0d35fc6be1bc1e6af5c87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: beb10f74bd156bc68abfb38bff258f483842fe115b9de58b1c8f641a032f121fbc3eb10400941ecf45845b3d5899cfc087bd1ec4e5d58fc9c5c3059ae3f9c611
|
7
|
+
data.tar.gz: 288d7639d488622900c7a801350120aed9a88825d4215386df27242e68774e67a37e0e666ad83969df40e5f313bce9223df7946a63a4ae35a57f08b8862bcc85
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -4,5 +4,23 @@ This is a place for style configurations for [Rainforest QA](https://www.rainfor
|
|
4
4
|
|
5
5
|
### Releasing
|
6
6
|
|
7
|
-
- Make sure
|
8
|
-
- `
|
7
|
+
- Make sure your changes are merged into `master` and...
|
8
|
+
- that `VERSION` in `lib/rf/stylez/version.rb` file is updated
|
9
|
+
- pull latest master
|
10
|
+
- run `rake release:source_control_push`
|
11
|
+
- CI/CD will take care of releasing rf-stylez to rubygems
|
12
|
+
|
13
|
+
## Adding `rf-stylez` to a new project
|
14
|
+
|
15
|
+
Create a `.rubocop.yml` in the root project directory and paste the following:
|
16
|
+
```yml
|
17
|
+
inherit_gem:
|
18
|
+
rf-stylez: ruby/rubocop.yml
|
19
|
+
Style/HashSyntax:
|
20
|
+
Enabled: true
|
21
|
+
```
|
22
|
+
|
23
|
+
To use it install rubocop and rf-stylez locally:
|
24
|
+
```bash
|
25
|
+
gem install rf-stylez
|
26
|
+
```
|
data/lib/rf/stylez/version.rb
CHANGED
@@ -5,16 +5,10 @@ module RuboCop
|
|
5
5
|
module Lint
|
6
6
|
# @example
|
7
7
|
# # bad
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# # bad
|
11
|
-
# ENV.fetch(..)
|
12
|
-
#
|
13
|
-
# # good
|
14
|
-
# GetEnv[]
|
8
|
+
# HTTParty.get(..)
|
15
9
|
#
|
16
10
|
# # good
|
17
|
-
#
|
11
|
+
# TimedRequest.get(...)
|
18
12
|
class NoHTTParty < Cop
|
19
13
|
MSG = 'Prefer `TimedRequest` instead of raw `HTTParty` calls.'.freeze
|
20
14
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Custom rubocop to warn against using obscure Ruby language features as
|
4
|
+
# defined in our internal Ruby coding standards
|
5
|
+
# https://paper.dropbox.com/doc/Coding-Standards-for-Ruby-gV22vwXEHhE5Ahsb1r06c
|
6
|
+
module RuboCop
|
7
|
+
module Cop
|
8
|
+
module Lint
|
9
|
+
# @example
|
10
|
+
# # bad
|
11
|
+
# if (a...b)
|
12
|
+
#
|
13
|
+
# # bad
|
14
|
+
# if (a..b)
|
15
|
+
#
|
16
|
+
# https://ruby-doc.org/core-2.4.0/doc/syntax/control_expressions_rdoc.html#label-Flip-Flop
|
17
|
+
#
|
18
|
+
# # bad
|
19
|
+
# "%s" % "string"
|
20
|
+
#
|
21
|
+
# https://ruby-doc.org/core-2.4.0/String.html#method-i-25
|
22
|
+
class Obscure < Cop
|
23
|
+
MSG = 'Do not use the flipflop operator'.freeze
|
24
|
+
|
25
|
+
def_node_matcher :is_stringformat?, <<-PATTERN
|
26
|
+
(send {str dstr} $:% ...)
|
27
|
+
PATTERN
|
28
|
+
|
29
|
+
def on_iflipflop(node)
|
30
|
+
add_offense(node)
|
31
|
+
end
|
32
|
+
|
33
|
+
def on_eflipflop(node)
|
34
|
+
add_offense(node)
|
35
|
+
end
|
36
|
+
|
37
|
+
def on_send(node)
|
38
|
+
return unless is_stringformat?(node)
|
39
|
+
add_offense(node, message: 'Do not use String#%')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/rf-stylez.gemspec
CHANGED
data/ruby/rubocop.yml
CHANGED
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.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emanuel Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: Configurations for Rubocop and other style enforcers/linters
|
70
84
|
email:
|
71
85
|
- emanuel@rainforestqa.com
|
@@ -87,6 +101,7 @@ files:
|
|
87
101
|
- lib/rf/stylez/version.rb
|
88
102
|
- lib/rubocop/cop/lint/no_env.rb
|
89
103
|
- lib/rubocop/cop/lint/no_http_party.rb
|
104
|
+
- lib/rubocop/cop/lint/obscure.rb
|
90
105
|
- rf-stylez.gemspec
|
91
106
|
- ruby/rubocop.yml
|
92
107
|
- ruby/rubocop_lint.yml
|