diff --git a/azurelinuxagent/common/logcollector.py b/azurelinuxagent/common/logcollector.py index 0dc2d02bd0..687b37bbbf 100644 --- a/azurelinuxagent/common/logcollector.py +++ b/azurelinuxagent/common/logcollector.py @@ -220,7 +220,7 @@ def _process_manifest_file(self): if len(contents) != 2: # If it's not a comment or an empty line, it's a malformed entry if not entry.startswith("#") and len(entry.strip()) > 0: # pylint: disable=len-as-condition - _LOGGER.error("Couldn't parse \"{0}\"".format(entry)) # pylint: disable=W1202 + _LOGGER.error("Couldn't parse \"%s\"", entry) continue command, value = contents @@ -242,7 +242,7 @@ def _truncate_large_file(file_path): # Binary files cannot be truncated, don't include large binary files ext = os.path.splitext(file_path)[1] if ext in [".gz", ".zip", ".xz"]: - _LOGGER.warning("Discarding large binary file {0}".format(file_path)) # pylint: disable=W1202 + _LOGGER.warning("Discarding large binary file %s", file_path) return None truncated_file_path = os.path.join(_TRUNCATED_FILES_DIR, file_path.replace(os.path.sep, "_")) @@ -261,7 +261,7 @@ def _truncate_large_file(file_path): return truncated_file_path except OSError as e: # pylint: disable=C0103 - _LOGGER.error("Failed to truncate large file: {0}".format(ustr(e))) # pylint: disable=W1202 + _LOGGER.error("Failed to truncate large file: %s", ustr(e)) return None def _get_file_priority(self, file_entry): diff --git a/ci/2.7.pylintrc b/ci/2.7.pylintrc index 168e991578..0bccef14f7 100644 --- a/ci/2.7.pylintrc +++ b/ci/2.7.pylintrc @@ -13,7 +13,6 @@ # cell-var-from-loop: (hi-pri) A variable used in a closure is defined in a loop. This will result in all closures using the same value for the closed-over variable. # cyclic-import: (hi-pri) Used when a cyclic import between two or more modules is detected. # dangerous-default-value: (hi-pri) Used when a mutable value as list or dictionary is detected in a default value for an argument. -# duplicate-key: (hi-pri) Used when a dictionary expression binds the same key multiple times. # expression-not-assigned: (hi-pri) Used when an expression that is not a function call is assigned to nothing. # duplicate-code: (hi-pri) Indicates that a set of similar lines has been detected among multiple file. (also disabled globally) # fixme: Used when a warning note as FIXME or TODO is detected @@ -24,7 +23,6 @@ # invalid-name: (needs review) Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...). # keyword-arg-before-vararg: (hi-pri) When defining a keyword argument before variable positional arguments, one can end up in having multiple values passed for the aforementioned parameter in case the method is called with keyword arguments. # len-as-condition: (hi-pri) Used when Pylint detects that len(sequence) is being used without explicit comparison inside a condition to determine if a sequence is empty. -# logging-format-interpolation: (hi-pri) Used when a logging statement has a call form of "logging.(format_string.format(format_args...))". Use another type of string formatting instead. # multiple-imports: (hi-pri) Used when import statement importing multiple modules is detected. # no-else-return: (hi-pri) Used in order to highlight an unnecessary block of code following an if containing a return statement. # no-member: (hi-pri) Used when a variable is accessed for an unexistent member. diff --git a/ci/3.6.pylintrc b/ci/3.6.pylintrc index 13d25c21f6..1e533957b9 100644 --- a/ci/3.6.pylintrc +++ b/ci/3.6.pylintrc @@ -17,7 +17,6 @@ # consider-using-in: To check if a variable is equal to one of many values,combine the values into a tuple and check if the variable is contained "in" it instead of checking for equality against each of the values. # cyclic-import: (hi-pri) Used when a cyclic import between two or more modules is detected. # dangerous-default-value: (hi-pri) Used when a mutable value as list or dictionary is detected in a default value for an argument. -# duplicate-key: (hi-pri) Used when a dictionary expression binds the same key multiple times. # duplicate-code: (hi-pri) Indicates that a set of similar lines has been detected among multiple file. (also disabled globally) # duplicate-string-formatting-argument: (hi-pri) Used when we detect that a string formatting is repeating an argument instead of using named string arguments # expression-not-assigned: (hi-pri) Used when an expression that is not a function call is assigned to nothing. @@ -30,7 +29,6 @@ # invalid-name: (needs review) Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...). # keyword-arg-before-vararg: (hi-pri) When defining a keyword argument before variable positional arguments, one can end up in having multiple values passed for the aforementioned parameter in case the method is called with keyword arguments. # len-as-condition: (hi-pri) Used when Pylint detects that len(sequence) is being used without explicit comparison inside a condition to determine if a sequence is empty. -# logging-format-interpolation: (hi-pri) Used when a logging statement has a call form of "logging.(format_string.format(format_args...))". Use another type of string formatting instead. # multiple-imports: (hi-pri) Used when import statement importing multiple modules is detected. # lost-exception: (needs review) Used when a break or a return statement is found inside the finally clause of a try...finally block: the exceptions raised in the try clause will be silently swallowed instead of being re-raised. # no-else-break: (hi-pri) Used in order to highlight an unnecessary block of code following an if containing a break statement. diff --git a/tests/utils/test_flexible_version.py b/tests/utils/test_flexible_version.py index 034e3280e0..0e538e894b 100644 --- a/tests/utils/test_flexible_version.py +++ b/tests/utils/test_flexible_version.py @@ -88,7 +88,7 @@ def test_compile_pattern(self): # pylint: disable=useless-return def test_compile_pattern_sep(self): # pylint: disable=useless-return self.v.sep = '-' self.v._compile_pattern() # pylint: disable=protected-access - tests = { # pylint: disable=duplicate-key + tests = { '1': True, '1-2': True, '1-2-3': True, @@ -97,10 +97,8 @@ def test_compile_pattern_sep(self): # pylint: disable=useless-return '1alpha': True, '1-alpha': True, - '1-alpha': True, '1alpha0': True, '1-alpha0': True, - '1-alpha0': True, '1-2alpha': True, '1-2.alpha': True, '1-2-alpha': True, @@ -110,10 +108,8 @@ def test_compile_pattern_sep(self): # pylint: disable=useless-return '1beta': True, '1-beta': True, - '1-beta': True, '1beta0': True, '1-beta0': True, - '1-beta0': True, '1-2beta': True, '1-2.beta': True, '1-2-beta': True, @@ -123,10 +119,8 @@ def test_compile_pattern_sep(self): # pylint: disable=useless-return '1rc': True, '1-rc': True, - '1-rc': True, '1rc0': True, '1-rc0': True, - '1-rc0': True, '1-2rc': True, '1-2.rc': True, '1-2-rc': True,