Skip to content

Commit 9163726

Browse files
committed
ci(yamllint): add rule empty-values & use new yaml-files setting
* Semi-automated using myii/ssf-formula#27 * Fix errors shown below: ```bash bind-formula$ yamllint -s . ./pillar-with-views.example 1:1 warning missing document start "---" (document-start) 2:89 error line too long (93 > 88 characters) (line-length) 4:89 error line too long (98 > 88 characters) (line-length) 5:51 warning comment not indented like content (comments-indentation) 5:89 error line too long (90 > 88 characters) (line-length) 6:1 error trailing spaces (trailing-spaces) 8:89 error line too long (104 > 88 characters) (line-length) 10:89 error line too long (104 > 88 characters) (line-length) 11:89 error line too long (114 > 88 characters) (line-length) 12:89 error line too long (116 > 88 characters) (line-length) 14:1 error trailing spaces (trailing-spaces) 16:89 error line too long (121 > 88 characters) (line-length) 18:89 error line too long (108 > 88 characters) (line-length) 20:89 error line too long (97 > 88 characters) (line-length) 22:89 error line too long (106 > 88 characters) (line-length) 23:22 warning truthy value should be one of [false, true] (truthy) 23:89 error line too long (97 > 88 characters) (line-length) 24:51 warning comment not indented like content (comments-indentation) 24:89 error line too long (110 > 88 characters) (line-length) 24:110 error trailing spaces (trailing-spaces) 25:89 error line too long (122 > 88 characters) (line-length) 26:19 warning truthy value should be one of [false, true] (truthy) 27:19 warning truthy value should be one of [false, true] (truthy) 29:89 error line too long (113 > 88 characters) (line-length) 31:89 error line too long (98 > 88 characters) (line-length) 33:89 error line too long (104 > 88 characters) (line-length) 35:89 error line too long (101 > 88 characters) (line-length) 36:51 warning comment not indented like content (comments-indentation) 36:89 error line too long (112 > 88 characters) (line-length) 36:112 error trailing spaces (trailing-spaces) 37:89 error line too long (122 > 88 characters) (line-length) 38:22 warning truthy value should be one of [false, true] (truthy) 39:19 warning truthy value should be one of [false, true] (truthy) 40:19 warning truthy value should be one of [false, true] (truthy) 43:89 error line too long (96 > 88 characters) (line-length) 44:89 error line too long (119 > 88 characters) (line-length) 45:51 warning comment not indented like content (comments-indentation) 46:1 error trailing spaces (trailing-spaces) 50:89 error line too long (99 > 88 characters) (line-length) 57:89 error line too long (89 > 88 characters) (line-length) 70:1 error trailing spaces (trailing-spaces) 71:89 error line too long (96 > 88 characters) (line-length) 72:89 error line too long (119 > 88 characters) (line-length) 73:51 warning comment not indented like content (comments-indentation) 74:1 error trailing spaces (trailing-spaces) 78:89 error line too long (99 > 88 characters) (line-length) 85:89 error line too long (89 > 88 characters) (line-length) 87:89 error line too long (110 > 88 characters) (line-length) ```
1 parent d498d19 commit 9163726

File tree

3 files changed

+35
-16
lines changed

3 files changed

+35
-16
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ jobs:
5656
before_install: skip
5757
script:
5858
# Install and run `yamllint`
59-
- pip install --user yamllint
60-
# yamllint disable-line rule:line-length
61-
- yamllint -s . .yamllint pillar.example test/salt/pillar/default.sls
59+
# Need at least `v1.17.0` for the `yaml-files` setting
60+
- pip install --user yamllint>=1.17.0
61+
- yamllint -s .
6262
# Install and run `commitlint`
6363
- npm install @commitlint/config-conventional -D
6464
- npm install @commitlint/travis-cli -D

.yamllint

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,35 @@ extends: default
66

77
# Files to ignore completely
88
# 1. All YAML files under directory `node_modules/`, introduced during the Travis run
9+
# 2. Any SLS files under directory `test/`, which are actually state files
910
ignore: |
1011
node_modules/
12+
test/**/states/**/*.sls
13+
14+
yaml-files:
15+
# Default settings
16+
- '*.yaml'
17+
- '*.yml'
18+
- .yamllint
19+
# SaltStack Formulas additional settings
20+
- '*.example'
21+
- test/**/*.sls
1122

1223
rules:
1324
comments-indentation:
1425
ignore: |
1526
pillar.example
27+
pillar-with-views.example
28+
empty-values:
29+
forbid-in-block-mappings: true
30+
forbid-in-flow-mappings: true
1631
key-duplicates:
1732
ignore: |
1833
pillar.example
1934
line-length:
2035
ignore: |
2136
pillar.example
37+
pillar-with-views.example
2238
# Increase from default of `80`
2339
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
2440
max: 88

pillar-with-views.example

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
bind:
25
configured_acls: # We have an internal ACL restricted to our
36
internal: # private IP range.
47
- 10.0.0.0/8 # In this case, an ACL for external isn't needed
58
# as that view will be matched by 'any'.
6-
9+
710
# Notice that there is no 'configured_zones' at this indentation level.
811
# That is because when you are using views, the bind service forces all zones to be served via a view.
912
#
1013
# Also note - any other zones defined in any other conf files will either need to be commented out, or
1114
# also served via a view using a file include. If you have other zones being served outside of a view, bind will
1215
# fail to start and give you an error message indicating this. You will likely find these externally-defined zones
1316
# in /etc/named.conf and /etc/named.conf.local
14-
17+
1518
configured_views:
1619
external: # A view called 'external' to match anything except the 'internal' ACL.
1720
match_clients:
@@ -20,11 +23,11 @@ bind:
2023
mydomain.com: # Notice that this value matches on both views.
2124
type: master
2225
file: external.mydomain.com.txt # Specify the file to be used, which must match the file
23-
recursion: yes # name of the zone below under available_zones.
24-
# This filename also must match the corresponding zone name
26+
recursion: 'yes' # name of the zone below under available_zones.
27+
# This filename also must match the corresponding zone name
2528
# without the .txt extension (and be sure to use .txt as the extension).
26-
notify: False
27-
dnssec: False
29+
notify: false
30+
dnssec: false
2831

2932
internal: # The 'internal' view that is restricted to the 'internal' ACL.
3033
match_clients:
@@ -33,17 +36,17 @@ bind:
3336
mydomain.com: # Same as above - both views will serve the same zone.
3437
type: master
3538
file: internal.mydomain.com.txt # Different file - matches the internal zone below.
36-
# Again, this filename must match the corresponding zone name
39+
# Again, this filename must match the corresponding zone name
3740
# without the .txt extension (and be sure to use .txt as the extension).
38-
recursion: yes
39-
notify: False
40-
dnssec: False
41+
recursion: 'yes'
42+
notify: false
43+
dnssec: false
4144

4245
available_zones:
4346
external.mydomain.com: # Beginning of the 'external' zone definition.
4447
file: external.mydomain.com.txt # The file in which to save this zone's record set - matches the file
4548
# specified in the 'external' view.
46-
49+
4750
soa: # Declare the SOA RRs for the zone
4851
ns: ns1.external.mydomain.com # Required
4952
contact: [email protected] # Required
@@ -67,11 +70,11 @@ bind:
6770
CNAME:
6871
login: portal.mydomain.com.
6972
dashboard: www.mydomain.com.
70-
73+
7174
internal.mydomain.com: # Beginning of the 'internal' zone definition.
7275
file: internal.mydomain.com.txt # The file in which to save this zone's record set - matches the file
7376
# specified in the 'internal' view.
74-
77+
7578
soa: # Declare the SOA RRs for the zone
7679
ns: ns1.mydomain.com # Required
7780
contact: [email protected] # Required

0 commit comments

Comments
 (0)