Skip to content

Commit 8d08719

Browse files
committed
feat(yamllint): include for this repo and apply rules throughout
* Semi-automated using `ssf-formula` (v0.5.0) * Fix errors shown below: ```bash sudoers-formula$ $(grep "\- yamllint" .travis.yml | sed -e "s:^\s\+-\s\(.*\):\1:") pillar.example 6:23 warning truthy value should be one of [false, true] (truthy) test/salt/pillar/kitchen.sls 3:1 warning missing document start "---" (document-start) 7:1 error too many blank lines (1 > 0) (empty-lines) test/salt/pillar/default.sls 1:1 warning missing document start "---" (document-start) 3:23 warning truthy value should be one of [false, true] (truthy) ```
1 parent 9bfca09 commit 8d08719

6 files changed

Lines changed: 36 additions & 7 deletions

File tree

.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/kitchen.sls 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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
line-length:
14+
# Increase from default of `80`
15+
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
16+
max: 88

pillar.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
---
44
sudoers:
55
# By default the main sudoers file is managed by this formula (False to skip)
6-
manage_main_config: True
6+
manage_main_config: true
77
users:
88
johndoe:
99
- 'ALL=(ALL) ALL'

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: sudoers formula
36
maintainer: SaltStack Formulas

test/salt/pillar/default.sls

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
sudoers:
25
# By default the main sudoers file is managed by this formula (False to skip)
3-
manage_main_config: True
6+
manage_main_config: true
47
users:
58
johndoe:
69
- 'ALL=(ALL) ALL'

test/salt/pillar/kitchen.sls

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
# Pillar needed to run Inspec inside Docker image using sudo to authenticate
25
# Must be added to pillar of all test suites
36
sudoers:
47
users:
58
kitchen:
69
- 'ALL=(root) NOPASSWD: ALL'
7-

0 commit comments

Comments
 (0)