rubocop-thread_safety 0.3.4 → 0.4.0

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
- SHA1:
3
- metadata.gz: 8a02cd99185995c9ca8f553177ed0036e4dc8c4c
4
- data.tar.gz: 2008714ed96b7a96406062af5e11d89842eb2e1d
2
+ SHA256:
3
+ metadata.gz: 33c8f2c01aa5f51c5ae09093a3ebb895a764330600ef32c05995836891cc1bd2
4
+ data.tar.gz: 5d4bc3124aff9203407cb61b000564084962e0ad18d72fff954d0994eb944276
5
5
  SHA512:
6
- metadata.gz: '0982b0a820e6d58d183c01f42ff8da9d5071bb02ee0c2fc16bf81c9efa52d16b8a928ca265bcf00397ca1f49fe99132949fb8e7c43907f7441644ad25c3a7f31'
7
- data.tar.gz: 16d36ef00a8eb2010431f968521702f934d4163c97c33a68fd236f2025e41c05a6ef70c1ae80f7e2202a53356539d5cfdf7e37085d6c12d360922dd577a40193
6
+ metadata.gz: 130074abe1ba664fad05877bf2f215ed6965a8da36a92ba8865d05305c1f3661d9f2acfe67836620446c43bee81b3819111c764f37cbe2506474de3b0597de87
7
+ data.tar.gz: ed769cdad040ba59dba88a68af2cadbf04e3eaedd1c389261050cd0917ec4a629b775798c20d3e893650796deea250dc01c80c05a32d5c2c19151fd9d88667d0
@@ -1,10 +1,5 @@
1
1
  AllCops:
2
2
  DisplayCopNames: true
3
- Include:
4
- - Gemfile
5
- - Rakefile
6
- Exclude:
7
- - vendor/**/*
8
3
 
9
4
  Metrics/BlockLength:
10
5
  Exclude:
@@ -3,10 +3,11 @@ cache: bundler
3
3
  language: ruby
4
4
  rvm:
5
5
  - jruby-9.1.14.0
6
- - 2.1
7
- - 2.2
8
6
  - 2.3.0
9
7
  - 2.4
8
+ - 2.5
9
+ - 2.6
10
+ - 2.7
10
11
 
11
12
  matrix:
12
13
  fast_finish: true
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in rubocop-thread_safety.gemspec
@@ -1,4 +1,4 @@
1
- Copyright 2016-2017 CoverMyMeds
1
+ Copyright 2016-2020 CoverMyMeds
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
data/README.md CHANGED
@@ -46,5 +46,5 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/coverm
46
46
 
47
47
  ## Copyright
48
48
 
49
- Copyright (c) 2016-2017 CoverMyMeds.
49
+ Copyright (c) 2016-2020 CoverMyMeds.
50
50
  See [LICENSE.txt](LICENSE.txt) for further details.
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # frozen_string_literal: true
4
+
3
5
  require 'bundler/setup'
4
6
  require 'rubocop-thread_safety'
5
7
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubocop'
2
4
 
3
5
  require 'rubocop/thread_safety/version'
@@ -13,7 +13,7 @@ module RuboCop
13
13
  # cattr_accessor :current_user
14
14
  # end
15
15
  class ClassAndModuleAttributes < Cop
16
- MSG = 'Avoid mutating class and module attributes.'.freeze
16
+ MSG = 'Avoid mutating class and module attributes.'
17
17
 
18
18
  def_node_matcher :mattr?, <<-MATCHER
19
19
  (send nil?
@@ -29,6 +29,7 @@ module RuboCop
29
29
 
30
30
  def on_send(node)
31
31
  return unless mattr?(node) || singleton_attr?(node)
32
+
32
33
  add_offense(node, message: MSG)
33
34
  end
34
35
 
@@ -14,7 +14,7 @@ module RuboCop
14
14
  # end
15
15
  # end
16
16
  class InstanceVariableInClassMethod < Cop
17
- MSG = 'Avoid instance variables in class methods.'.freeze
17
+ MSG = 'Avoid instance variables in class methods.'
18
18
 
19
19
  def on_ivar(node)
20
20
  return unless class_method_definition?(node)
@@ -43,7 +43,7 @@ module RuboCop
43
43
  ancestor.type == :def
44
44
  end
45
45
 
46
- defn && defn.ancestors.any? do |ancestor|
46
+ defn&.ancestors&.any? do |ancestor|
47
47
  ancestor.type == :sclass
48
48
  end
49
49
  end
@@ -51,6 +51,7 @@ module RuboCop
51
51
  def singleton_method_definition?(node)
52
52
  node.ancestors.any? do |ancestor|
53
53
  next unless ancestor.children.first.is_a? AST::SendNode
54
+
54
55
  ancestor.children.first.command? :define_singleton_method
55
56
  end
56
57
  end
@@ -58,6 +59,7 @@ module RuboCop
58
59
  def synchronized?(node)
59
60
  node.ancestors.find do |ancestor|
60
61
  next unless ancestor.block_type?
62
+
61
63
  s = ancestor.children.first
62
64
  s.send_type? && s.children.last == :synchronize
63
65
  end
@@ -11,7 +11,7 @@ module RuboCop
11
11
  # # bad
12
12
  # Thread.new { do_work }
13
13
  class NewThread < Cop
14
- MSG = 'Avoid starting new threads.'.freeze
14
+ MSG = 'Avoid starting new threads.'
15
15
 
16
16
  def_node_matcher :new_thread?, <<-MATCHER
17
17
  (send (const nil? :Thread) :new)
@@ -19,6 +19,7 @@ module RuboCop
19
19
 
20
20
  def on_send(node)
21
21
  return unless new_thread?(node)
22
+
22
23
  add_offense(node, message: MSG)
23
24
  end
24
25
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RuboCop
2
4
  module ThreadSafety
3
- VERSION = '0.3.4'.freeze
5
+ VERSION = '0.4.0'
4
6
  end
5
7
  end
@@ -1,4 +1,6 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'rubocop/thread_safety/version'
4
6
 
@@ -26,8 +28,9 @@ Gem::Specification.new do |spec|
26
28
 
27
29
  spec.add_runtime_dependency 'rubocop', '>= 0.51.0'
28
30
 
29
- spec.add_development_dependency 'bundler', '~> 1.10'
31
+ spec.add_development_dependency 'bundler', '>= 1.10', '< 3'
32
+ spec.add_development_dependency 'powerpack', '~> 0.1'
30
33
  spec.add_development_dependency 'pry' unless ENV['CI']
31
- spec.add_development_dependency 'rake', '~> 10.0'
34
+ spec.add_development_dependency 'rake', '>= 10.0'
32
35
  spec.add_development_dependency 'rspec', '~> 3.0'
33
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-thread_safety
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Gee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-30 00:00:00.000000000 Z
11
+ date: 2020-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -28,16 +28,36 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.10'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '3'
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '1.10'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '3'
47
+ - !ruby/object:Gem::Dependency
48
+ name: powerpack
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.1'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.1'
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: pry
43
63
  requirement: !ruby/object:Gem::Requirement
@@ -56,14 +76,14 @@ dependencies:
56
76
  name: rake
57
77
  requirement: !ruby/object:Gem::Requirement
58
78
  requirements:
59
- - - "~>"
79
+ - - ">="
60
80
  - !ruby/object:Gem::Version
61
81
  version: '10.0'
62
82
  type: :development
63
83
  prerelease: false
64
84
  version_requirements: !ruby/object:Gem::Requirement
65
85
  requirements:
66
- - - "~>"
86
+ - - ">="
67
87
  - !ruby/object:Gem::Version
68
88
  version: '10.0'
69
89
  - !ruby/object:Gem::Dependency
@@ -124,8 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
144
  - !ruby/object:Gem::Version
125
145
  version: '0'
126
146
  requirements: []
127
- rubyforge_project:
128
- rubygems_version: 2.6.8
147
+ rubygems_version: 3.0.3
129
148
  signing_key:
130
149
  specification_version: 4
131
150
  summary: Thread-safety checks via static analysis