mirror of https://github.com/ansible/ansible.git
ansible-test - Remove no-main-display sanity test
parent
6e15fb0ebf
commit
36d6860d80
@ -0,0 +1,3 @@
|
|||||||
|
minor_changes:
|
||||||
|
- ansible-test - Removed the ``no-main-display`` sanity test.
|
||||||
|
The unwanted pattern is unlikely to occur, since the test has existed since Ansible 2.8.
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"extensions": [
|
|
||||||
".py"
|
|
||||||
],
|
|
||||||
"prefixes": [
|
|
||||||
"lib/ansible/",
|
|
||||||
"plugins/"
|
|
||||||
],
|
|
||||||
"output": "path-line-column-message"
|
|
||||||
}
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
"""Disallow importing display from __main__."""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
MAIN_DISPLAY_IMPORT = 'from __main__ import display'
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Main entry point."""
|
|
||||||
for path in sys.argv[1:] or sys.stdin.read().splitlines():
|
|
||||||
with open(path, 'r', encoding='utf-8') as file:
|
|
||||||
for i, line in enumerate(file.readlines()):
|
|
||||||
if MAIN_DISPLAY_IMPORT in line:
|
|
||||||
lineno = i + 1
|
|
||||||
colno = line.index(MAIN_DISPLAY_IMPORT) + 1
|
|
||||||
print('%s:%d:%d: Display is a singleton, just import and instantiate' % (path, lineno, colno))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
Loading…
Reference in New Issue