yaml-lint 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/bin/yaml-lint +8 -0
- data/lib/yaml-lint.rb +13 -5
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
M2FhMDAyYWEwNzlhNDhhNzdkN2EzNWMyNGRkOTU5OTlmOWVkMDBjYw==
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4c6f2307265abec3aec5421c143abfbee361d056e4aca51b727b4258a3e91969
|
4
|
+
data.tar.gz: 55234818f879cbcb3f302e0cb878458b929bc1db269d2a7129a2d217e10872a9
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZWJjOGZmNmQ3M2E3OTBiMTI3OWFlOGMxNzYxMmFkZjk3MWVhMWUxMzc1Nzdh
|
11
|
-
NDgwZmZhNTRhMTY5YzMzYjc4YWI2ZDgwZDk0ZTU3MjhhZmZhYzc=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YTI2ZTk4OGUzZTM3YmE2MTI0N2NjNDJiMWY2ZmNlZDI2ZTk3YzY5ZTg1YWYy
|
14
|
-
YTg1YjU4YzZlMGYxZmMwNWNlMWMyOTFjZjMzYjE4MDc0ZmE1YjQ5MTk4NjFj
|
15
|
-
M2MwMDc4Mzk1ODRhNmE5NWVhMmM4NzlhNWYxMjVmYjU2ZGY4MDc=
|
6
|
+
metadata.gz: f54e4374bc7df0ec78ff629a47649be687515ce8e34016491719aa8bdac4ee692ae17673e782f89c9b91c4d05901a8fabbc3eebc7092c113e7a6cbd3af01d9ac
|
7
|
+
data.tar.gz: e4589bb6374c0130c8b47b11bac21806597cfb4dc1776bbcdc6d301190aab17b963e18ecfc38d1174122380b7e950e59cb89229f87aa4397203ea64756054a48
|
data/bin/yaml-lint
CHANGED
@@ -29,6 +29,14 @@ OptionParser.new do |opts|
|
|
29
29
|
options[:ignorenoyaml] = true
|
30
30
|
end
|
31
31
|
|
32
|
+
opts.on("-e x,y,z", "--exclude x,y,z", Array, "Coma-separated list of files or folders to exclude.") do |n|
|
33
|
+
options[:exclude] = n
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on("-c", "--no-color", "Disables the colors in the output.") do |n|
|
37
|
+
options[:nocolor] = true
|
38
|
+
end
|
39
|
+
|
32
40
|
opts.on_tail("-h", "--help") do |q|
|
33
41
|
puts 'yaml-lint is a tool to check the syntax of your YAML files'
|
34
42
|
puts opts
|
data/lib/yaml-lint.rb
CHANGED
@@ -23,9 +23,9 @@ module Logging
|
|
23
23
|
def emit(opts={})
|
24
24
|
color = opts[:color]
|
25
25
|
message = opts[:message]
|
26
|
-
print ESCAPES[color]
|
26
|
+
print ESCAPES[color] unless @config[:nocolor]
|
27
27
|
print message
|
28
|
-
print ESCAPES[:reset]
|
28
|
+
print ESCAPES[:reset] unless @config[:nocolor]
|
29
29
|
print "\n"
|
30
30
|
end
|
31
31
|
end
|
@@ -41,12 +41,13 @@ class YamlLint
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def do_lint
|
44
|
-
unless File.
|
44
|
+
unless File.exist? @file
|
45
45
|
error "File #{@file} does not exist"
|
46
46
|
return 0
|
47
47
|
else
|
48
48
|
if File.directory? @file
|
49
|
-
|
49
|
+
directory = format_directory(@file)
|
50
|
+
return self.parse_directory directory
|
50
51
|
else
|
51
52
|
return self.parse_file @file
|
52
53
|
end
|
@@ -55,6 +56,7 @@ class YamlLint
|
|
55
56
|
|
56
57
|
def parse_directory(directory)
|
57
58
|
Dir.glob("#{directory}/*").inject(0) do |mem, fdir|
|
59
|
+
next mem if (Array(@config[:exclude])).include? File.basename(fdir)
|
58
60
|
if File.directory? fdir
|
59
61
|
mem + parse_directory(fdir)
|
60
62
|
else
|
@@ -73,7 +75,7 @@ class YamlLint
|
|
73
75
|
return 1
|
74
76
|
end
|
75
77
|
begin
|
76
|
-
YAML.
|
78
|
+
YAML.unsafe_load(file)
|
77
79
|
rescue Exception => err
|
78
80
|
error "File : #{file}, error: #{err}"
|
79
81
|
return 1
|
@@ -82,4 +84,10 @@ class YamlLint
|
|
82
84
|
return 0
|
83
85
|
end
|
84
86
|
end
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
def format_directory(directory)
|
91
|
+
directory[-1] == '/' ? directory.chop : directory
|
92
|
+
end
|
85
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Fabre
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Check if your YAML files can be loaded.
|
14
14
|
email: ju.pryz@gmail.com
|
@@ -23,24 +23,23 @@ homepage: https://github.com/Pryz/yaml-lint
|
|
23
23
|
licenses:
|
24
24
|
- MIT
|
25
25
|
metadata: {}
|
26
|
-
post_install_message:
|
26
|
+
post_install_message:
|
27
27
|
rdoc_options: []
|
28
28
|
require_paths:
|
29
29
|
- lib
|
30
30
|
required_ruby_version: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
requirements: []
|
41
|
-
|
42
|
-
|
43
|
-
signing_key:
|
41
|
+
rubygems_version: 3.3.15
|
42
|
+
signing_key:
|
44
43
|
specification_version: 4
|
45
44
|
summary: Really simple YAML lint
|
46
45
|
test_files: []
|