coffeelint 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +4 -0
- data/bin/coffeelint.rb +1 -75
- data/coffeelint.gemspec +1 -0
- data/coffeelint/lib/coffeelint.js +2 -10
- data/lib/coffeelint.rb +29 -5
- data/lib/coffeelint/cmd.rb +94 -0
- data/lib/coffeelint/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 344ed179d709d31cb9cfc849b08bfee88b8aec30
|
4
|
+
data.tar.gz: 505057ae769bedb0e2703c0190cb3bf248a68e3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d810eeab5acfc59ff90273a0c084dac875a059fc05bba4caf09a3e84b727649d766b7c344f1092d6a92a45c879314c4a5bd7dc2a60b189e97aed0590da755a5
|
7
|
+
data.tar.gz: c7f271a95c8c5dfc6c9b85b77bdab7f4f3c973380877415adab41fb7bee057add6fe00bc60bee59119987149a332fb9f8b2d6615d3563e6e8a03983dc8ddc831
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Coffeelint [](https://travis-ci.org/zmbush/coffeelint-ruby) [](http://badge.fury.io/rb/coffeelint)
|
2
2
|
|
3
|
-
Using coffeelint version: v1.
|
3
|
+
Using coffeelint version: v1.2.0-6-g20613f6
|
4
4
|
|
5
5
|
Coffeelint is a set of simple ruby bindings for [coffeelint](https://github.com/clutchski/coffeelint).
|
6
6
|
|
data/Rakefile
CHANGED
data/bin/coffeelint.rb
CHANGED
@@ -1,79 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'coffeelint'
|
4
|
-
require 'coffeelint/version'
|
5
|
-
require 'optparse'
|
6
4
|
|
7
|
-
|
8
|
-
:recursive => false,
|
9
|
-
:noconfig => false,
|
10
|
-
:stdin => false,
|
11
|
-
:quiet => false,
|
12
|
-
}
|
13
|
-
|
14
|
-
linter_options = {}
|
15
|
-
|
16
|
-
opt_parser = OptionParser.new do |opts|
|
17
|
-
opts.banner = "Usage: coffeelint.rb [options] source [...]"
|
18
|
-
|
19
|
-
=begin
|
20
|
-
-f, --file Specify a custom configuration file.
|
21
|
-
--noconfig Ignores the environment variable COFFEELINT_CONFIG. [boolean]
|
22
|
-
-h, --help Print help information.
|
23
|
-
-v, --version Print current version number.
|
24
|
-
-r Recursively lint .coffee files in subdirectories. [boolean]
|
25
|
-
--csv Use the csv reporter. [boolean]
|
26
|
-
--jslint Use the JSLint XML reporter. [boolean]
|
27
|
-
--nocolor Don't colorize the output [boolean]
|
28
|
-
-s, --stdin Lint the source from stdin [boolean]
|
29
|
-
-q, --quiet Only print errors. [boolean]
|
30
|
-
=end
|
31
|
-
|
32
|
-
|
33
|
-
opts.on "-f FILE", "--file FILE", "Specify a custom configuration file." do |f|
|
34
|
-
linter_options[:config_file] = f
|
35
|
-
end
|
36
|
-
|
37
|
-
=begin
|
38
|
-
opts.on "--noconfig", "Ignores the environment variabel COFFEELINT_CONFIG." do |f|
|
39
|
-
options[:noconfig] = true
|
40
|
-
end
|
41
|
-
=end
|
42
|
-
|
43
|
-
opts.on_tail "-h", "--help", "Print help information." do
|
44
|
-
puts opts
|
45
|
-
exit
|
46
|
-
end
|
47
|
-
|
48
|
-
opts.on_tail "-v", "--version", "Print current version number." do
|
49
|
-
puts Coffeelint::VERSION
|
50
|
-
exit
|
51
|
-
end
|
52
|
-
|
53
|
-
opts.on '-r', "Recursively lint .coffee files in subdirectories." do
|
54
|
-
options[:recursive] = true
|
55
|
-
end
|
56
|
-
|
57
|
-
=begin
|
58
|
-
opts.on '-s', '--stdin', "Lint the source from stdin" do
|
59
|
-
options[:stdin] = true
|
60
|
-
end
|
61
|
-
|
62
|
-
opts.on '-q', '--quiet', 'Only print errors.' do
|
63
|
-
options[:quiet] = true
|
64
|
-
end
|
65
|
-
=end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
opt_parser.parse!
|
70
|
-
|
71
|
-
if ARGV.length > 0
|
72
|
-
ARGV.each do |file|
|
73
|
-
if options[:recursive]
|
74
|
-
Coffeelint.run_test_suite(file, linter_options)
|
75
|
-
else
|
76
|
-
Coffeelint.run_test(file, linter_options)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
5
|
+
Coffeelint::Cmd.main
|
data/coffeelint.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.licenses = ["MIT"]
|
15
15
|
|
16
16
|
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.files -= ['bin/coffeelint']
|
17
18
|
gem.files << 'coffeelint/lib/coffeelint.js'
|
18
19
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
19
20
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module.exports={
|
3
3
|
"name": "coffeelint",
|
4
4
|
"description": "Lint your CoffeeScript",
|
5
|
-
"version": "1.
|
5
|
+
"version": "1.2.0",
|
6
6
|
"homepage": "http://www.coffeelint.org",
|
7
7
|
"keywords": [
|
8
8
|
"lint",
|
@@ -87,15 +87,7 @@ ASTApi = (function() {
|
|
87
87
|
ASTApi.prototype.getNodeName = function(node) {
|
88
88
|
var children, name, _ref;
|
89
89
|
name = node != null ? (_ref = node.constructor) != null ? _ref.name : void 0 : void 0;
|
90
|
-
if (name
|
91
|
-
var _results;
|
92
|
-
_results = [];
|
93
|
-
for (name in node_children) {
|
94
|
-
if (!__hasProp.call(node_children, name)) continue;
|
95
|
-
_results.push(name);
|
96
|
-
}
|
97
|
-
return _results;
|
98
|
-
})()) {
|
90
|
+
if (node_children[name]) {
|
99
91
|
return name;
|
100
92
|
} else {
|
101
93
|
for (name in node_children) {
|
data/lib/coffeelint.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "coffeelint/version"
|
2
|
+
require 'coffeelint/cmd'
|
2
3
|
require 'execjs'
|
3
4
|
require 'coffee-script'
|
4
5
|
require 'json'
|
@@ -22,6 +23,10 @@ module Coffeelint
|
|
22
23
|
pretty_output ? Coffeelint.colorize(str, 32) : str
|
23
24
|
end
|
24
25
|
|
26
|
+
def self.yellow(str, pretty_output = true)
|
27
|
+
pretty_output ? Coffeelint.colorize(str, 33) : str
|
28
|
+
end
|
29
|
+
|
25
30
|
def self.context
|
26
31
|
coffeescriptSource = File.read(CoffeeScript::Source.path)
|
27
32
|
bootstrap = <<-EOF
|
@@ -57,19 +62,38 @@ module Coffeelint
|
|
57
62
|
|
58
63
|
def self.display_test_results(name, errors, pretty_output = true)
|
59
64
|
good = pretty_output ? "\u2713" : 'Passed'
|
65
|
+
warn = pretty_output ? "\u26A1" : 'Warn'
|
60
66
|
bad = pretty_output ? "\u2717" : 'Failed'
|
61
67
|
|
62
68
|
if errors.length == 0
|
63
69
|
puts " #{good} " + Coffeelint.green(name, pretty_output)
|
64
70
|
return true
|
65
71
|
else
|
66
|
-
|
72
|
+
failed = false
|
73
|
+
if errors.any? {|e| e["level"] == "error"}
|
74
|
+
failed = true
|
75
|
+
puts " #{bad} " + Coffeelint.red(name, pretty_output)
|
76
|
+
else
|
77
|
+
puts " #{warn} " + Coffeelint.yellow(name, pretty_output)
|
78
|
+
end
|
79
|
+
|
67
80
|
errors.each do |error|
|
68
|
-
|
69
|
-
|
70
|
-
|
81
|
+
disp = "##{error["lineNumber"]}"
|
82
|
+
if error["lineNumberEnd"]
|
83
|
+
disp += "-#{error["lineNumberEnd"]}"
|
84
|
+
end
|
85
|
+
|
86
|
+
print " "
|
87
|
+
if error["level"] == "warn"
|
88
|
+
print warn + " "
|
89
|
+
print Coffeelint.yellow(disp, pretty_output)
|
90
|
+
else
|
91
|
+
print bad + " "
|
92
|
+
print Coffeelint.red(disp, pretty_output)
|
93
|
+
end
|
94
|
+
puts ": #{error["message"]}. #{error["context"]}."
|
71
95
|
end
|
72
|
-
return
|
96
|
+
return failed
|
73
97
|
end
|
74
98
|
end
|
75
99
|
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'coffeelint/version'
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
module Coffeelint
|
6
|
+
module Cmd
|
7
|
+
def self.parse_options(name = 'coffeelint.rb')
|
8
|
+
options = {
|
9
|
+
:recursive => false,
|
10
|
+
:noconfig => false,
|
11
|
+
:stdin => false,
|
12
|
+
:quiet => false,
|
13
|
+
}
|
14
|
+
|
15
|
+
linter_options = {}
|
16
|
+
|
17
|
+
opt_parser = OptionParser.new do |opts|
|
18
|
+
opts.banner = "Usage: coffeelint.rb [options] source [...]"
|
19
|
+
|
20
|
+
=begin
|
21
|
+
-f, --file Specify a custom configuration file.
|
22
|
+
--noconfig Ignores the environment variable COFFEELINT_CONFIG. [boolean]
|
23
|
+
-h, --help Print help information.
|
24
|
+
-v, --version Print current version number.
|
25
|
+
-r Recursively lint .coffee files in subdirectories. [boolean]
|
26
|
+
--csv Use the csv reporter. [boolean]
|
27
|
+
--jslint Use the JSLint XML reporter. [boolean]
|
28
|
+
--nocolor Don't colorize the output [boolean]
|
29
|
+
-s, --stdin Lint the source from stdin [boolean]
|
30
|
+
-q, --quiet Only print errors. [boolean]
|
31
|
+
=end
|
32
|
+
|
33
|
+
|
34
|
+
opts.on "-f FILE", "--file FILE", "Specify a custom configuration file." do |f|
|
35
|
+
linter_options[:config_file] = f
|
36
|
+
end
|
37
|
+
|
38
|
+
=begin
|
39
|
+
opts.on "--noconfig", "Ignores the environment variabel COFFEELINT_CONFIG." do |f|
|
40
|
+
options[:noconfig] = true
|
41
|
+
end
|
42
|
+
=end
|
43
|
+
|
44
|
+
opts.on_tail "-h", "--help", "Print help information." do
|
45
|
+
puts opts
|
46
|
+
exit
|
47
|
+
end
|
48
|
+
|
49
|
+
opts.on_tail "-v", "--version", "Print current version number." do
|
50
|
+
puts Coffeelint::VERSION
|
51
|
+
exit
|
52
|
+
end
|
53
|
+
|
54
|
+
opts.on '-r', "Recursively lint .coffee files in subdirectories." do
|
55
|
+
options[:recursive] = true
|
56
|
+
end
|
57
|
+
|
58
|
+
=begin
|
59
|
+
opts.on '-s', '--stdin', "Lint the source from stdin" do
|
60
|
+
options[:stdin] = true
|
61
|
+
end
|
62
|
+
|
63
|
+
opts.on '-q', '--quiet', 'Only print errors.' do
|
64
|
+
options[:quiet] = true
|
65
|
+
end
|
66
|
+
=end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
opt_parser.parse!
|
71
|
+
|
72
|
+
return {
|
73
|
+
:options => options,
|
74
|
+
:linter_options => linter_options
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.main
|
79
|
+
options = parse_options
|
80
|
+
|
81
|
+
if ARGV.length > 0
|
82
|
+
ARGV.each do |file|
|
83
|
+
if options[:options][:recursive]
|
84
|
+
Coffeelint.run_test_suite(file, options[:linter_options])
|
85
|
+
else
|
86
|
+
Coffeelint.run_test(file, options[:linter_options])
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
|
data/lib/coffeelint/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffeelint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zachary Bush
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-script
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- bin/coffeelint.rb
|
99
99
|
- coffeelint.gemspec
|
100
100
|
- lib/coffeelint.rb
|
101
|
+
- lib/coffeelint/cmd.rb
|
101
102
|
- lib/coffeelint/railtie.rb
|
102
103
|
- lib/coffeelint/version.rb
|
103
104
|
- lib/tasks/coffeelint.rake
|