1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix deprecated issue creator (#55327)

This commit is contained in:
Matt Martz 2019-04-15 15:28:25 -05:00 committed by GitHub
parent 46420dd21a
commit 65dcb4242a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 13 deletions

View file

@ -56,13 +56,12 @@ args = parser.parse_args()
body_tmpl = args.template.read()
args.template.close()
text = args.problems.read()
args.problems.close()
text = args.problems[0].read()
args.problems[0].close()
for line in text.splitlines():
path, line, column, msg = line.split(':')
msg = msg.strip()
path = line.split(':')[0]
if path.endswith('__init__.py'):
component = os.path.basename(os.path.dirname(path))
else:
@ -73,7 +72,7 @@ for line in text.splitlines():
(component, ansible_major_version)
)
deprecated[component].append(
dict(title=title, msg=msg, path=path, line=line, column=column)
dict(title=title, path=path, line=line)
)
@ -84,15 +83,15 @@ repo = g.repository('ansible', 'ansible')
# so that we can later add the issue to a project column
# You will need the project and column IDs for this to work
# and then update the below lines
# project = repo.project(1749241)
# column = project.column(3314029)
# project = repo.project(2141803)
# project_column = project.column(4348504)
for component, items in deprecated.items():
title = items[0]['title']
msg = '\n'.join(i['msg'] for i in items)
path = '\n'.join(i['path'] for i in items)
body = body_tmpl % dict(component=component, msg=msg, path=path,
line=line, column=column,
path = '\n'.join(set((i['path']) for i in items))
line = '\n'.join(i['line'] for i in items)
body = body_tmpl % dict(component=component, path=path,
line=line,
version=ansible_major_version)
issue = repo.create_issue(title, body=body, labels=['deprecated'])
@ -102,5 +101,5 @@ for component, items in deprecated.items():
# Uncomment the next 2 lines if you want to add issues to a project
# Needs to be done in combination with the above code for selecting
# the project/column
# column.create_card_with_issue(issue)
# project_column.create_card_with_issue(issue)
# time.sleep(0.5)

View file

@ -2,7 +2,7 @@
%(component)s contains call to Display.deprecated or AnsibleModule.deprecate and is scheduled for removal
```
%(path)s:%(line)s:%(column)s: %(msg)s
%(line)s
```
##### ISSUE TYPE