diff --git a/.yamllint b/.yamllint new file mode 100644 index 00000000..e31949dc --- /dev/null +++ b/.yamllint @@ -0,0 +1,20 @@ +extends: default +ignore: | + .tox + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + document-start: disable + empty-lines: + max: 1 + max-end: 2 + indentation: + level: error + indent-sequences: consistent + line-length: disable + truthy: false diff --git a/bin/dib-lint b/bin/dib-lint index 5cdeb0c2..5048bc9b 100755 --- a/bin/dib-lint +++ b/bin/dib-lint @@ -276,17 +276,7 @@ fi echo "Checking YAML parsing..." for i in $(find $ELEMENTS_DIR -type f -name '*.yaml'); do echo "Parsing $i" - py_check=" -import yaml -import sys -try: - objs = yaml.safe_load(open('$i')) -except yaml.parser.ParserError: - sys.exit(1) -" - if ! python -c "$py_check"; then - error "$i is not a valid YAML file" - fi + yamllint -s -f parsable $i done echo "Checking pkg-map files..." for i in $(find $ELEMENTS_DIR -type f \ diff --git a/diskimage_builder/elements/dib-run-parts/package-installs.yaml b/diskimage_builder/elements/dib-run-parts/package-installs.yaml index fbeb930b..327cbd24 100644 --- a/diskimage_builder/elements/dib-run-parts/package-installs.yaml +++ b/diskimage_builder/elements/dib-run-parts/package-installs.yaml @@ -1 +1 @@ -dib-utils: \ No newline at end of file +dib-utils: diff --git a/diskimage_builder/elements/growroot/package-installs.yaml b/diskimage_builder/elements/growroot/package-installs.yaml index 3482d8f6..a427345c 100644 --- a/diskimage_builder/elements/growroot/package-installs.yaml +++ b/diskimage_builder/elements/growroot/package-installs.yaml @@ -1,2 +1,2 @@ growpart: -e2fsprogs: \ No newline at end of file +e2fsprogs: diff --git a/diskimage_builder/elements/yum-minimal/package-installs.yaml b/diskimage_builder/elements/yum-minimal/package-installs.yaml index 1b66417c..3ed6955e 100644 --- a/diskimage_builder/elements/yum-minimal/package-installs.yaml +++ b/diskimage_builder/elements/yum-minimal/package-installs.yaml @@ -17,4 +17,4 @@ linux-firmware-whence: # mirrors the default packages installed in upstream cloud images # to facilitate a basic network. NetworkManager: -dhcp-client: \ No newline at end of file +dhcp-client: diff --git a/test-requirements.txt b/test-requirements.txt index 560a57ad..31ac5c98 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -12,3 +12,5 @@ testrepository>=0.0.18 # Apache-2.0/BSD testtools>=2.2.0 # MIT coverage!=4.4,>=4.0 # Apache-2.0 + +yamllint>=1.23.0