rf-stylez 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f97c18427ae0c004938e6cb730838cf913e990cc9b597b173b0ac3cacbbd1b9
4
- data.tar.gz: af2a92c7d49a77f47f3919376ebfaab21e172f28dd540f8708e96a35d307cc23
3
+ metadata.gz: 6eab02f25e22ed5d7365687d436c5f7c6b7e8e036b9d41203b482cb945e573e9
4
+ data.tar.gz: b0a3163d0569cb82d9024902f2669b78be9bc6f0a8c6541e632212925e05a9ab
5
5
  SHA512:
6
- metadata.gz: b7b121b0c543fe1f904219e9d1a5df9dbaaa11b37aeb59ba2e602a0efe09aea2dca3a9117c113ab7caf8d081a9b5ffb0456e0961c511a0a514bbc50f1e547649
7
- data.tar.gz: 933f9abbd82a796684c01a1917d5c1f136e6383e505fda93b981e40a81a47f7d8615e8a11a2957ed069333408f2fb1d5f640e0b9756bd6901c73c3131cca1cf5
6
+ metadata.gz: 7f8d14ce2b39e35025cb459371df3369e20e0a5120e29323dcd78acc51829a4fcfc1e4efabdb4ecb31d392235c96e23df40f7ef6314a0dd5beaa56b874c2aa8e
7
+ data.tar.gz: 012adcb6bdc628f820958909f86042a3a8d4e3863baee8afe070c29dfea9f550a1c2d23c90346a5660963fae813837cf5fbc38978361e88031b06a16f06069c3
@@ -1,32 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
4
- require 'net/http'
5
- require 'logger'
3
+ require "json"
4
+ require "net/http"
5
+ require "logger"
6
6
 
7
7
  module Rf
8
8
  module Stylez
9
+ # Check for updates to rf-stylez
9
10
  module UpdateCheck
10
- RUBYGEMS_URL = URI('https://rubygems.org/api/v1/gems/rf-stylez.json').freeze
11
+ RUBYGEMS_URL = URI("https://rubygems.org/api/v1/gems/rf-stylez.json").freeze
11
12
 
12
13
  def self.check
13
14
  logger = Logger.new(STDOUT)
14
15
  current_version = Gem::Version.new(VERSION)
15
16
 
16
17
  remote_version = Gem::Version.new(
17
- JSON.parse(Net::HTTP.get(RUBYGEMS_URL))['version']
18
+ JSON.parse(Net::HTTP.get(RUBYGEMS_URL))["version"] # rubocop:disable Lint/NoJSON
18
19
  )
19
20
  if current_version >= remote_version
20
- logger.info('You are running latest rf-stylez ')
21
- logger.info('(•_•) ( •_•)>⌐■-■ (⌐■_■)')
21
+ logger.info("You are running latest rf-stylez ")
22
+ logger.info("(•_•) ( •_•)>⌐■-■ (⌐■_■)")
22
23
  else
23
- logger.warn('RF Stylez is out of date!')
24
+ logger.warn("RF Stylez is out of date!")
24
25
  logger.warn("Newest version is: #{remote_version}")
25
26
  logger.warn("You are running: #{current_version}")
26
- logger.warn('Please update: `gem update rf-stylez`')
27
+ logger.warn("Please update: `gem update rf-stylez`")
27
28
  end
28
29
  rescue SocketError
29
- logger.info('Offline, cannot check for rf-stylez updates')
30
+ logger.info("Offline, cannot check for rf-stylez updates")
30
31
  end
31
32
  end
32
33
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rf
4
4
  module Stylez
5
- VERSION = "1.0.1"
5
+ VERSION = "1.0.2"
6
6
  end
7
7
  end
data/lib/rf/stylez.rb CHANGED
@@ -1,17 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rf/stylez/version'
4
- require 'rf/stylez/update_check'
5
- require 'rubocop'
6
- require 'rubocop/cop/lint/no_json'
7
- require 'rubocop/cop/lint/no_http_party'
8
- require 'rubocop/cop/lint/obscure'
9
- require 'rubocop/cop/lint/no_grape_api'
10
- require 'rubocop/cop/lint/use_positive_int32_validator'
11
- require 'rubocop/cop/lint/no_untyped_raise'
12
- require 'rubocop/cop/lint/no_vcr_recording'
3
+ require "rf/stylez/version"
4
+ require "rf/stylez/update_check"
5
+ require "rubocop"
6
+ require "rubocop/cop/lint/no_json"
7
+ require "rubocop/cop/lint/no_http_party"
8
+ require "rubocop/cop/lint/obscure"
9
+ require "rubocop/cop/lint/no_grape_api"
10
+ require "rubocop/cop/lint/use_positive_int32_validator"
11
+ require "rubocop/cop/lint/no_untyped_raise"
12
+ require "rubocop/cop/lint/no_vcr_recording"
13
13
 
14
14
  module Rf
15
+ # Stylez
15
16
  module Stylez
16
17
  def self.reek_config_path
17
18
  File.expand_path("../../ruby/.reek.yml", __dir__)
@@ -18,10 +18,10 @@ module RuboCop
18
18
  # end
19
19
  # end
20
20
  class NoBangStateMachineEvents < Cop
21
- MSG = 'Event names ending with a `!` define `!`-ended methods that do not raise'
21
+ MSG = "Event names ending with a `!` define `!`-ended methods that do not raise"
22
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 ...) ...)'
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
25
 
26
26
  def on_send(node)
27
27
  return unless (event_name = is_state_machine_event?(node))
@@ -13,9 +13,9 @@ module RuboCop
13
13
  # # good
14
14
  # class Foo < Api::Base
15
15
  class NoGrapeAPI < Cop
16
- MSG = 'Prefer inheriting `Api::AuthBase` or `Api::Base` instead of `Grape::API`.'.freeze
16
+ MSG = "Prefer inheriting `Api::AuthBase` or `Api::Base` instead of `Grape::API`."
17
17
 
18
- def_node_matcher :inherits_Grape_API?, '(class (const ...) (const (const nil? :Grape) :API) ...)'
18
+ def_node_matcher :inherits_Grape_API?, "(class (const ...) (const (const nil? :Grape) :API) ...)"
19
19
 
20
20
  def on_class(node)
21
21
  return unless inherits_Grape_API?(node)
@@ -10,9 +10,9 @@ module RuboCop
10
10
  # # good
11
11
  # TimedRequest.get(...)
12
12
  class NoHTTParty < Cop
13
- MSG = 'Prefer `TimedRequest` instead of raw `HTTParty` calls.'.freeze
13
+ MSG = "Prefer `TimedRequest` instead of raw `HTTParty` calls."
14
14
 
15
- def_node_matcher :is_HTTParty?, '(send (const nil? :HTTParty) ...)'
15
+ def_node_matcher :is_HTTParty?, "(send (const nil? :HTTParty) ...)"
16
16
 
17
17
  def on_send(node)
18
18
  return unless is_HTTParty?(node)
@@ -11,9 +11,9 @@ module RuboCop
11
11
  # MultiJson.load(...)
12
12
  #
13
13
  class NoJSON < Cop
14
- MSG = 'Use `MultiJson` instead of `JSON`.'.freeze
14
+ MSG = "Use `MultiJson` instead of `JSON`."
15
15
 
16
- def_node_matcher :is_JSON?, '(const nil? :JSON)'
16
+ def_node_matcher :is_JSON?, "(const nil? :JSON)"
17
17
 
18
18
  def on_const(node)
19
19
  return unless is_JSON?(node)
@@ -11,9 +11,9 @@ module RuboCop
11
11
  # raise ArgumentError, 'foo'
12
12
  #
13
13
  class NoUntypedRaise < Cop
14
- MSG = 'Do not raise untyped exceptions, specify the error type so it can be rescued specifically.'
14
+ MSG = "Do not raise untyped exceptions, specify the error type so it can be rescued specifically."
15
15
 
16
- def_node_matcher :is_untyped_raise?, '(send nil? {:raise :fail} (str ...) ...)'
16
+ def_node_matcher :is_untyped_raise?, "(send nil? {:raise :fail} (str ...) ...)"
17
17
 
18
18
  def on_send(node)
19
19
  return unless is_untyped_raise?(node)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
- require 'unparser'
2
+
3
+ require "unparser"
3
4
 
4
5
  module RuboCop
5
6
  module Cop
@@ -15,7 +16,7 @@ module RuboCop
15
16
  class NoVCRRecording < RuboCop::Cop::Base
16
17
  extend AutoCorrector
17
18
 
18
- MSG = 'Do not set :record option in VCR'.freeze
19
+ MSG = "Do not set :record option in VCR"
19
20
 
20
21
  def_node_search :is_only_setting_record_option?, <<~PATTERN
21
22
  (pair
@@ -48,7 +49,7 @@ module RuboCop
48
49
 
49
50
  add_offense(node) do |corrector|
50
51
  if is_only_setting_record_option?(node)
51
- corrector.replace(node, 'vcr: true')
52
+ corrector.replace(node, "vcr: true")
52
53
  elsif is_setting_record_option?(node)
53
54
  corrector.replace(node, remove_record_option(node))
54
55
  end
@@ -20,7 +20,7 @@ module RuboCop
20
20
  #
21
21
  # https://ruby-doc.org/core-2.4.0/String.html#method-i-25
22
22
  class Obscure < Cop
23
- MSG = 'Do not use the flipflop operator'.freeze
23
+ MSG = "Do not use the flipflop operator"
24
24
 
25
25
  def_node_matcher :is_stringformat?, <<-PATTERN
26
26
  (send {str dstr} $:% ...)
@@ -36,7 +36,7 @@ module RuboCop
36
36
 
37
37
  def on_send(node)
38
38
  return unless is_stringformat?(node)
39
- add_offense(node, message: 'Do not use String#%')
39
+ add_offense(node, message: "Do not use String#%")
40
40
  end
41
41
  end
42
42
  end
@@ -14,7 +14,7 @@ module RuboCop
14
14
  # requires :id, type: Integer, positive_int32: true
15
15
  # end
16
16
  class UsePositiveInt32Validator < Cop
17
- MSG = 'If this Integer maps to a postgres Integer column, validate with `positive_int32: true`'
17
+ MSG = "If this Integer maps to a postgres Integer column, validate with `positive_int32: true`"
18
18
 
19
19
  # check if the param is `requires` / `optional`
20
20
  def_node_search :find_params_hashes, <<~PATTERN
@@ -23,9 +23,9 @@ module RuboCop
23
23
  $(hash ...) ...)
24
24
  PATTERN
25
25
  # check if hash contains `type: Integer`
26
- def_node_search :is_type_integer?, '(pair (sym :type) (const nil? :Integer))'
26
+ def_node_search :is_type_integer?, "(pair (sym :type) (const nil? :Integer))"
27
27
  # check if the hash contains the `positive_int32` validator
28
- def_node_search :validates_integer?, '(pair (sym :positive_int32) {{true false} (int _)})'
28
+ def_node_search :validates_integer?, "(pair (sym :positive_int32) {{true false} (int _)})"
29
29
 
30
30
  def on_block(node)
31
31
  return unless (hash = find_params_hashes(node))
data/ruby/rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.7
2
+ TargetRubyVersion: 3.2
3
3
  DisabledByDefault: true
4
4
  Include:
5
5
  - '**/*.rb'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rf-stylez
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emanuel Evans