mirror of
https://github.com/zerwes/ansible-fqcn-converter.git
synced 2025-02-25 18:55:30 -06:00
implemented warnings for ambiguous replacements as comments (closes #4)
This commit is contained in:
parent
40a757e6ad
commit
282e6e8903
@ -101,6 +101,13 @@ argparser.add_argument(
|
||||
default=False,
|
||||
help="write back changed files"
|
||||
)
|
||||
argparser.add_argument(
|
||||
'-W', '--no-write-warnings',
|
||||
dest='writewarnings',
|
||||
action='store_false',
|
||||
default=True,
|
||||
help="do not write warnings as comments to files and diff"
|
||||
)
|
||||
argparser.add_argument(
|
||||
'-b', '--backup-extension',
|
||||
dest='backupextension',
|
||||
@ -264,10 +271,14 @@ for f in parsefiles:
|
||||
else:
|
||||
print('*', file=sys.stderr, end='', flush=True)
|
||||
if len(fqcndict[fqcnmodule]) > 1:
|
||||
warnings.append(
|
||||
'alternative replacement of %s : %s' %
|
||||
(fqcnmodule, ' | '.join(fqcndict[fqcnmodule]),)
|
||||
)
|
||||
wtxt = ('possible ambiguous replacement: %s : %s' %
|
||||
(fqcnmodule, ' | '.join(fqcndict[fqcnmodule])))
|
||||
warnings.append(wtxt)
|
||||
if args.writewarnings:
|
||||
if args.writefiles:
|
||||
print('# %s\n' % wtxt)
|
||||
if args.printdiff:
|
||||
changedlines.append('# %s\n' % wtxt)
|
||||
else:
|
||||
print('.', file=sys.stderr, end='', flush=True)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user