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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b3df1c229c340e1c581b417f7f9fab4634d5606c5cd22f132e2c6b42dc6270b
4
- data.tar.gz: 04cf9acef3339e937a9c4676ec4770c749bfdac49a870939a936b7e938c39a01
3
+ metadata.gz: 7df6e0db6c26722063fd17eaeba95892bdc7a83a3f9157f246f91aeea104d671
4
+ data.tar.gz: a0b68384bc85436ed593a5fbbe734896b08498ea50d0d35fc6be1bc1e6af5c87
5
5
  SHA512:
6
- metadata.gz: 78fae2b89d5701a8397af7da2a250ff5420fd4a30ff3210971b9174c497dc11600144724ccdce207264317fa3574bc0afb10d2dfeab83d5c7eea707c799bf46a
7
- data.tar.gz: 852ca3254c2a26ce3e30dda5fd5203fd394eccd62214d23791f81eb1c1c7ac49b27ccd5789c523ab09d1e7dc22c6ffde1adba3742fce093d987931d176c71feb
6
+ metadata.gz: beb10f74bd156bc68abfb38bff258f483842fe115b9de58b1c8f641a032f121fbc3eb10400941ecf45845b3d5899cfc087bd1ec4e5d58fc9c5c3059ae3f9c611
7
+ data.tar.gz: 288d7639d488622900c7a801350120aed9a88825d4215386df27242e68774e67a37e0e666ad83969df40e5f313bce9223df7946a63a4ae35a57f08b8862bcc85
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .byebug_history
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 you're an owner on rubygems.org
8
- - `rake release`
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
+ ```
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Rf
3
3
  module Stylez
4
- VERSION = '0.2.11'
4
+ VERSION = '0.2.12'
5
5
  end
6
6
  end
@@ -5,16 +5,10 @@ module RuboCop
5
5
  module Lint
6
6
  # @example
7
7
  # # bad
8
- # ENV[]
9
- #
10
- # # bad
11
- # ENV.fetch(..)
12
- #
13
- # # good
14
- # GetEnv[]
8
+ # HTTParty.get(..)
15
9
  #
16
10
  # # good
17
- # GetEnv.fetch(...)
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
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'bundler', '~> 1.10'
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
26
  spec.add_development_dependency 'rspec', '>= 3.4'
27
+ spec.add_development_dependency 'byebug'
27
28
  end
@@ -23,6 +23,8 @@ Lint/NoENV:
23
23
  Enabled: true
24
24
  Lint/NoHTTParty:
25
25
  Enabled: true
26
+ Lint/Obscure:
27
+ Enabled: true
26
28
 
27
29
  # Good style cops
28
30
  Layout/BlockAlignment:
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.11
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-07 00:00:00.000000000 Z
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