yamllint 0.0.6 → 0.0.7
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/.travis.yml +2 -2
- data/CHANGELOG.md +4 -0
- data/README.md +1 -0
- data/Rakefile +19 -3
- data/lib/yamllint/cli.rb +6 -6
- data/lib/yamllint/rake_task.rb +5 -1
- data/lib/yamllint/version.rb +1 -1
- data/spec/cli_spec.rb +26 -18
- data/spec/spec_helper.rb +2 -2
- data/yamllint.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 412c83d72936188b8d61a4fcf8e97f44cc05bea4
|
4
|
+
data.tar.gz: 639ce5c9dc5c2a899adbc8c017ffade566fd9339
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 185cb0bd8e472a1a328a7de73f5926da9b7142fd7af5435e9b9370fd293626a073a991302c953082b7013a3e9b5a56111ffef3126c1db929d6bc4fb0bbcef878
|
7
|
+
data.tar.gz: 881a3b8fd8eb180aea814b28b28219f535f92f52fe87b9d00b0957b4279da0fd4f7508e35dab027aafc69a2c66be1fef0dec7ab543a815a9b035950c73f241a2
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@ YamlLint gem CHANGELOG
|
|
2
2
|
======================
|
3
3
|
This file is used to list changes made in each version of the YamlLint gem.
|
4
4
|
|
5
|
+
v0.0.7 (2016-01-19)
|
6
|
+
-------------------
|
7
|
+
- **[ISSUE #10](https://github.com/shortdudey123/yamllint/issues/10)** / **[PR #12](https://github.com/shortdudey123/yamllint/pull/12)** - Add exclude path option to Raketask
|
8
|
+
|
5
9
|
v0.0.6 (2015-05-13)
|
6
10
|
-------------------
|
7
11
|
- **[ISSUE #7](https://github.com/shortdudey123/yamllint/issues/7)** - Detects dupe keys on arrays of hashes (**Proper fix**)
|
data/README.md
CHANGED
@@ -103,6 +103,7 @@ Add these options similarly to the path option seen above.
|
|
103
103
|
| `extensions` | Add more allowed extensions (list)| `nil` |
|
104
104
|
| `fail_on_error` | Continue on to the next rake task and don't fail even if YamlLint finds errors | `true` |
|
105
105
|
| `path` | List of files or paths to lint | `nil` |
|
106
|
+
| `exclude_paths` | List of files or paths to exclude from linting | `nil` |
|
106
107
|
|
107
108
|
## Contributing
|
108
109
|
|
data/Rakefile
CHANGED
@@ -20,16 +20,32 @@ YamlLint::RakeTask.new do |t|
|
|
20
20
|
t.paths = %w{ spec/data/valid* }
|
21
21
|
end
|
22
22
|
|
23
|
+
desc 'yamllint rake test with exclude_paths'
|
24
|
+
YamlLint::RakeTask.new(:yamllint_exclude_paths) do |t|
|
25
|
+
t.paths = %w{
|
26
|
+
spec/data/*
|
27
|
+
}
|
28
|
+
t.exclude_paths = %w(
|
29
|
+
spec/data/custom_extension.eyaml
|
30
|
+
spec/data/empty.yaml
|
31
|
+
spec/data/invalid.yaml
|
32
|
+
spec/data/overlapping_keys.yaml
|
33
|
+
spec/data/overlapping_keys_deep.yaml
|
34
|
+
spec/data/spaces.yaml
|
35
|
+
spec/data/wrong_extension.txt
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
23
39
|
desc 'yamllint rake test disabled file ext check'
|
24
|
-
YamlLint::RakeTask.new(:
|
40
|
+
YamlLint::RakeTask.new(:yamllint_disable_ext_check) do |t|
|
25
41
|
t.paths = %w{ spec/data/wrong_extension.txt }
|
26
42
|
t.disable_ext_check = true
|
27
43
|
end
|
28
44
|
|
29
45
|
desc 'yamllint rake test disabled file ext check'
|
30
|
-
YamlLint::RakeTask.new(:
|
46
|
+
YamlLint::RakeTask.new(:yamllint_custom_ext) do |t|
|
31
47
|
t.paths = %w{ spec/data/custom_extension.eyaml }
|
32
48
|
t.extensions = %w{ eyaml }
|
33
49
|
end
|
34
50
|
|
35
|
-
task default: [:rubocop, :yamllint, :
|
51
|
+
task default: [:rubocop, :yamllint, :yamllint_exclude_paths, :yamllint_disable_ext_check, :yamllint_custom_ext, :spec]
|
data/lib/yamllint/cli.rb
CHANGED
@@ -10,7 +10,7 @@ module YamlLint
|
|
10
10
|
|
11
11
|
# setup CLI options
|
12
12
|
def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR,
|
13
|
-
|
13
|
+
kernel = Kernel)
|
14
14
|
@argv = argv
|
15
15
|
@stdin = stdin
|
16
16
|
@stdout = stdout
|
@@ -31,11 +31,11 @@ module YamlLint
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def lint(files_to_check)
|
34
|
-
if files_to_check == ['-']
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
linter = if files_to_check == ['-']
|
35
|
+
lint_stream
|
36
|
+
else
|
37
|
+
lint_files(files_to_check)
|
38
|
+
end
|
39
39
|
|
40
40
|
puts 'YamlLint found no errors' unless linter.errors?
|
41
41
|
return unless linter.errors?
|
data/lib/yamllint/rake_task.rb
CHANGED
@@ -10,6 +10,7 @@ module YamlLint
|
|
10
10
|
class RakeTask < Rake::TaskLib
|
11
11
|
attr_accessor :name
|
12
12
|
attr_accessor :paths
|
13
|
+
attr_accessor :exclude_paths
|
13
14
|
attr_accessor :fail_on_error
|
14
15
|
attr_accessor :disable_ext_check
|
15
16
|
attr_accessor :extensions
|
@@ -34,9 +35,12 @@ module YamlLint
|
|
34
35
|
task(name) do
|
35
36
|
puts 'Running YamlLint...'
|
36
37
|
|
37
|
-
|
38
|
+
files_to_check_raw = Rake::FileList.new(paths)
|
39
|
+
files_to_exclude = Rake::FileList.new(exclude_paths)
|
40
|
+
files_to_check = files_to_check_raw - files_to_exclude
|
38
41
|
|
39
42
|
puts "Checking #{files_to_check.flatten.length} files"
|
43
|
+
puts "Excluding #{files_to_exclude.flatten.length} files"
|
40
44
|
|
41
45
|
linter = ::YamlLint::Linter.new(disable_ext_check: disable_ext_check,
|
42
46
|
extensions: extensions)
|
data/lib/yamllint/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -3,57 +3,64 @@ require 'spec_helper'
|
|
3
3
|
describe 'yamllint' do
|
4
4
|
it 'should print usage if run with no args' do
|
5
5
|
yamllint
|
6
|
-
|
6
|
+
expect(last_command_started).to_not be_successfully_executed
|
7
|
+
expect(last_command_started).to have_output(/Error: need at least one YAML/)
|
7
8
|
end
|
8
9
|
|
9
10
|
it '-h should print usage' do
|
10
11
|
yamllint '-h'
|
11
|
-
|
12
|
+
expect(last_command_started).to be_successfully_executed
|
13
|
+
expect(last_command_started).to have_output(/Usage: yamllint/)
|
12
14
|
end
|
13
15
|
|
14
16
|
it '--help should print usage' do
|
15
17
|
yamllint '--help'
|
16
|
-
|
18
|
+
expect(last_command_started).to be_successfully_executed
|
19
|
+
expect(last_command_started).to have_output(/Usage: yamllint/)
|
17
20
|
end
|
18
21
|
|
19
22
|
it '-v should print its version' do
|
20
23
|
yamllint '-v'
|
21
|
-
|
24
|
+
expect(last_command_started).to be_successfully_executed
|
25
|
+
expect(last_command_started).to have_output YamlLint::VERSION
|
22
26
|
end
|
23
27
|
|
24
28
|
it '--version should print its version' do
|
25
29
|
yamllint '--version'
|
26
|
-
|
30
|
+
expect(last_command_started).to be_successfully_executed
|
31
|
+
expect(last_command_started).to have_output YamlLint::VERSION
|
27
32
|
end
|
28
33
|
|
29
34
|
it 'should exit successfully with good YAML' do
|
30
35
|
yamllint spec_data('valid.yaml')
|
31
|
-
|
36
|
+
expect(last_command_started).to be_successfully_executed
|
32
37
|
end
|
33
38
|
|
34
39
|
it 'should fail with bad YAML' do
|
35
40
|
yamllint spec_data('invalid.yaml')
|
36
|
-
|
41
|
+
expect(last_command_started).to_not be_successfully_executed
|
37
42
|
end
|
38
43
|
|
39
44
|
it 'should fail with a path that does not exist' do
|
40
45
|
yamllint '/does/not/exist'
|
41
|
-
|
46
|
+
expect(last_command_started).to_not be_successfully_executed
|
47
|
+
expect(last_command_started).to have_output(/no such file/)
|
42
48
|
end
|
43
49
|
|
44
50
|
it 'should fail with an invalid YAML file extension' do
|
45
51
|
yamllint spec_data('wrong_extension.txt')
|
46
|
-
|
52
|
+
expect(last_command_started).to_not be_successfully_executed
|
53
|
+
expect(last_command_started).to have_output(/File extension must be .yaml/)
|
47
54
|
end
|
48
55
|
|
49
56
|
it 'should pass with invalid file extension and extension check disabled' do
|
50
57
|
yamllint "-d #{spec_data('wrong_extension.txt')}"
|
51
|
-
|
58
|
+
expect(last_command_started).to be_successfully_executed
|
52
59
|
end
|
53
60
|
|
54
61
|
it 'should pass with custom extension' do
|
55
62
|
yamllint "-e eyaml #{spec_data('custom_extension.eyaml')}"
|
56
|
-
|
63
|
+
expect(last_command_started).to be_successfully_executed
|
57
64
|
end
|
58
65
|
|
59
66
|
it 'should fail with a path that is unreadable' do
|
@@ -62,18 +69,19 @@ describe 'yamllint' do
|
|
62
69
|
run_simple('chmod -r tmp/unreadable_file.yaml')
|
63
70
|
|
64
71
|
yamllint 'tmp/unreadable_file.yaml'
|
65
|
-
|
72
|
+
expect(last_command_started).to_not be_successfully_executed
|
73
|
+
expect(last_command_started).to have_output(/Permission denied/)
|
66
74
|
end
|
67
75
|
|
68
76
|
it 'should be able to lint good YAML from STDIN' do
|
69
|
-
|
70
|
-
pipe_in_file(
|
71
|
-
|
77
|
+
run "#{yamllint_bin} -"
|
78
|
+
pipe_in_file('../../spec/data/valid.yaml') && close_input
|
79
|
+
expect(last_command_started).to be_successfully_executed
|
72
80
|
end
|
73
81
|
|
74
82
|
it 'should be able to lint bad YAML from STDIN' do
|
75
|
-
|
76
|
-
pipe_in_file(
|
77
|
-
|
83
|
+
run "#{yamllint_bin} -"
|
84
|
+
pipe_in_file('../../spec/data/invalid.yaml') && close_input
|
85
|
+
expect(last_command_started).to_not be_successfully_executed
|
78
86
|
end
|
79
87
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,7 +4,7 @@ Coveralls.wear!
|
|
4
4
|
require 'rspec'
|
5
5
|
|
6
6
|
require 'aruba'
|
7
|
-
require 'aruba/
|
7
|
+
require 'aruba/rspec'
|
8
8
|
|
9
9
|
require 'yamllint'
|
10
10
|
|
@@ -22,7 +22,7 @@ end
|
|
22
22
|
#
|
23
23
|
module CliSpecHelpers
|
24
24
|
def yamllint(args = nil)
|
25
|
-
run_simple("#{yamllint_bin} #{args}", false)
|
25
|
+
run_simple("#{yamllint_bin} #{args}", fail_on_error: false)
|
26
26
|
end
|
27
27
|
|
28
28
|
def yamllint_bin
|
data/yamllint.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
24
|
spec.add_development_dependency 'rake'
|
25
25
|
spec.add_development_dependency 'rspec'
|
26
|
-
spec.add_development_dependency 'aruba'
|
26
|
+
spec.add_development_dependency 'aruba', '~> 0.12'
|
27
27
|
spec.add_development_dependency 'rubocop'
|
28
28
|
spec.add_development_dependency 'pry'
|
29
29
|
spec.add_development_dependency 'coveralls'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yamllint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Ridder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: aruba
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
75
|
+
version: '0.12'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
82
|
+
version: '0.12'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|