yamllint 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 994ab5e88dd44f839783c37dc58fa10e903e5597
4
- data.tar.gz: bae8d036bc69dc4e69632712537e5bacdf66917e
3
+ metadata.gz: 412c83d72936188b8d61a4fcf8e97f44cc05bea4
4
+ data.tar.gz: 639ce5c9dc5c2a899adbc8c017ffade566fd9339
5
5
  SHA512:
6
- metadata.gz: 9299b517e2f053295d3d25f8c5d9d1e0997bc3506b6215a65f241d0cdc6dc0709aa7cdce8f0c1e5eca4366a189fbcca84e998fb8975fe29273efa944163cdd39
7
- data.tar.gz: 7f4a60a6f1ee607d5320c9159ff7858b1d74dedfb48aaff074a21eb81a45be0df066e86ec6b2611fa0b08fd4889219b66a0dafb6875ae859a7533276453f2795
6
+ metadata.gz: 185cb0bd8e472a1a328a7de73f5926da9b7142fd7af5435e9b9370fd293626a073a991302c953082b7013a3e9b5a56111ffef3126c1db929d6bc4fb0bbcef878
7
+ data.tar.gz: 881a3b8fd8eb180aea814b28b28219f535f92f52fe87b9d00b0957b4279da0fd4f7508e35dab027aafc69a2c66be1fef0dec7ab543a815a9b035950c73f241a2
@@ -2,8 +2,8 @@ language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
4
  - 2.0.0
5
- - 2.1.5
6
- - 2.2.0
5
+ - 2.1.6
6
+ - 2.2.3
7
7
  branches:
8
8
  only:
9
9
  - master
@@ -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(:yamlling_disable_ext_check) do |t|
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(:yamlling_custom_ext) do |t|
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, :yamlling_disable_ext_check, :yamlling_custom_ext, :spec]
51
+ task default: [:rubocop, :yamllint, :yamllint_exclude_paths, :yamllint_disable_ext_check, :yamllint_custom_ext, :spec]
@@ -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
- kernel = Kernel)
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
- linter = lint_stream
36
- else
37
- linter = lint_files(files_to_check)
38
- end
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?
@@ -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
- files_to_check = Rake::FileList.new(paths)
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)
@@ -2,5 +2,5 @@
2
2
  #
3
3
  # YamlLint checks YAML files for correct syntax
4
4
  module YamlLint
5
- VERSION = '0.0.6'
5
+ VERSION = '0.0.7'.freeze
6
6
  end
@@ -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
- assert_failing_with('Error')
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
- assert_passing_with('Usage')
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
- assert_passing_with('Usage')
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
- assert_passing_with(YamlLint::VERSION)
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
- assert_passing_with(YamlLint::VERSION)
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
- assert_success(true)
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
- assert_success(false)
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
- assert_failing_with('no such file')
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
- assert_failing_with('File extension must be .yaml or .yml')
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
- assert_success(true)
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
- assert_success(true)
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
- assert_failing_with('Permission denied')
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
- run_interactive "#{yamllint_bin} -"
70
- pipe_in_file(spec_data('valid.yaml')) && close_input
71
- assert_success(true)
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
- run_interactive "#{yamllint_bin} -"
76
- pipe_in_file(spec_data('invalid.yaml')) && close_input
77
- assert_success(false)
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
@@ -4,7 +4,7 @@ Coveralls.wear!
4
4
  require 'rspec'
5
5
 
6
6
  require 'aruba'
7
- require 'aruba/api'
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
@@ -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.6
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: 2015-05-13 00:00:00.000000000 Z
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