Class: Pylintr

Inherits:
Object
  • Object
show all
Defined in:
lib/pylintr.rb,
lib/pylintr/version.rb

Constant Summary collapse

VERSION =
'0.1.3'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(custom_config = nil) ⇒ Pylintr

Returns a new instance of Pylintr.



12
13
14
# File 'lib/pylintr.rb', line 12

def initialize custom_config = nil
  @custom_config = custom_config
end

Class Method Details

.file_lint(file_path) ⇒ Object



7
8
9
# File 'lib/pylintr.rb', line 7

def self.file_lint file_path
  new.file_lint file_path
end

.lint(content) ⇒ Object



3
4
5
# File 'lib/pylintr.rb', line 3

def self.lint content
  new.lint content
end

Instance Method Details

#file_lint(file_path) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/pylintr.rb', line 24

def file_lint file_path
  if @custom_config
    as_file(@custom_config, 'rc') do |file|
      parse_lint file.path, file_path
    end
  else
    parse_lint pylint_config, file_path
  end
end

#lint(content) ⇒ Object



18
19
20
21
22
# File 'lib/pylintr.rb', line 18

def lint content
  as_file content do |file|
    file_lint file.path
  end
end