Class: Morecane::MustNotMatchCheck

Inherits:
Struct
  • Object
show all
Defined in:
lib/morecane/must_not_match_check.rb

Overview

Creates violations for ruby files that match a given regexp

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optsObject

Returns the value of attribute opts

Returns:

  • (Object)

    the current value of opts



6
7
8
# File 'lib/morecane/must_not_match_check.rb', line 6

def opts
  @opts
end

Class Method Details

.optionsObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/morecane/must_not_match_check.rb', line 7

def self.options
  {
    must_not_match_glob: ['Glob to run no-match checks over',
                          default:  '{app,lib,spec}/**/*.rb',
                          variable: 'GLOB',
                          clobber:  :no_must_not_nomatch],
    must_not_match_regexp: ['Regexp to check files against',
                            variable: 'REGEXP',
                            clobber:  :no_must_not_match],
  }
end

Instance Method Details

#violationsObject



19
20
21
22
23
# File 'lib/morecane/must_not_match_check.rb', line 19

def violations
  file_names.map { |file_name|
    find_violations(file_name)
  }.flatten.compact
end