mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-24 18:09:10 -07:00
Support comments in ansible-test flat files.
This commit is contained in:
parent
cb4bf04be6
commit
5a3000af19
13 changed files with 135 additions and 96 deletions
|
@ -15,6 +15,7 @@ from lib.util import (
|
|||
SubprocessError,
|
||||
display,
|
||||
run_command,
|
||||
read_lines_without_comments,
|
||||
)
|
||||
|
||||
from lib.config import (
|
||||
|
@ -37,17 +38,14 @@ class Pep8Test(SanitySingleVersion):
|
|||
:type targets: SanityTargets
|
||||
:rtype: TestResult
|
||||
"""
|
||||
with open(PEP8_SKIP_PATH, 'r') as skip_fd:
|
||||
skip_paths = skip_fd.read().splitlines()
|
||||
skip_paths = read_lines_without_comments(PEP8_SKIP_PATH)
|
||||
legacy_paths = read_lines_without_comments(PEP8_LEGACY_PATH)
|
||||
|
||||
with open(PEP8_LEGACY_PATH, 'r') as legacy_fd:
|
||||
legacy_paths = legacy_fd.read().splitlines()
|
||||
legacy_ignore_file = 'test/sanity/pep8/legacy-ignore.txt'
|
||||
legacy_ignore = set(read_lines_without_comments(legacy_ignore_file, remove_blank_lines=True))
|
||||
|
||||
with open('test/sanity/pep8/legacy-ignore.txt', 'r') as ignore_fd:
|
||||
legacy_ignore = set(ignore_fd.read().splitlines())
|
||||
|
||||
with open('test/sanity/pep8/current-ignore.txt', 'r') as ignore_fd:
|
||||
current_ignore = sorted(ignore_fd.read().splitlines())
|
||||
current_ignore_file = 'test/sanity/pep8/current-ignore.txt'
|
||||
current_ignore = sorted(read_lines_without_comments(current_ignore_file, remove_blank_lines=True))
|
||||
|
||||
skip_paths_set = set(skip_paths)
|
||||
legacy_paths_set = set(legacy_paths)
|
||||
|
@ -106,6 +104,9 @@ class Pep8Test(SanitySingleVersion):
|
|||
for path in legacy_paths:
|
||||
line += 1
|
||||
|
||||
if not path:
|
||||
continue
|
||||
|
||||
if not os.path.exists(path):
|
||||
# Keep files out of the list which no longer exist in the repo.
|
||||
errors.append(SanityMessage(
|
||||
|
@ -133,6 +134,9 @@ class Pep8Test(SanitySingleVersion):
|
|||
for path in skip_paths:
|
||||
line += 1
|
||||
|
||||
if not path:
|
||||
continue
|
||||
|
||||
if not os.path.exists(path):
|
||||
# Keep files out of the list which no longer exist in the repo.
|
||||
errors.append(SanityMessage(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue