-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a yaml linting subcommand (#1023)
Co-authored-by: Andreas Kloeckner <[email protected]>
- Loading branch information
1 parent
3c60b86
commit 3eee406
Showing
8 changed files
with
130 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extends: default | ||
rules: | ||
line-length: | ||
max: 200 | ||
level: warning | ||
document-start: disable | ||
indentation: disable | ||
empty-lines: disable | ||
commas: disable | ||
hyphens: disable | ||
comments: disable |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
extends: default | ||
|
||
rules: | ||
line-length: | ||
max: 200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | ||
bad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extends: default | ||
rules: | ||
line-length: | ||
max: 200 | ||
level: warning | ||
document-start: disable | ||
indentation: disable | ||
empty-lines: disable | ||
commas: disable | ||
hyphens: disable | ||
comments: disable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
import sys | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize("yaml_file", ["pass.yml", "fail.yml"]) | ||
def test_yaml_lint(yaml_file): | ||
from subprocess import Popen | ||
thisdir = os.path.dirname(os.path.realpath(__file__)) | ||
stream = Popen([sys.executable, "-m", "relate", "lint-yaml", | ||
"--config-file", | ||
os.path.join(thisdir, ".yamllint.yml"), | ||
os.path.join(thisdir, yaml_file)]) | ||
stream.wait() | ||
|
||
if stream.returncode and "pass" in yaml_file: | ||
raise Exception("File that was supposed to pass did not pass") | ||
elif stream.returncode == 0 and "fail" in yaml_file: | ||
raise Exception("File that was supposed to fail did not fail") |