Sha256: dbb4f18137f96884417cd82d4b8f1ded94726a399c0c6ac3979615dc9c3c163e

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

require_relative 'registerable'
require_relative 'linter/checkstyle'
require_relative 'linter/coffeelint'
require_relative 'linter/cppcheck'
require_relative 'linter/csslint'
require_relative 'linter/golint'
require_relative 'linter/jshint'
require_relative 'linter/jsonlint'
require_relative 'linter/pylint'
require_relative 'linter/rubocop'
require_relative 'linter/scsslint'
require_relative 'linter/unknown'

module LintTrap
  # Linter registry
  module Linter
    extend Registerable

    class << self
      def register(linter_class, languages:, parser: nil)
        linter = super(linter_class)

        Array(languages).each do |language|
          linter.add_language(Language.find(language))
        end

        linter.parser = Parser.find(parser)
      end
    end

    register CheckStyle, languages: 'Java'
    register CoffeeLint, languages: 'CoffeeScript'
    register CPPCheck, languages: 'C++'
    register CSSLint, languages: 'CSS', parser: 'CSSLint'
    register GoLint, languages: 'Go', parser: 'VimQuickfix'
    register JSHint, languages: 'JavaScript'
    register JSONLint, languages: 'JSON'
    register PyLint, languages: 'Python'
    register RuboCop, languages: 'Ruby'
    register SCSSLint, languages: 'SCSS'
    default Unknown
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lint_trap-0.0.19 lib/lint_trap/linter.rb
lint_trap-0.0.18 lib/lint_trap/linter.rb
lint_trap-0.0.17 lib/lint_trap/linter.rb
lint_trap-0.0.16 lib/lint_trap/linter.rb