yamllint 0.0.7 → 0.0.8

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: 412c83d72936188b8d61a4fcf8e97f44cc05bea4
4
- data.tar.gz: 639ce5c9dc5c2a899adbc8c017ffade566fd9339
3
+ metadata.gz: a71045dc46ad780c82b3280431ff55dba9d8acc6
4
+ data.tar.gz: da5488e31c0ff7c6ee90c61d425051015d6894cc
5
5
  SHA512:
6
- metadata.gz: 185cb0bd8e472a1a328a7de73f5926da9b7142fd7af5435e9b9370fd293626a073a991302c953082b7013a3e9b5a56111ffef3126c1db929d6bc4fb0bbcef878
7
- data.tar.gz: 881a3b8fd8eb180aea814b28b28219f535f92f52fe87b9d00b0957b4279da0fd4f7508e35dab027aafc69a2c66be1fef0dec7ab543a815a9b035950c73f241a2
6
+ metadata.gz: 7093d7d5811a46704eb8b60f5dccb838416bc47cad085decc6a700947281e87584d76d3caa04b2786cbe99c3b816ffe3779cb756525cd7bca18c1b36719b6ad0
7
+ data.tar.gz: 99008df89029a1bbcbd7bfebc4adb9496bb4b4ed9807ed6ee7c0e67b385a4eb7f759233f20654734120084e04110e2a432755e18b5a9350d5c3b9258e3f08344
data/.rubocop.yml CHANGED
@@ -1 +1,5 @@
1
1
  inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ DisplayCopNames: true
5
+ TargetRubyVersion: 2.2
data/.travis.yml CHANGED
@@ -1,9 +1,10 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.0.0
5
- - 2.1.6
6
- - 2.2.3
4
+ - 2.0.0-p648
5
+ - 2.1.9
6
+ - 2.2.5
7
+ - 2.3.1
7
8
  branches:
8
9
  only:
9
10
  - master
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@ 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
+ Unreleased
6
+ -------------------
7
+
8
+ v0.0.8 (2016-07-10)
9
+ -------------------
10
+ - **[PR #13](https://github.com/shortdudey123/yamllint/pull/13)** - Update Ruby syntax per Rubocop v0.37.0
11
+ - **[PR #15](https://github.com/shortdudey123/yamllint/pull/15)** - Rake.application.last_comment has been deprecated
12
+ - **[PR #18](https://github.com/shortdudey123/yamllint/pull/18)** - Update Ruby syntax per Rubocop v0.40.0
13
+ - **[PR #17](https://github.com/shortdudey123/yamllint/pull/17)** - Expose debug logging
14
+ - **[PR #19](https://github.com/shortdudey123/yamllint/pull/19)** - Pry is a devel dependency not a runtime dependency
15
+ - **[PR #20](https://github.com/shortdudey123/yamllint/pull/20)** - Update TravisCI Ruby versions
16
+
5
17
  v0.0.7 (2016-01-19)
6
18
  -------------------
7
19
  - **[ISSUE #10](https://github.com/shortdudey123/yamllint/issues/10)** / **[PR #12](https://github.com/shortdudey123/yamllint/pull/12)** - Add exclude path option to Raketask
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # YamlLint
2
2
 
3
+ [![Gitter chat](https://badges.gitter.im/shortdudey123/yamllint.svg)](https://gitter.im/shortdudey123/yamllint)
3
4
  [![Build Status](https://travis-ci.org/shortdudey123/yamllint.svg?branch=master)](https://travis-ci.org/shortdudey123/yamllint)
4
5
  [![Gem Version](http://img.shields.io/gem/v/yamllint.svg)](https://rubygems.org/gems/yamllint)
5
6
  [![Coverage Status](https://img.shields.io/coveralls/shortdudey123/yamllint/master.svg)](https://coveralls.io/r/shortdudey123/yamllint?branch=master)
@@ -56,6 +57,7 @@ $
56
57
 
57
58
  | Short | Long | Description | Default |
58
59
  | ------------- | ------------- | ------------- | ------------- |
60
+ | `-D` | `--debug` | Debug logging | `false` |
59
61
  | `-d` | `--disable-ext-check` | Disable file extension check | `false` |
60
62
  | `-e` | `--extensions=` | Add more allowed extensions (comma delimited list) | `nil` |
61
63
  | `-v` | `--version` | Print version and exit | `false` |
@@ -99,6 +101,7 @@ Add these options similarly to the path option seen above.
99
101
 
100
102
  | Option | Description | Default |
101
103
  | ------------- | ------------- | ------------- | ------------- |
104
+ | `debug` | Debug logging | `false` |
102
105
  | `disable_ext_check` | Disable file extension check | `false` |
103
106
  | `extensions` | Add more allowed extensions (list)| `nil` |
104
107
  | `fail_on_error` | Continue on to the next rake task and don't fail even if YamlLint finds errors | `true` |
data/Rakefile CHANGED
@@ -12,19 +12,19 @@ end
12
12
 
13
13
  desc 'rubocop compliancy checks'
14
14
  RuboCop::RakeTask.new(:rubocop) do |t|
15
- t.patterns = %w{ lib/**/*.rb lib/*.rb spec/*.rb }
15
+ t.patterns = %w( lib/**/*.rb lib/*.rb spec/*.rb )
16
16
  end
17
17
 
18
18
  desc 'yamllint rake test'
19
19
  YamlLint::RakeTask.new do |t|
20
- t.paths = %w{ spec/data/valid* }
20
+ t.paths = %w( spec/data/valid* )
21
21
  end
22
22
 
23
23
  desc 'yamllint rake test with exclude_paths'
24
24
  YamlLint::RakeTask.new(:yamllint_exclude_paths) do |t|
25
- t.paths = %w{
25
+ t.paths = %w(
26
26
  spec/data/*
27
- }
27
+ )
28
28
  t.exclude_paths = %w(
29
29
  spec/data/custom_extension.eyaml
30
30
  spec/data/empty.yaml
@@ -38,14 +38,28 @@ end
38
38
 
39
39
  desc 'yamllint rake test disabled file ext check'
40
40
  YamlLint::RakeTask.new(:yamllint_disable_ext_check) do |t|
41
- t.paths = %w{ spec/data/wrong_extension.txt }
41
+ t.paths = %w( spec/data/wrong_extension.txt )
42
42
  t.disable_ext_check = true
43
43
  end
44
44
 
45
45
  desc 'yamllint rake test disabled file ext check'
46
46
  YamlLint::RakeTask.new(:yamllint_custom_ext) do |t|
47
- t.paths = %w{ spec/data/custom_extension.eyaml }
48
- t.extensions = %w{ eyaml }
47
+ t.paths = %w( spec/data/custom_extension.eyaml )
48
+ t.extensions = %w( eyaml )
49
+ end
50
+
51
+ desc 'yamllint rake test disabled file ext check'
52
+ YamlLint::RakeTask.new(:yamllint_debug_logging) do |t|
53
+ t.paths = %w( spec/data/valid.yaml )
54
+ t.debug = true
49
55
  end
50
56
 
51
- task default: [:rubocop, :yamllint, :yamllint_exclude_paths, :yamllint_disable_ext_check, :yamllint_custom_ext, :spec]
57
+ task default: [
58
+ :rubocop,
59
+ :yamllint,
60
+ :yamllint_exclude_paths,
61
+ :yamllint_disable_ext_check,
62
+ :yamllint_custom_ext,
63
+ :yamllint_debug_logging,
64
+ :spec
65
+ ]
data/bin/yamllint CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $: << File.expand_path('../../lib', __FILE__)
3
+ $LOAD_PATH << File.expand_path('../../lib', __FILE__)
4
4
 
5
5
  require 'yamllint'
6
6
  require 'yamllint/cli'
data/lib/yamllint/cli.rb CHANGED
@@ -1,5 +1,5 @@
1
+ require 'logger'
1
2
  require 'trollop'
2
- require 'pry'
3
3
 
4
4
  module YamlLint
5
5
  ###
@@ -22,6 +22,8 @@ module YamlLint
22
22
  def execute!
23
23
  files_to_check = parse_options.leftovers
24
24
 
25
+ YamlLint.logger.level = Logger::DEBUG if opts.debug
26
+
25
27
  no_yamls_to_check_msg = "Error: need at least one YAML file to check.\n"\
26
28
  'Try --help for help.'
27
29
  abort(no_yamls_to_check_msg) if files_to_check.empty?
@@ -46,9 +48,10 @@ module YamlLint
46
48
 
47
49
  def lint_files(files_to_check)
48
50
  ext = opts.extensions.split(',') unless opts.extensions.nil?
49
- linter = YamlLint::Linter.new(disable_ext_check: opts.disable_ext_check,
50
- extensions: ext
51
- )
51
+ linter = YamlLint::Linter.new(
52
+ disable_ext_check: opts.disable_ext_check,
53
+ extensions: ext
54
+ )
52
55
  begin
53
56
  puts "Checking #{files_to_check.flatten.length} files"
54
57
  linter.check_all(files_to_check)
@@ -79,6 +82,7 @@ module YamlLint
79
82
 
80
83
  banner ''
81
84
  banner 'Options:'
85
+ opt :debug, 'Debug logging', default: false, short: 'D'
82
86
  opt :disable_ext_check, 'Disable file extension check', default: false
83
87
  opt :extensions, 'Add more allowed extensions (comma delimited list)',
84
88
  type: :string
@@ -33,7 +33,7 @@ module YamlLint
33
33
 
34
34
  # Check a single file
35
35
  def check(path)
36
- fail FileNotFoundError, "#{path}: no such file" unless File.exist?(path)
36
+ raise FileNotFoundError, "#{path}: no such file" unless File.exist?(path)
37
37
 
38
38
  valid = false
39
39
  unless disable_extension_check
@@ -14,12 +14,14 @@ module YamlLint
14
14
  attr_accessor :fail_on_error
15
15
  attr_accessor :disable_ext_check
16
16
  attr_accessor :extensions
17
+ attr_accessor :debug
17
18
 
18
19
  def initialize(name = :yamllint)
19
20
  @name = name
20
21
  @fail_on_error = true
21
22
  @disable_ext_check = false
22
23
  @extensions = nil
24
+ @debug = false
23
25
 
24
26
  yield self if block_given?
25
27
 
@@ -30,11 +32,13 @@ module YamlLint
30
32
 
31
33
  # Rake task
32
34
  def define_task
33
- desc 'Run yamllint' unless ::Rake.application.last_comment
35
+ desc 'Run yamllint' unless ::Rake.application.last_description
34
36
 
35
37
  task(name) do
36
38
  puts 'Running YamlLint...'
37
39
 
40
+ YamlLint.logger.level = Logger::DEBUG if debug
41
+
38
42
  files_to_check_raw = Rake::FileList.new(paths)
39
43
  files_to_exclude = Rake::FileList.new(exclude_paths)
40
44
  files_to_check = files_to_check_raw - files_to_exclude
@@ -2,5 +2,5 @@
2
2
  #
3
3
  # YamlLint checks YAML files for correct syntax
4
4
  module YamlLint
5
- VERSION = '0.0.7'.freeze
5
+ VERSION = '0.0.8'.freeze
6
6
  end
data/spec/cli_spec.rb CHANGED
@@ -31,6 +31,20 @@ describe 'yamllint' do
31
31
  expect(last_command_started).to have_output YamlLint::VERSION
32
32
  end
33
33
 
34
+ it '-D should print debug log and exit successfully with good YAML' do
35
+ yamllint spec_data('valid.yaml -D')
36
+ expect(last_command_started).to be_successfully_executed
37
+ expect(last_command_started).to have_output(/DEBUG -- : add_value: "bar"/)
38
+ expect(last_command_started).to have_output(/DEBUG -- : Checking my_array/)
39
+ end
40
+
41
+ it '--debug should print debug log and exit successfully with good YAML' do
42
+ yamllint spec_data('valid.yaml --debug')
43
+ expect(last_command_started).to be_successfully_executed
44
+ expect(last_command_started).to have_output(/DEBUG -- : add_value: "bar"/)
45
+ expect(last_command_started).to have_output(/DEBUG -- : Checking my_array/)
46
+ end
47
+
34
48
  it 'should exit successfully with good YAML' do
35
49
  yamllint spec_data('valid.yaml')
36
50
  expect(last_command_started).to be_successfully_executed
data/yamllint.gemspec CHANGED
@@ -4,19 +4,19 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'yamllint/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "yamllint"
7
+ spec.name = 'yamllint'
8
8
  spec.version = YamlLint::VERSION
9
- spec.authors = ["Grant Ridder"]
10
- spec.email = ["shortdudey123@gmail.com"]
11
- spec.summary = %q{YAML lint checker}
12
- spec.description = %q{Checks YAML files for correct syntax}
13
- spec.license = "MIT"
14
- spec.homepage = ""
9
+ spec.authors = 'Grant Ridder'
10
+ spec.email = 'shortdudey123@gmail.com'
11
+ spec.summary = 'YAML lint checker'
12
+ spec.description = 'Checks YAML files for correct syntax'
13
+ spec.license = 'MIT'
14
+ spec.homepage = ''
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'trollop', '~> 2'
22
22
 
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.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Ridder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-19 00:00:00.000000000 Z
11
+ date: 2016-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop
@@ -123,8 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: Checks YAML files for correct syntax
126
- email:
127
- - shortdudey123@gmail.com
126
+ email: shortdudey123@gmail.com
128
127
  executables:
129
128
  - yamllint
130
129
  extensions: []
@@ -183,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
182
  version: '0'
184
183
  requirements: []
185
184
  rubyforge_project:
186
- rubygems_version: 2.4.5
185
+ rubygems_version: 2.5.1
187
186
  signing_key:
188
187
  specification_version: 4
189
188
  summary: YAML lint checker