Skip to content

Commit b4fbac2

Browse files
committed
feat(yamllint): include for this repo and apply rules throughout
* Semi-automated using `ssf-formula` (v0.5.0) * Fix (or ignore) errors shown below: ```bash postfix-formula$ $(grep "\- yamllint" .travis.yml | sed -e "s:^\s\+-\s\(.*\):\1:") ./postfix/osfamilymap.yaml 1:1 warning missing document start "---" (document-start) ./postfix/services.yaml 11:1 warning missing document start "---" (document-start) 12:1 warning comment not indented like content (comments-indentation) 221:1 warning comment not indented like content (comments-indentation) ./postfix/defaults.yaml 4:1 warning missing document start "---" (document-start) pillar.example 1:1 warning missing document start "---" (document-start) 2:25 warning truthy value should be one of [false, true] (truthy) 13:17 warning truthy value should be one of [false, true] (truthy) 16:17 warning truthy value should be one of [false, true] (truthy) 22:17 warning truthy value should be one of [false, true] (truthy) 23:17 warning truthy value should be one of [false, true] (truthy) 25:17 warning truthy value should be one of [false, true] (truthy) 29:17 warning truthy value should be one of [false, true] (truthy) 31:17 warning truthy value should be one of [false, true] (truthy) 35:17 warning truthy value should be one of [false, true] (truthy) 47:15 warning truthy value should be one of [false, true] (truthy) 50:18 warning truthy value should be one of [false, true] (truthy) 53:21 warning truthy value should be one of [false, true] (truthy) 62:24 warning truthy value should be one of [false, true] (truthy) 66:31 warning truthy value should be one of [false, true] (truthy) 69:19 warning truthy value should be one of [false, true] (truthy) 70:19 warning truthy value should be one of [false, true] (truthy) 73:14 warning truthy value should be one of [false, true] (truthy) 74:21 warning truthy value should be one of [false, true] (truthy) 78:14 warning truthy value should be one of [false, true] (truthy) 89:15 error trailing spaces (trailing-spaces) 96:6 warning missing starting space in comment (comments) 130:89 error line too long (105 > 88 characters) (line-length) 131:89 error line too long (101 > 88 characters) (line-length) 152:5 error duplication of key "sender_canonical_maps" in mapping (key-duplicates) 154:5 error duplication of key "virtual_alias_maps" in mapping (key-duplicates) 190:5 error duplication of key "use_file" in mapping (key-duplicates) 235:9 error wrong indentation: expected 10 but found 8 (indentation) 248:1 error duplication of key "postfix" in mapping (key-duplicates) 258:85 error trailing spaces (trailing-spaces) ```
1 parent aa0ba50 commit b4fbac2

File tree

7 files changed

+75
-33
lines changed

7 files changed

+75
-33
lines changed

.travis.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
---
44
stages:
55
- test
6-
- commitlint
6+
- lint
77
- name: release
88
if: branch = master AND type != pull_request
99

@@ -45,16 +45,21 @@ script:
4545

4646
jobs:
4747
include:
48-
# Define the commitlint stage
49-
- stage: commitlint
48+
# Define the `lint` stage (runs `yamllint` and `commitlint`)
49+
- stage: lint
5050
language: node_js
5151
node_js: lts/*
5252
before_install: skip
5353
script:
54+
# Install and run `yamllint`
55+
- pip install --user yamllint
56+
# yamllint disable-line rule:line-length
57+
- yamllint -s . .yamllint pillar.example test/salt/pillar/default.sls
58+
# Install and run `commitlint`
5459
- npm install @commitlint/config-conventional -D
5560
- npm install @commitlint/travis-cli -D
5661
- commitlint-travis
57-
# Define the release stage that runs semantic-release
62+
# Define the release stage that runs `semantic-release`
5863
- stage: release
5964
language: node_js
6065
node_js: lts/*

.yamllint

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
# Extend the `default` configuration provided by `yamllint`
5+
extends: default
6+
7+
# Files to ignore completely
8+
# 1. All YAML files under directory `node_modules/`, introduced during the Travis run
9+
ignore: |
10+
node_modules/
11+
12+
rules:
13+
key-duplicates:
14+
ignore: |
15+
pillar.example
16+
line-length:
17+
# Increase from default of `80`
18+
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
19+
max: 88

pillar.example

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
postfix:
2-
manage_master_config: True
5+
manage_master_config: true
36
master_config:
47
# Preferred way of managing services/processes. This allows for finegrained
58
# control over each service. See postfix/services.yaml for defaults that can
@@ -10,29 +13,29 @@ postfix:
1013
maxproc: 10
1114
# Enable oldstyle TLS wrapped SMTP
1215
smtps:
13-
enable: True
16+
enable: true
1417
# Enable submission service on port 587/tcp with custom options
1518
submission:
16-
enable: True
19+
enable: true
1720
args:
1821
- "-o smtpd_tls_security_level=encrypt"
1922
- "-o smtpd_sasl_auth_enable=yes"
2023
- "-o smtpd_client_restrictions: permit_sasl_authenticated,reject"
2124
tlsproxy:
22-
enable: True
23-
chroot: True
25+
enable: true
26+
chroot: true
2427
uucp:
25-
enable: True
28+
enable: true
2629
# Dovecot delivery via deliver binary. For better performance, investigate
2730
# using LMTP instead: <https://wiki.dovecot.org/LMTP>
2831
dovecot:
29-
chroot: False
32+
chroot: false
3033
command: pipe
31-
enable: True
34+
enable: true
3235
extras: '-d ${recipient}'
3336
flags: DRhu
3437
type: unix
35-
unpriv: False
38+
unpriv: false
3639
user: vmail:vmail
3740
argv: /usr/lib/dovecot/deliver
3841
# Completely customized mail-delivery-agent entry. Will be appended to the
@@ -44,13 +47,13 @@ postfix:
4447
flags: DRhu
4548
user: mail
4649
# Wrap the output in master.cf at 78 chars for better readability
47-
wrap: True
50+
wrap: true
4851
# Avoid user and arvg settings to allow define internal processes
4952
# needed for randomizing relay IP (randmap functionality)
50-
no_args: True
53+
no_args: true
5154

5255
# Backwards compatible definition of dovecot delivery in master.cf
53-
enable_dovecot: False
56+
enable_dovecot: false
5457
# The following are the default values:
5558
dovecot:
5659
user: vmail
@@ -59,23 +62,23 @@ postfix:
5962
argv: "/usr/lib/dovecot/deliver"
6063

6164
# Backwards compatible definition of submission listener in master.cf
62-
enable_submission: False
65+
enable_submission: false
6366
# To replace the defaults use this:
6467
submission:
6568
smtpd_tls_security_level: encrypt
66-
smtpd_sasl_auth_enable: yes
69+
smtpd_sasl_auth_enable: 'yes'
6770
smtpd_client_restrictions: permit_sasl_authenticated,reject
6871

69-
enable_service: True
70-
reload_service: True
72+
enable_service: true
73+
reload_service: true
7174

7275
postgrey:
73-
enabled: True
74-
enable_service: True
76+
enabled: true
77+
enable_service: true
7578
location: inet:172.16.0.5:6379
7679

7780
policyd-spf:
78-
enabled: True
81+
enabled: true
7982
time_limit: 7200s
8083

8184
config:
@@ -86,14 +89,14 @@ postfix:
8689
readme_directory: 'no'
8790
myhostname: localhost
8891
mydestination: localhost, localhost.localdomain
89-
relayhost:
92+
relayhost:
9093
mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
9194
mailbox_size_limit: 0
9295
recipient_delimiter: +
9396
inet_interfaces: all
9497
inet_protocols: all
9598

96-
#postsrsd:
99+
# postsrsd:
97100
sender_canonical_maps: tcp:127.0.0.1:10001
98101
sender_canonical_classes: envelope_sender
99102
recipient_canonical_maps: tcp:127.0.0.1:10002
@@ -127,8 +130,14 @@ postfix:
127130
smtpd_sasl_auth_enable: 'yes'
128131
smtpd_sasl_type: dovecot
129132
smtpd_sasl_path: /var/run/dovecot/auth-client
130-
smtpd_recipient_restrictions: permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
131-
smtpd_relay_restrictions: permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
133+
smtpd_recipient_restrictions: >-
134+
permit_mynetworks,
135+
permit_sasl_authenticated,
136+
reject_unauth_destination
137+
smtpd_relay_restrictions: >-
138+
permit_mynetworks,
139+
permit_sasl_authenticated,
140+
reject_unauth_destination
132141
smtpd_sasl_security_options: noanonymous
133142
smtpd_sasl_tls_security_options: $smtpd_sasl_security_options
134143
smtpd_tls_auth_only: 'yes'
@@ -232,8 +241,8 @@ postfix:
232241

233242
virtual_alias_maps:
234243
- groupaliasexample:
235-
236-
244+
245+
237246
- singlealiasexample: [email protected]
238247

239248

@@ -255,4 +264,4 @@ postfix:
255264
root:
256265
- me
257266
virtual_alias_2_maps:
258-
- '/(\S+)_(devel|preprod|prod)@sub.example.com$/': '$(1)@$(2).sub.example.com'
267+
- '/(\S+)_(devel|preprod|prod)@sub.example.com$/': '$(1)@$(2).sub.example.com'

postfix/defaults.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=yaml
3-
3+
---
44
postfix:
55
aliases_file: /etc/aliases
66
config_path: /etc/postfix

postfix/osfamilymap.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
Arch:
25
policyd_spf_pkg: python-postfix-policyd-spf
36

postfix/services.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
# Default Postfix master processes as defined by postfix
25
#
36
# The dictionary is keyed off the service name ("smtp", "smtpd", etc.) except
@@ -9,7 +12,7 @@
912
#
1013

1114
defaults:
12-
# Postfix internal services/processes defaults
15+
# Postfix internal services/processes defaults
1316
smtp:
1417
chroot: false
1518
command: smtpd
@@ -218,7 +221,7 @@ defaults:
218221
maxproc: 1
219222
type: unix
220223

221-
# Postfix MDA definitions, these are optional and commented out by default
224+
# Postfix MDA definitions, these are optional and commented out by default
222225
maildrop:
223226
argv: /usr/local/bin/maildrop
224227
chroot: false

test/integration/default/inspec.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
name: default
25
title: postfix formula
36
maintainer: SaltStack Formulas

0 commit comments

Comments
 (0)