Class: Policial::StyleGuides::JavaScript

Inherits:
Base
  • Object
show all
Defined in:
lib/policial/style_guides/javascript.rb

Overview

Public: Determine Javascript style guide violations per-line.

Constant Summary collapse

KEY =
:javascript

Instance Method Summary collapse

Methods inherited from Base

#config_file, #initialize, #investigate?

Constructor Details

This class inherits a constructor from Policial::StyleGuides::Base

Instance Method Details

#default_config_fileObject



24
25
26
# File 'lib/policial/style_guides/javascript.rb', line 24

def default_config_file
  '.eslintrc.json'
end

#exclude_file?(_filename) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/policial/style_guides/javascript.rb', line 16

def exclude_file?(_filename)
  false
end

#filename_patternObject



20
21
22
# File 'lib/policial/style_guides/javascript.rb', line 20

def filename_pattern
  /.+\.js\z/
end

#violations_in_file(file) ⇒ Object



11
12
13
14
# File 'lib/policial/style_guides/javascript.rb', line 11

def violations_in_file(file)
  errors = Eslintrb.lint(file.content, config)
  violations(file, errors)
end