From 2654d0338cb7760708ab120256a5342e86e6439f Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 18 May 2020 12:23:56 +0000 Subject: [PATCH] Revert "tox: update lint regex to not require column" This reverts commit 53f2444dbba473c22554af1689dfc444f3441018. Revert to avoid regression: https://review.opendev.org/710208 just gave a lot of new linting warnings that look new "py38: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()" Change-Id: I26c862255cce6b6c99a69d9e3f5f4354db90f953 --- .../library/test-cases/ansible-lint_output.yaml | 8 -------- roles/tox/library/test-cases/warning_output.yaml | 10 ++++++++++ roles/tox/library/tox_parse_output.py | 14 ++++++++++---- 3 files changed, 20 insertions(+), 12 deletions(-) delete mode 100644 roles/tox/library/test-cases/ansible-lint_output.yaml create mode 100644 roles/tox/library/test-cases/warning_output.yaml diff --git a/roles/tox/library/test-cases/ansible-lint_output.yaml b/roles/tox/library/test-cases/ansible-lint_output.yaml deleted file mode 100644 index 0d0e6ad58..000000000 --- a/roles/tox/library/test-cases/ansible-lint_output.yaml +++ /dev/null @@ -1,8 +0,0 @@ -workdir: . -output: | - roles/tox/tasks/main.yaml:41: [EZUULJOBS0001] Loop vars should have zj_ prefix - -comments: - roles/tox/tasks/main.yaml: - - line: 41 - message: "[EZUULJOBS0001] Loop vars should have zj_ prefix" diff --git a/roles/tox/library/test-cases/warning_output.yaml b/roles/tox/library/test-cases/warning_output.yaml new file mode 100644 index 000000000..4d0cebd94 --- /dev/null +++ b/roles/tox/library/test-cases/warning_output.yaml @@ -0,0 +1,10 @@ +--- +workdir: . +output: | + tests/test_discovery.py:25: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. + config = yaml.load(open('hiera/common.yaml', 'r')) + tests/test_discovery.py:714: UserWarning: Policy "foo:create_bar":"role:fizz" was deprecated in N in favor of "foo:create_bar":"". Reason: because of reasons. Either ensure your deployment is ready for the new default or copy/paste the deprecated policy into your policy file and maintain it manually. + warnings.warn(deprecated_msg) + WARNING [oslo_policy.policy] Policies ['foo', 'bar'] are part of a cyclical reference. + WARNING [oslo_policy.policy] Policies ['foo', 'bar'] are part of a cyclical reference. +comments: {} diff --git a/roles/tox/library/tox_parse_output.py b/roles/tox/library/tox_parse_output.py index 861a230e5..3a6d77c44 100644 --- a/roles/tox/library/tox_parse_output.py +++ b/roles/tox/library/tox_parse_output.py @@ -41,7 +41,8 @@ import re from ansible.module_utils.basic import AnsibleModule ANSI_RE = re.compile(r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]') -LINT_RE = re.compile(r"^([^:]*):(\d+):((\d+):)?\s?(.*)$") +PEP8_RE = re.compile(r"^(.*):(\d+):(\d+): (.*)$") +SPHINX_RE = re.compile(r"^([^:]*):([\d]+):(\w.+)$") def simple_matcher(line, regex, file_path_group, start_line_group, @@ -57,12 +58,17 @@ def simple_matcher(line, regex, file_path_group, start_line_group, return file_path, start_line, message -def lint_matcher(line): - return simple_matcher(line, LINT_RE, 1, 2, 5) +def pep8_matcher(line): + return simple_matcher(line, PEP8_RE, 1, 2, 4) + + +def sphinx_matcher(line): + return simple_matcher(line, SPHINX_RE, 1, 2, 3) matchers = [ - lint_matcher, + pep8_matcher, + sphinx_matcher, ]