Skip to content

Commit 1f0fd92

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 postgres-formula$ $(grep "\- yamllint" .travis.yml | sed -e "s:^\s\+-\s\(.*\):\1:") ./postgres/repo.yaml 4:2 error syntax error: found character '%' that cannot start any token 6:89 error line too long (110 > 88 characters) (line-length) 9:89 error line too long (95 > 88 characters) (line-length) 13:89 error line too long (104 > 88 characters) (line-length) 14:89 error line too long (106 > 88 characters) (line-length) ./postgres/defaults.yaml 3:1 warning missing document start "---" (document-start) 4:22 warning truthy value should be one of [false, true] (truthy) 5:16 warning truthy value should be one of [false, true] (truthy) 5:22 warning too few spaces before comment (comments) 20:10 warning truthy value should be one of [false, true] (truthy) 40:8 warning missing starting space in comment (comments) 41:89 error line too long (97 > 88 characters) (line-length) 71:11 error too many spaces after colon (colons) 72:12 warning truthy value should be one of [false, true] (truthy) 74:15 warning truthy value should be one of [false, true] (truthy) 85:6 warning missing starting space in comment (comments) 89:11 warning truthy value should be one of [false, true] (truthy) 90:24 warning truthy value should be one of [false, true] (truthy) 91:56 error too few spaces after comma (commas) ./postgres/codenamemap.yaml 3:2 error syntax error: found character '%' that cannot start any token 8:89 error line too long (98 > 88 characters) (line-length) 49:89 error line too long (110 > 88 characters) (line-length) 53:89 error line too long (99 > 88 characters) (line-length) ./postgres/osmap.yaml 1:2 error syntax error: found character '%' that cannot start any token 5:89 error line too long (115 > 88 characters) (line-length) ./postgres/osfamilymap.yaml 1:2 error syntax error: found character '%' that cannot start any token 57:89 error line too long (90 > 88 characters) (line-length) 58:89 error line too long (113 > 88 characters) (line-length) 134:89 error line too long (103 > 88 characters) (line-length) 135:89 error line too long (127 > 88 characters) (line-length) 205:89 error line too long (91 > 88 characters) (line-length) 206:89 error line too long (91 > 88 characters) (line-length) pillar.example 3:1 warning missing document start "---" (document-start) 8:22 warning truthy value should be one of [false, true] (truthy) 13:16 warning truthy value should be one of [false, true] (truthy) 20:4 warning missing starting space in comment (comments) 21:4 warning missing starting space in comment (comments) 42:4 warning missing starting space in comment (comments) 65:4 warning missing starting space in comment (comments) 87:4 error syntax error: found character '%' that cannot start any token test/salt/pillar/postgres.sls 4:2 error syntax error: found character '%' that cannot start any token ```
1 parent 115f638 commit 1f0fd92

File tree

9 files changed

+96
-47
lines changed

9 files changed

+96
-47
lines changed

.travis.yml

+9-4
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

@@ -47,16 +47,21 @@ script:
4747

4848
jobs:
4949
include:
50-
# Define the commitlint stage
51-
- stage: commitlint
50+
# Define the `lint` stage (runs `yamllint` and `commitlint`)
51+
- stage: lint
5252
language: node_js
5353
node_js: lts/*
5454
before_install: skip
5555
script:
56+
# Install and run `yamllint`
57+
- pip install --user yamllint
58+
# yamllint disable-line rule:line-length
59+
- yamllint -s . .yamllint pillar.example test/salt/pillar/postgres.sls
60+
# Install and run `commitlint`
5661
- npm install @commitlint/config-conventional -D
5762
- npm install @commitlint/travis-cli -D
5863
- commitlint-travis
59-
# Define the release stage that runs semantic-release
64+
# Define the release stage that runs `semantic-release`
6065
- stage: release
6166
language: node_js
6267
node_js: lts/*

.yamllint

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
# 2. All YAML files heavily reliant on Jinja; these can be tackled in a subsequent PR
10+
ignore: |
11+
node_modules/
12+
pillar.example
13+
postgres/codenamemap.yaml
14+
postgres/osfamilymap.yaml
15+
postgres/osmap.yaml
16+
postgres/repo.yaml
17+
test/salt/pillar/postgres.sls
18+
19+
rules:
20+
line-length:
21+
# Increase from default of `80`
22+
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
23+
max: 88

pillar.example

+32-29
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
# Port to use for the cluster -- can be used to provide a non-standard port
25
# NOTE: If already set in the minion config, that value takes priority
36
postgres.port: '5432'
47

58
postgres:
69
# UPSTREAM REPO
7-
# Set True to configure upstream postgresql.org repository for YUM/APT/ZYPP
8-
use_upstream_repo: False
9-
# Version to install from upstream repository (if upstream_repo: True)
10+
# Set true to configure upstream postgresql.org repository for YUM/APT/ZYPP
11+
use_upstream_repo: false
12+
# Version to install from upstream repository (if upstream_repo: true)
1013
version: '10'
11-
# Set True to add a file in /etc/profile.d adding the bin dir in $PATH
14+
# Set true to add a file in /etc/profile.d adding the bin dir in $PATH
1215
# as packages from upstream put them somewhere like /usr/pgsql-10/bin
13-
add_profile: False
16+
add_profile: false
1417
# If automatic package installation fails, use `fromrepo` to specify the
15-
# upstream repo to install packages from [#133, #185] (if upstream_repo: True)
18+
# upstream repo to install packages from [#133, #185] (if upstream_repo: true)
1619
fromrepo: 'jessie-pgdg'
1720

1821
### MACOS
1922
# Set to 'postgresapp' OR 'homebrew' for MacOS
20-
#use_upstream_repo: 'postgresapp'
21-
#use_upstream_repo: 'homebrew'
23+
# use_upstream_repo: 'postgresapp'
24+
# use_upstream_repo: 'homebrew'
2225

2326
# PACKAGE
2427
# These pillars are typically never required.
@@ -27,7 +30,7 @@ postgres:
2730
# service:
2831
# name: 'postgresql'
2932
# flags: -w -s -m fast
30-
# sysrc: True
33+
# sysrc: true
3134
pkgs_extra:
3235
- postgresql-contrib
3336
- postgresql-plpython
@@ -39,7 +42,7 @@ postgres:
3942
locale: en_US.UTF-8
4043
# encoding: UTF8
4144

42-
#'Alternatives system' priority incremental. 0 disables feature.
45+
# 'Alternatives system' priority incremental. 0 disables feature.
4346
linux:
4447
altpriority: 30
4548

@@ -62,7 +65,7 @@ postgres:
6265
# are authenticated, which PostgreSQL user names they can use, which
6366
# databases they can access. Records take one of these forms:
6467
#
65-
#acls:
68+
# acls:
6669
# - ['local', 'DATABASE', 'USER', 'METHOD']
6770
# - ['host', 'DATABASE', 'USER', 'ADDRESS', 'METHOD']
6871
# - ['hostssl', 'DATABASE', 'USER', 'ADDRESS', 'METHOD']
@@ -83,7 +86,7 @@ postgres:
8386
- ['users_as_appuser', 'jsmith', 'connuser']
8487

8588
# Backup extension for configuration files, defaults to ``.bak``.
86-
# Set ``False`` to stop creation of backups when config files change.
89+
# Set ``false`` to stop creation of backups when config files change.
8790
{%- if salt['status.time']|default(none) is callable %}
8891
config_backup: ".backup@{{ salt['status.time']('%y-%m-%d_%H:%M:%S') }}"
8992
{%- endif %}
@@ -93,9 +96,9 @@ postgres:
9396
# If Salt is unable to detect init system running in the scope of state run,
9497
# probably we are trying to bake a container/VM image with PostgreSQL.
9598
# Use ``bake_image`` setting to control how PostgreSQL will be started: if set
96-
# to ``True`` the raw ``pg_ctl`` will be utilized instead of packaged init
99+
# to ``true`` the raw ``pg_ctl`` will be utilized instead of packaged init
97100
# script, job or unit run with Salt ``service`` state.
98-
bake_image: True
101+
bake_image: true
99102

100103
{%- endif %}
101104

@@ -106,7 +109,7 @@ postgres:
106109
#
107110
# Format is the following:
108111
#
109-
#<users|tablespaces|databases|schemas|extensions>:
112+
# <users|tablespaces|databases|schemas|extensions>:
110113
# NAME:
111114
# ensure: <present|absent> # 'present' is the default
112115
# ARGUMENT: VALUE
@@ -117,32 +120,32 @@ postgres:
117120
#
118121
# For example, the Pillar:
119122
#
120-
#users:
123+
# users:
121124
# testUser:
122125
# password: test
123126
#
124127
# will render such state:
125128
#
126-
#postgres_user-testUser:
129+
# postgres_user-testUser:
127130
# postgres_user.present:
128131
# - name: testUser
129132
# - password: test
130133
users:
131134
localUser:
132135
ensure: present
133136
password: '98ruj923h4rf'
134-
createdb: False
135-
createroles: False
136-
inherit: True
137-
replication: False
137+
createdb: false
138+
createroles: false
139+
inherit: true
140+
replication: false
138141

139142
remoteUser:
140143
ensure: present
141144
password: '98ruj923h4rf'
142-
createdb: False
143-
createroles: False
144-
inherit: True
145-
replication: False
145+
createdb: false
146+
createroles: false
147+
inherit: true
148+
replication: false
146149

147150
absentUser:
148151
ensure: absent
@@ -183,14 +186,14 @@ postgres:
183186

184187
# optional extensions to install in schema
185188
extensions:
189+
# postgis: {}
186190
uuid-ossp:
187191
schema: uuid-ossp
188192
maintenance_db: db1
189-
#postgis: {}
190193

191194
remove:
192-
data: True
193-
multiple_releases: True
194-
releases: ['9.6', '10',]
195+
data: true
196+
multiple_releases: true
197+
releases: ['9.6', '10']
195198

196199
# vim: ft=yaml ts=2 sts=2 sw=2 et

postgres/codenamemap.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
### Set parameters based on PostgreSQL version supplied with particular distro
25

36
{% import_yaml "postgres/repo.yaml" as repo %}

postgres/defaults.yaml

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
# Default lookup dictionary
25

36
postgres:
4-
use_upstream_repo: True
5-
add_profile: False # add bin_dir to $PATH, if installed from repos
7+
use_upstream_repo: true
8+
add_profile: false # add bin_dir to $PATH, if installed from repos
69
version: '10'
710
pkg: postgresql
811
pkgs_extra: []
@@ -17,7 +20,7 @@ postgres:
1720
group: postgres
1821

1922
prepare_cluster:
20-
run: True
23+
run: true
2124
pgcommand: initdb -D
2225
pgtestfile: PG_VERSION
2326
user: postgres
@@ -37,7 +40,8 @@ postgres:
3740
archive: postgres.dmg
3841
tmpdir: /tmp/postgrestmp
3942
postgresapp:
40-
#See: https://github.com/PostgresApp/PostgresApp/releases/
43+
# See: https://github.com/PostgresApp/PostgresApp/releases/
44+
# yamllint disable-line rule:line-length
4145
url: https://github.com/PostgresApp/PostgresApp/releases/download/v2.1.1/Postgres-2.1.1.dmg
4246
sum: sha256=ac0656b522a58fd337931313f09509c09610c4a6078fe0b8e469e69af1e1750b
4347
homebrew:
@@ -68,10 +72,10 @@ postgres:
6872
config_backup: '.bak'
6973

7074
service:
71-
name: postgresql
72-
sysrc: False
75+
name: postgresql
76+
sysrc: false
7377

74-
bake_image: False
78+
bake_image: false
7579

7680
fromrepo: ''
7781

@@ -82,10 +86,10 @@ postgres:
8286
extensions: {}
8387

8488
linux:
85-
#Alternatives system are disabled by a 'altpriority=0' pillar.
89+
# Alternatives system are disabled by a 'altpriority=0' pillar.
8690
altpriority: 0
8791

8892
remove:
89-
data: False
90-
multiple_releases: False
91-
releases: ['9.2', '9.3', '9.4', '9.5', '9.6', '10',]
93+
data: false
94+
multiple_releases: false
95+
releases: ['9.2', '9.3', '9.4', '9.5', '9.6', '10']

postgres/osfamilymap.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
{% import_yaml "postgres/repo.yaml" as repo %}
25

36
{% set release = repo.version|replace('.', '') %}

postgres/osmap.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
{% import_yaml "postgres/repo.yaml" as repo %}
25

36
Fedora:
47
pkg_repo:
8+
# yamllint disable-line rule:line-length
59
baseurl: 'https://download.postgresql.org/pub/repos/yum/{{ repo.version }}/fedora/fedora-$releasever-$basearch'
610
remove:
7-
releases: ['9.4', '9.5', '9.6', '10',]
8-
9-
# vim: ft=sls
11+
releases: ['9.4', '9.5', '9.6', '10']

postgres/repo.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
# This file allows to get PostgreSQL version and upstream repo settings
25
# early from Pillar to set correct lookup dictionaty items
36

test/integration/default/inspec.yml

+3
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: postgres formula
36
maintainer: SaltStack Formulas

0 commit comments

Comments
 (0)