Browse Source

Revert "Extract pep8 messages for inline comments"

There seems to be a problem with openstack-zuul-jobs [1].

This reverts commit 421f533b61.

[1] http://logs.openstack.org/86/610386/3/gate/openstack-zuul-jobs-linters/a8c857d/job-output.txt.gz#_2018-10-18_07_14_42_431592

Change-Id: Iac5236221e33df4613cc2f7a2edcffc323902320
changes/49/611549/1
Tobias Henkel 7 months ago
parent
commit
b35f47190a
4 changed files with 1 additions and 102 deletions
  1. 0
    75
      roles/tox/library/tox_parse_output.py
  2. 0
    23
      roles/tox/tasks/main.yaml
  3. 1
    0
      test-requirements.txt
  4. 0
    4
      tox.ini

+ 0
- 75
roles/tox/library/tox_parse_output.py View File

@@ -1,75 +0,0 @@
1
-#!/usr/bin/python
2
-
3
-# Copyright (c) 2018 Red Hat
4
-#
5
-# This module is free software: you can redistribute it and/or modify
6
-# it under the terms of the GNU General Public License as published by
7
-# the Free Software Foundation, either version 3 of the License, or
8
-# (at your option) any later version.
9
-#
10
-# This software is distributed in the hope that it will be useful,
11
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
-# GNU General Public License for more details.
14
-#
15
-# You should have received a copy of the GNU General Public License
16
-# along with this software.  If not, see <http://www.gnu.org/licenses/>.
17
-from __future__ import absolute_import, division, print_function
18
-__metaclass__ = type
19
-
20
-DOCUMENTATION = '''
21
----
22
-module: tox_parse_output
23
-short_description: Parses the output of tox looking for per-line comments
24
-author: Monty Taylor (@mordred)
25
-description:
26
-  - Looks for output from the tox command to find content that could be
27
-    returned as inline comments.
28
-requirements:
29
-  - "python >= 3.5"
30
-options:
31
-  tox_output:
32
-    description:
33
-      - Output from the tox command run
34
-    required: true
35
-    type: str
36
-'''
37
-from ansible.module_utils.basic import AnsibleModule
38
-
39
-
40
-def extract_file_comments(tox_output):
41
-    ret = {}
42
-    for line in tox_output.split('\n'):
43
-        try:
44
-            if not line:
45
-                continue
46
-            if line[0].isspace():
47
-                continue
48
-            if ': ' not in line:
49
-                continue
50
-            (file_info, message) = line.split(': ', 1)
51
-            (file_path, start_line, start_char) = file_info.split(':')
52
-            if file_path.startswith('./'):
53
-                file_path = file_path[2:]
54
-            ret.setdefault(file_path, [])
55
-            ret[file_path].append(dict(line=int(start_line),
56
-                                       message=message))
57
-        except Exception:
58
-            pass
59
-    return ret
60
-
61
-
62
-def main():
63
-    module = AnsibleModule(
64
-        argument_spec=dict(
65
-            tox_output=dict(required=True, type='str'),
66
-        )
67
-    )
68
-    tox_output = module.params['tox_output']
69
-
70
-    file_comments = extract_file_comments(tox_output)
71
-    module.exit_json(changed=False, file_comments=file_comments)
72
-
73
-
74
-if __name__ == '__main__':
75
-    main()

+ 0
- 23
roles/tox/tasks/main.yaml View File

@@ -36,26 +36,3 @@
36 36
     chdir: "{{ zuul_work_dir }}"
37 37
   environment: "{{ tox_environment|combine(tox_constraints_env|default({})) }}"
38 38
   command: "{{ tox_executable }} -e{{ tox_envlist }} {{ tox_extra_args }}"
39
-  failed_when: false
40
-  register: tox_output
41
-
42
-- name: Look for output
43
-  tox_parse_output:
44
-    tox_output: '{{ tox_output.stdout }}'
45
-  register: file_comments
46
-
47
-- name: Return file comments to Zuul
48
-  when: file_comments.file_comments
49
-  delegate_to: localhost
50
-  zuul_return:
51
-    data:
52
-      zuul:
53
-        file_comments: '{{ file_comments.file_comments }}'
54
-  tags:
55
-    # Avoid "no action detected in task" linter error
56
-    - skip_ansible_lint
57
-
58
-- name: Return tox status
59
-  fail:
60
-    msg: 'tox exited with return code {{ tox_output.rc }}'
61
-  when: tox_output.rc != 0

+ 1
- 0
test-requirements.txt View File

@@ -2,6 +2,7 @@
2 2
 # of appearance. Changing the order has an impact on the overall integration
3 3
 # process, which may cause wedges in the gate later.
4 4
 flake8
5
+zuul
5 6
 
6 7
 # We need to pin the ansible version directly here; per the
7 8
 # deprecation policy it should trail the version used by Zuul by 4

+ 0
- 4
tox.ini View File

@@ -26,10 +26,6 @@ commands =
26 26
   sphinx-build -E -W -d doc/build/doctrees -b html doc/source/ doc/build/html
27 27
 
28 28
 [testenv:linters]
29
-deps =
30
-     # Zuul is required to supply the zuul ansible modules for ansible-lint
31
-     -r{toxinidir}/test-requirements.txt
32
-     -egit+https://git.openstack.org/openstack-infra/zuul#egg=zuul
33 29
 passenv =
34 30
   # NOTE(pabelanger): if you'd like to run tox -elinters locally, you'll need
35 31
   # to export ANSIBLE_ROLES_PATH pointing to the currect repos.

Loading…
Cancel
Save