Skip to content

Commit

Permalink
Address pylint fixme (#2006)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Mar 15, 2022
1 parent ce34c2c commit 2ca36a0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ disable =
consider-using-f-string,
dangerous-default-value,
duplicate-code,
fixme,
protected-access,

[TYPECHECK]
Expand Down
2 changes: 1 addition & 1 deletion src/ansiblelint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def load_config(config_file: str) -> Dict[Any, Any]:
sys.exit(INVALID_CONFIG_RC)

config["config_file"] = config_path
# TODO(ssbarnea): implement schema validation for config file
# See https://github.com/ansible-community/ansible-lint/issues/1803
if isinstance(config, list):
_logger.error(
"Invalid configuration '%s', expected YAML mapping in the config file.",
Expand Down
2 changes: 0 additions & 2 deletions src/ansiblelint/rules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ def matchlines(self, file: "Lintable") -> List[MatchError]:
matches.append(matcherror)
return matches

# TODO(ssbarnea): Reduce mccabe complexity
# https://github.com/ansible-community/ansible-lint/issues/744
def matchtasks(self, file: Lintable) -> List[MatchError]:
matches: List[MatchError] = []
if (
Expand Down
3 changes: 0 additions & 3 deletions src/ansiblelint/skip_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ def _append_skipped_rules(
pyyaml_task_blocks = _get_task_blocks_from_playbook(pyyaml_data)
ruamel_task_blocks = _get_task_blocks_from_playbook(ruamel_data)
except (AttributeError, TypeError):
# TODO(awcrosby): running ansible-lint on any .yml file will
# assume it is a playbook, check needs to be added higher in the
# call stack, and can remove this except
return pyyaml_data
else:
# For unsupported file types, we return empty skip lists
Expand Down
8 changes: 4 additions & 4 deletions src/ansiblelint/yaml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,10 @@ def __init__(
self.Constructor = CustomConstructor
self.Representer.add_representer(OctalIntYAML11, OctalIntYAML11.represent_octal)

# TODO: preserve_quotes loads all strings as a str subclass that carries
# a quote attribute. Will the str subclasses cause problems in transforms?
# Are there any other gotchas to this?
# We should preserve_quotes loads all strings as a str subclass that carries
# a quote attribute. Will the str subclasses cause problems in transforms?
# Are there any other gotchas to this?
#
# This will only preserve quotes for strings read from the file.
# anything modified by the transform will use no quotes, preferred_quote,
# or the quote that results in the least amount of escaping.
Expand Down Expand Up @@ -656,7 +657,6 @@ def version(self, value: Optional[Union[str, Tuple[int, int]]]) -> None:

def loads(self, stream: str) -> Any:
"""Load YAML content from a string while avoiding known ruamel.yaml issues."""
# TODO: maybe add support for passing a Lintable for the stream.
if not isinstance(stream, str):
raise NotImplementedError(f"expected a str but got {type(stream)}")
text, preamble_comment = self._pre_process_yaml(stream)
Expand Down

0 comments on commit 2ca36a0

Please sign in to comment.