Class: ComplexCases::SmartDeleteCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/ducalis/cops/complex_cases/smart_delete_check.rb

Constant Summary collapse

WHITE_LIST =
%w[File cache file params attrs options].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(who, _what, args) ⇒ SmartDeleteCheck

Returns a new instance of SmartDeleteCheck.



11
12
13
14
# File 'lib/ducalis/cops/complex_cases/smart_delete_check.rb', line 11

def initialize(who, _what, args)
  @who = who
  @args = args
end

Class Method Details

.call(who, what, args) ⇒ Object



7
8
9
# File 'lib/ducalis/cops/complex_cases/smart_delete_check.rb', line 7

def self.call(who, what, args)
  !new(who, what, args).false_positive?
end

Instance Method Details

#false_positive?Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
# File 'lib/ducalis/cops/complex_cases/smart_delete_check.rb', line 16

def false_positive?
  [
    called_with_stringlike?,
    many_args?,
    whitelisted?
  ].any?
end