ldcheck.py

changeset 63
8949af6a4279
parent 62
f0a6bf48b05e
child 65
f2dc17b830e0
child 77
d98502ae1f33
--- a/ldcheck.py	Sat Jun 08 01:32:25 2019 +0300
+++ b/ldcheck.py	Sat Jun 08 01:42:48 2019 +0300
@@ -64,31 +64,19 @@
 
 import argparse
 
-def default_problem_message(message):
-    if callable(message):
-        import inspect
-        spec = inspect.getfullargspec(message)
-        args = {}
-        assert not spec.varargs and not spec.varkw
-        for argname in spec.args + spec.kwonlyargs:
-            args[argname] = '<' + argname.replace('_', ' ') + '>'
-        return message(**args)
-    else:
-        return message
-
 class ListTestSuiteAction(argparse.Action):
     def __init__(self, option_strings, dest, nargs = None, **kwargs):
         super().__init__(option_strings, dest, nargs = 0, **kwargs)
     def __call__(self, *args, **kwargs):
-        from testsuite import load_tests, all_warning_types
+        import testsuite
         from sys import exit
         from re import sub
-        test_suite = load_tests()
-        for warning_type in sorted(all_warning_types(test_suite), key = lambda k: k.name):
+        test_suite = testsuite.load_tests()
+        for warning_type in testsuite.all_problem_types(test_suite):
             print(str.format('{name}: {severity}: "{message}"',
                 name = warning_type.name,
                 severity = warning_type.severity,
-                message = default_problem_message(warning_type.message),
+                message = warning_type.placeholder_message(),
             ))
         exit(0)
 

mercurial