From 88288540493f2c1245898379512628fa961e7828 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 31 May 2017 17:40:28 -0600 Subject: [PATCH] Fix a couple pylint issues. Fix a critical problem in code_checker that caused it to filter too many files. --- scripts/lib/CIME/XML/machines.py | 4 ++-- scripts/lib/CIME/code_checker.py | 4 ++-- scripts/lib/CIME/utils.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/lib/CIME/XML/machines.py b/scripts/lib/CIME/XML/machines.py index 9758d10363f..675908e80f9 100644 --- a/scripts/lib/CIME/XML/machines.py +++ b/scripts/lib/CIME/XML/machines.py @@ -38,7 +38,7 @@ def __init__(self, infile=None, files=None, machine=None): # Append the contents of $HOME/.cime/config_machines.xml if it exists # This could cause problems if node matchs are repeated when only one is expected local_infile = os.path.join(os.environ.get("HOME"),".cime","config_machines.xml") - logger.debug("Infile: {}" , local_infile) + logger.debug("Infile: {}".format(local_infile)) if os.path.exists(local_infile): GenericXML.read(self, local_infile, schema) @@ -211,7 +211,7 @@ def get_field_from_list(self, listname, reqval=None, attributes=None): expect(supported_values is not None, "No list found for " + listname + " on machine " + self.machine) - supported_values = supported_values.split(",") + supported_values = supported_values.split(",") #pylint: disable=no-member if reqval is None or reqval == "UNSET": return supported_values[0] diff --git a/scripts/lib/CIME/code_checker.py b/scripts/lib/CIME/code_checker.py index 227ce9b0ca0..f899fc99fb8 100644 --- a/scripts/lib/CIME/code_checker.py +++ b/scripts/lib/CIME/code_checker.py @@ -54,9 +54,9 @@ def _matches(file_path, file_ends): def _should_pylint_skip(filepath): ############################################################################### # TODO - get rid of this - list_of_directories_to_ignore = ("xmlconvertors", "pointclm", "point_clm", "tools", "machines", "apidocs") + list_of_directories_to_ignore = ("xmlconvertors", "pointclm", "point_clm", "tools", "machines", "apidocs", "doc") for dir_to_skip in list_of_directories_to_ignore: - if dir_to_skip in filepath: + if dir_to_skip + "/" in filepath: return True return False diff --git a/scripts/lib/CIME/utils.py b/scripts/lib/CIME/utils.py index 11a933bbc92..a78a274660e 100644 --- a/scripts/lib/CIME/utils.py +++ b/scripts/lib/CIME/utils.py @@ -247,7 +247,7 @@ def run_cmd_no_fail(cmd, input_str=None, from_dir=None, verbose=None, >>> run_cmd_no_fail('echo THE ERROR >&2; false') Traceback (most recent call last): ... - SystemExit: ERROR: Command: 'echo THE ERROR >&2; false' failed with error 'THE ERROR' + SystemExit: ERROR: Command: 'echo THE ERROR >&2; false' failed with error 'THE ERROR' from dir '/home/jgfouca/cime_yetanother/scripts/lib/CIME' >>> run_cmd_no_fail('grep foo', input_str='foo') 'foo'