coffeelint 0.3.0 → 0.4.0
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.
- data/.rspec +2 -0
- data/README.md +3 -1
- data/coffeelint/lib/coffeelint.js +418 -128
- data/lib/coffeelint.rb +4 -0
- data/lib/coffeelint/version.rb +1 -1
- data/lib/tasks/coffeelint.rake +13 -1
- data/spec/coffeelint_spec.rb +8 -8
- data/spec/spec_helper.rb +0 -2
- metadata +30 -17
- checksums.yaml +0 -7
data/lib/coffeelint.rb
CHANGED
@@ -7,6 +7,10 @@ require 'json'
|
|
7
7
|
module Coffeelint
|
8
8
|
require 'coffeelint/railtie' if defined?(Rails::Railtie)
|
9
9
|
|
10
|
+
def self.set_path(custom_path)
|
11
|
+
@path = custom_path
|
12
|
+
end
|
13
|
+
|
10
14
|
def self.path()
|
11
15
|
@path ||= File.expand_path('../../coffeelint/lib/coffeelint.js', __FILE__)
|
12
16
|
end
|
data/lib/coffeelint/version.rb
CHANGED
data/lib/tasks/coffeelint.rake
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
desc "lint application javascript"
|
2
2
|
task :coffeelint do
|
3
|
-
|
3
|
+
conf = {}
|
4
|
+
|
5
|
+
config_file = [].tap {|files|
|
6
|
+
files << ENV['COFFEELNT_CONFIG'] if ENV['COFFEELENT_CONFIG']
|
7
|
+
files << 'config/coffeelint.json'
|
8
|
+
if ENV['HOME']
|
9
|
+
files << "#{ENV['HOME']}/coffeelint.json"
|
10
|
+
files << "#{ENV['HOME']}/.coffeelint.json"
|
11
|
+
end
|
12
|
+
}.compact.detect {|file| File.exists?(file) }
|
13
|
+
|
14
|
+
conf[:config_file] = config_file if config_file
|
15
|
+
success = Coffeelint.run_test_suite('app', conf) and Coffeelint.run_test_suite('spec', conf)
|
4
16
|
fail "Lint!" unless success
|
5
17
|
end
|
data/spec/coffeelint_spec.rb
CHANGED
@@ -3,30 +3,30 @@ require 'spec_helper'
|
|
3
3
|
describe Coffeelint do
|
4
4
|
it 'should error with semicolon' do
|
5
5
|
results = Coffeelint.lint('apple;')
|
6
|
-
results.length.
|
6
|
+
expect(results.length).to eq 1
|
7
7
|
result = results[0]
|
8
|
-
result['message'].
|
8
|
+
expect(result['message']).to include 'trailing semicolon'
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'should be able to disable a linter' do
|
12
12
|
results = Coffeelint.lint('apple;', :no_trailing_semicolons => { :level => "ignore" } )
|
13
|
-
results.length.
|
13
|
+
expect(results.length).to eq 0
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should be able to take a config file in the parameters' do
|
17
17
|
File.open('/tmp/coffeelint.json', 'w') {|f| f.write(JSON.dump({:no_trailing_semicolons => { :level => "ignore" }})) }
|
18
18
|
results = Coffeelint.lint('apple;', :config_file => "/tmp/coffeelint.json")
|
19
|
-
results.length.
|
19
|
+
expect(results.length).to eq 0
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should report missing fat arrow' do
|
23
23
|
results = Coffeelint.lint "hey: ->\n @bort()\n", :missing_fat_arrows => { :level => "error" }
|
24
|
-
results.length.
|
24
|
+
expect(results.length).to eq 1
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should report unnecessary fat arrow' do
|
28
28
|
results = Coffeelint.lint "hey: =>\n bort()\n", :no_unnecessary_fat_arrows => { :level => "error" }
|
29
|
-
results.length.
|
29
|
+
expect(results.length).to eq 1
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should report cyclomatic complexity' do
|
@@ -37,7 +37,7 @@ describe Coffeelint do
|
|
37
37
|
7 and 8 and 9 and
|
38
38
|
10 and 11
|
39
39
|
EOF
|
40
|
-
results.length.
|
41
|
-
results[0]['name'].
|
40
|
+
expect(results.length).to eq 1
|
41
|
+
expect(results[0]['name']).to eq 'cyclomatic_complexity'
|
42
42
|
end
|
43
43
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,83 +1,94 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffeelint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Zachary Bush
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-11-23 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: coffee-script
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0'
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: json
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: execjs
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- - '>='
|
51
|
+
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '0'
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- - '>='
|
59
|
+
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: rspec
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
|
-
- - '>='
|
67
|
+
- - ! '>='
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: '0'
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
|
-
- - '>='
|
75
|
+
- - ! '>='
|
67
76
|
- !ruby/object:Gem::Version
|
68
77
|
version: '0'
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: rake
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
|
-
- - '>='
|
83
|
+
- - ! '>='
|
74
84
|
- !ruby/object:Gem::Version
|
75
85
|
version: '0'
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
|
-
- - '>='
|
91
|
+
- - ! '>='
|
81
92
|
- !ruby/object:Gem::Version
|
82
93
|
version: '0'
|
83
94
|
description: Ruby bindings for coffeelint
|
@@ -90,6 +101,7 @@ extra_rdoc_files: []
|
|
90
101
|
files:
|
91
102
|
- .gitignore
|
92
103
|
- .gitmodules
|
104
|
+
- .rspec
|
93
105
|
- .travis.yml
|
94
106
|
- Gemfile
|
95
107
|
- LICENSE.txt
|
@@ -108,26 +120,27 @@ files:
|
|
108
120
|
homepage: https://github.com/zipcodeman/coffeelint-ruby
|
109
121
|
licenses:
|
110
122
|
- MIT
|
111
|
-
metadata: {}
|
112
123
|
post_install_message:
|
113
124
|
rdoc_options: []
|
114
125
|
require_paths:
|
115
126
|
- lib
|
116
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
117
129
|
requirements:
|
118
|
-
- - '>='
|
130
|
+
- - ! '>='
|
119
131
|
- !ruby/object:Gem::Version
|
120
132
|
version: '0'
|
121
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
122
135
|
requirements:
|
123
|
-
- - '>='
|
136
|
+
- - ! '>='
|
124
137
|
- !ruby/object:Gem::Version
|
125
138
|
version: '0'
|
126
139
|
requirements: []
|
127
140
|
rubyforge_project:
|
128
|
-
rubygems_version:
|
141
|
+
rubygems_version: 1.8.23
|
129
142
|
signing_key:
|
130
|
-
specification_version:
|
143
|
+
specification_version: 3
|
131
144
|
summary: Ruby bindings for coffeelint along with railtie to add rake task to rails
|
132
145
|
test_files:
|
133
146
|
- spec/coffeelint_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 18e8384007a23b427d77d61296f6620c1315169d
|
4
|
-
data.tar.gz: c057588f3b99110d18e78f5b8a2303e9cc84b072
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 90c1107483e85fa8bcebd329dc736c405502c924150672c0b3c14e2876496a4e69a2dcf2f89a9a88712327ff4e675ea3ef7d3e231ea4f853ed0cee0b19ca1e9c
|
7
|
-
data.tar.gz: 7448dcd8573831b69112cd274d2272fc990c3d46c5d893bb1481608bb804960396d01c1bc1658ec1480aa56822c778ca5c6cef088a2ccdb4a160890b51dc06d9
|