Skip to content

Commit ae0c1d8

Browse files
authored
initial pass at salt-lint for files changed in commits (#263)
* initial pass at salt-lint for files changed in commits * python version needs to be in quotes * filter linter to only look at .sls files * fix one of two linting errors in pillar/base/users.sls, leave second to trip a CI failure for linting * add a configuration file for salt-lint * fix second of two linting errors in pillar/base/users.sls
1 parent dc14fac commit ae0c1d8

File tree

4 files changed

+48
-3
lines changed

4 files changed

+48
-3
lines changed

.github/workflows/lint.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
salt-lint:
11+
name: Salt Lint
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
20+
- name: Setup Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: "3.10"
24+
25+
- name: Install tox and any other packages
26+
run: pip install tox
27+
28+
- id: files
29+
name: Determine changed files
30+
uses: jitterbit/get-changed-files@v1
31+
with:
32+
format: json
33+
34+
- name: Run Linter
35+
run: tox -e lint -- $(jq -r '.[] | select(. | endswith(".sls"))' <<< '${{ steps.files.outputs.added_modified }}' | xargs)

.salt-lint

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
skip_list:
3+
- 204

pillar/base/users.sls

+2-2
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ users:
275275
accesss:
276276
codespeed:
277277
allowed: True
278-
sudo: True
278+
sudo: True
279279

280280
jafo:
281281
fullname: "Sean Reifschneider"
@@ -444,7 +444,7 @@ users:
444444
sudo: True
445445
allowed: True
446446
groups:
447-
- roundup
447+
- roundup
448448

449449
lemburg:
450450
fullname: "Marc-Andre Lemburg"

tox.ini

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = docs
2+
envlist = docs, lint
33
skipsdist = true
44

55
[testenv:docs]
@@ -9,3 +9,10 @@ deps =
99
basepython = python3
1010
commands =
1111
sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html
12+
13+
[testenv:lint]
14+
deps =
15+
salt-lint
16+
basepython = python3
17+
commands =
18+
salt-lint {posargs:salt/top.sls}

0 commit comments

Comments
 (0)