From 48f65d6f55f95c71cb74a54de013d879c1171deb Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Wed, 19 Jul 2017 08:47:17 -0700 Subject: [PATCH] Lint cppo: Docstrings, warning disables This actually disables all pylint warnings we haven't fixed because, as of now, we don't intend to fix them. The arg parsing is suboptimal, but if you can make sure that existing scripts using cppo don't break by turning this into argparse code, be my guest. I didn't see an obvious way to do it any better than what we have now. When cppo is rewritten, we'll create a new runner with its own argparse-based command parser. Until then, I'm inclined to leave it be. This is just part of a larger rewrite I started working on, but ... it's not needed now. --- cppo | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cppo b/cppo index 4cf6931..e35c25c 100755 --- a/cppo +++ b/cppo @@ -53,10 +53,17 @@ import blocksfree.logging as logging LOG = logging.LOG def usage(exitcode=1): + """Print script usage and exit "gracefully" + + Args: + exitcode: The shell return value (1 is appropriate for errors) + """ print(sys.modules[__name__].__doc__) sys.exit(exitcode) +#pylint: disable=too-many-branches,too-many-statements def main() -> None: + """provide the legacy cppo CLI interface""" # Setup logging handler = logging.StreamHandler(sys.stdout) formatter = logging.Formatter('{message}', style='{') @@ -64,10 +71,10 @@ def main() -> None: LOG.logger.addHandler(handler) LOG.setLevel(logging.DEBUG) - g = blocksfree.legacy.g + g = blocksfree.legacy.g #pylint: disable=invalid-name args = sys.argv - while True: # breaks when there are no more arguments starting with dash + while True: if len(args) == 1: usage() @@ -151,6 +158,7 @@ def main() -> None: sys.exit(2) blocksfree.legacy.run_cppo() +#pylint: enable=too-many-branches,too-many-statements if __name__ == '__main__': main()