polleverywhere-cops 1.0.2 → 1.1.0

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
  SHA1:
3
- metadata.gz: 4491c9d4396f33d23ef6aeb72acf71d0639cd12e
4
- data.tar.gz: c405752669d59847d55706a71ecfc24adfedfc61
3
+ metadata.gz: 1b6628dcdc0949ab8a9a4c961e344b535069f610
4
+ data.tar.gz: 0f91e16f0da73b121b83b11c091720156592e158
5
5
  SHA512:
6
- metadata.gz: 9c3e0ea336644d67eb12209f66224ea26ca28d15a5c4e4373e11047409211b642b551740e333892d1f2eca5cc8be15d66e1714533906b748ec7100c2ea26f4a3
7
- data.tar.gz: c0218b1960b550ee04b5ab813b12cd5a365876d9cfe27450ff476ebc838148104bd59b310b37010ae30f827ccbc95aaf0d3ea811d32d48634b5a2debb8ff6a7d
6
+ metadata.gz: 2e0208d41d0f39cb125cebfec70724d2d47db9e229df366335a433c43b5fe788c460dfcaf10eb827cbdcaf70a1ead9bb5fec7480e1f21a35ccc7265ee378c279
7
+ data.tar.gz: a827b5bbe9930667bc197666c5b0352b7a6e160cb286a083a3b3a6a59499b919567b189b716b537fb7b474c1e2d89212b7b06ce777dfacb7809fe750f96a71d0
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # Change Log
2
+
3
+ ## Version 1.1.0
4
+ - Added Constantize cop
5
+ - Updated all cops to support rubocop v 0.51.0
6
+ - Now requires at least version 0.51.0 of rubocop
data/README.md CHANGED
@@ -5,6 +5,7 @@ Custom RuboCop cops for Poll Everywhere
5
5
  ## Cops
6
6
 
7
7
  - *NullableBoolean*: Boolean database columns cannot be nullable.
8
+ - _Constantize_: Don't call String#constantize.
8
9
 
9
10
  ## Instructions
10
11
 
@@ -20,3 +21,11 @@ Add to `.rubocop.yml`:
20
21
  require:
21
22
  - polleverywhere-cops
22
23
  ```
24
+
25
+ ## Publishing to RubyGems
26
+
27
+ ```
28
+ $EDITOR lib/rubocop/polleverywhere/version.rb
29
+ gem build polleverywhere-cops.gemspec
30
+ gem push polleverywhere-cops-x.x.x.gem
31
+ ```
data/TODO.md ADDED
@@ -0,0 +1,5 @@
1
+ # TODO
2
+
3
+ - Boolean columns that begin with `is_`
4
+ - `render json:` calls without an explicit `serializer:` option
5
+ - Items from Poll Everywhere's [code conventions](https://playbook.polleverywhere.com/conventions/)
@@ -3,3 +3,4 @@ require "rubocop/polleverywhere/version"
3
3
 
4
4
  # cops
5
5
  require "rubocop/cop/polleverywhere/nullable_boolean"
6
+ require "rubocop/cop/polleverywhere/constantize"
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module PollEverywhere
6
+ class Constantize < Cop
7
+ MSG = 'The use of `constantize` is a potential security risk.'.freeze
8
+
9
+ def_node_matcher :constantize?, <<-PATTERN
10
+ (send (...) :constantize)
11
+ PATTERN
12
+
13
+ def on_send(node)
14
+ return unless constantize?(node)
15
+
16
+ add_offense(node, location: :selector)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -8,7 +8,7 @@ module RuboCop
8
8
 
9
9
  def on_send(node)
10
10
  if adding_boolean?(node) && nullable?(node)
11
- add_offense(node, :expression, MSG)
11
+ add_offense(node, location: :expression, message: MSG)
12
12
  end
13
13
  end
14
14
 
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module PollEverywhere
5
5
  module Version
6
- STRING = "1.0.2".freeze
6
+ STRING = "1.1.0".freeze
7
7
  end
8
8
  end
9
9
  end
@@ -15,5 +15,5 @@ Gem::Specification.new do |gem|
15
15
  gem.extra_rdoc_files = ["README.md"]
16
16
  gem.rdoc_options = ["--main", "README.md"]
17
17
 
18
- gem.add_runtime_dependency "rubocop", ">= 0.48.1"
18
+ gem.add_runtime_dependency "rubocop", ">= 0.51.0"
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polleverywhere-cops
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Poll Everywhere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-08 00:00:00.000000000 Z
11
+ date: 2018-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.48.1
19
+ version: 0.51.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.48.1
26
+ version: 0.51.0
27
27
  description: Custom RuboCop cops for Poll Everywhere
28
28
  email:
29
29
  - geeks@polleverywhere.com
@@ -33,9 +33,12 @@ extra_rdoc_files:
33
33
  - README.md
34
34
  files:
35
35
  - ".gitignore"
36
+ - CHANGELOG.md
36
37
  - LICENSE
37
38
  - README.md
39
+ - TODO.md
38
40
  - lib/polleverywhere-cops.rb
41
+ - lib/rubocop/cop/polleverywhere/constantize.rb
39
42
  - lib/rubocop/cop/polleverywhere/nullable_boolean.rb
40
43
  - lib/rubocop/polleverywhere/version.rb
41
44
  - polleverywhere-cops.gemspec
@@ -61,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
64
  version: '0'
62
65
  requirements: []
63
66
  rubyforge_project:
64
- rubygems_version: 2.6.13
67
+ rubygems_version: 2.6.14
65
68
  signing_key:
66
69
  specification_version: 4
67
70
  summary: Custom RuboCop cops for Poll Everywhere