Class: JSLint::Lint
- Inherits:
-
Object
- Object
- JSLint::Lint
- Defined in:
- lib/jslint/lint.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Lint
constructor
available options: :paths => [list of paths…] :exclude_paths => [list of exluded paths…] :config_path => path to custom config file (can be set via JSLint.config_path too).
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Lint
available options: :paths => [list of paths…] :exclude_paths => [list of exluded paths…] :config_path => path to custom config file (can be set via JSLint.config_path too)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/jslint/lint.rb', line 21 def initialize( = {}) default_config = Utils.load_config_file(DEFAULT_CONFIG_FILE) custom_config = Utils.load_config_file([:config_path] || JSLint.config_path) @config = default_config.merge(custom_config) if @config['predef'].is_a?(Array) @config['predef'] = @config['predef'].join(",") end included_files = files_matching_paths(, :paths) excluded_files = files_matching_paths(, :exclude_paths) @file_list = Utils.exclude_files(included_files, excluded_files) @file_list.delete_if { |f| File.size(f) == 0 } ['paths', 'exclude_paths'].each { |field| @config.delete(field) } end |
Instance Method Details
#run ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/jslint/lint.rb', line 38 def run check_java Utils.log "Running JSLint:\n\n" arguments = "#{JSLINT_FILE} #{option_string.inspect.gsub(/\$/, "\\$")} #{@file_list.join(' ')}" success = call_java_with_status(RHINO_JAR_FILE, RHINO_JAR_CLASS, arguments) raise LintCheckFailure, "JSLint test failed." unless success end |