Add top-level lint/fmt tox jobs

This is to add a top-level lint/fmt job to Pegleg so that tox -e lint
is executed in CICD. lint is included under envlist to accomplish this.
fmt is excluded from envlist as it doesn't need to be executed in CICD
but is included nonetheless for convenience.

Also fixes some typos.

Change-Id: I76165704b32653c98e506ddde71c8240d5f28492
This commit is contained in:
Felipe Monteiro 2018-04-25 19:18:40 +01:00 committed by Mark Burnett
parent 052fd683c9
commit f4e0164466
3 changed files with 16 additions and 6 deletions

View File

@ -41,8 +41,8 @@ DECKHAND_SCHEMAS = {
def full(fail_on_missing_sub_src=False, exclude_lint=None, warn_lint=None):
messages = []
# If policy is cleartext and error is added this will put
# that particular message into the warns list and all other will
# be added to the error list if SCHMEA_STORAGE_POLICY_MITCHMATCH_FLAG
# that particular message into the warns list and all others will
# be added to the error list if SCHEMA_STORAGE_POLICY_MISMATCH_FLAG
messages.extend(_verify_file_contents())
# Deckhand Rendering completes without error
@ -160,14 +160,13 @@ def _verify_document(document, schemas, filename):
def _verify_deckhand_render(fail_on_missing_sub_src=False):
documents = []
for filename in util.files.all():
with open(filename) as f:
documents.extend(list(yaml.safe_load_all(f)))
rendered_documents, errors = util.deckhand.deckhand_render(
_, errors = util.deckhand.deckhand_render(
documents=documents,
fail_on_missing_sub_src=fail_on_missing_sub_src,
validate=True,

View File

@ -16,6 +16,7 @@ import tempfile
from pegleg import config
from pegleg.engine.util import files
def test_no_non_yamls(tmpdir):
p = tmpdir.mkdir("site_yamls").mkdir("global")
for x in range(3): # Create 3 YAML files
@ -25,6 +26,6 @@ def test_no_non_yamls(tmpdir):
results = list(files.all())
assert 3 == len(results)
# make sure only YAML files are returned
# Make sure only YAML files are returned
for i in results:
assert i.endswith('.yaml')

12
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
envlist = py35, docs
envlist = py35, lint, docs
# Allows docs to be built without setup.py having to exist. Requires that
# usedevelop be False as well (which it is by default).
skipsdist = True
@ -15,6 +15,16 @@ commands =
tox -c src/bin/pegleg/tox.ini -e py35
whitelist_externals = tox
[testenv:fmt]
commands =
tox -c src/bin/pegleg/tox.ini -e fmt
whitelist_externals = tox
[testenv:lint]
commands =
tox -c src/bin/pegleg/tox.ini -e lint
whitelist_externals = tox
[testenv:docs]
deps = -r{toxinidir}/docs/requirements.txt
commands =