Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ exclude_paths:
- .cache/ # implicit unless exclude_paths is defined in config
- test/fixtures/formatting-before/
- test/fixtures/formatting-prettier/
# parseable: true
# quiet: true
# strict: true
# verbosity: 1
Expand Down
1 change: 0 additions & 1 deletion .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ nodeps
nomatchestest
nxos
octals
parseable
pathex
pbrun
pfexec
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repos:
hooks:
- id: check-useless-excludes
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.9.18
rev: 0.9.21
hooks:
- id: uv-sync
- id: uv-lock
Expand Down Expand Up @@ -146,7 +146,7 @@ repos:
entry: yamllint --strict

- repo: https://github.com/tombi-toml/tombi-pre-commit
rev: v0.7.11
rev: v0.7.14
hooks:
- id: tombi-format
alias: toml
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Ansible-lint prints output on both `stdout` and `stderr`.
- `stderr` displays logging and free-form messages like statistics.

Most `ansible-lint` examples use pep8 as the output format (`-p`) which is
machine parseable.
machine parsable.

Ansible-lint also print errors using their [annotation] format when it detects
the `GITHUB_ACTIONS=true` and `GITHUB_WORKFLOW=...` variables.
Expand Down
4 changes: 2 additions & 2 deletions src/ansiblelint/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ def choose_formatter_factory(
r = formatters.CodeclimateJSONFormatter
elif options_list.format == "sarif":
r = formatters.SarifFormatter
elif options_list.parseable or options_list.format == "pep8":
r = formatters.ParseableFormatter
elif options_list.format == "pep8":
r = formatters.PEP8Formatter
return r


Expand Down
14 changes: 5 additions & 9 deletions src/ansiblelint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,6 @@ def get_cli_parser() -> argparse.ArgumentParser:
choices=PROFILES.keys(),
help="Specify which rules profile to be used.",
)
parser.add_argument(
"-p",
"--parseable",
dest="parseable",
default=False,
action="store_true",
help="parseable output, same as '-f pep8'",
)
parser.add_argument(
"--project-dir",
dest="project_dir",
Expand Down Expand Up @@ -493,7 +485,6 @@ def merge_config(file_config: dict[Any, Any], cli_config: Options) -> Options:
"""Combine the file config with the CLI args."""
bools = (
"display_relative_path",
"parseable",
"quiet",
"strict",
"use_default_rules",
Expand Down Expand Up @@ -590,6 +581,11 @@ def get_config(arguments: list[str]) -> Options:
_logger.warning(
"Replaced deprecated '--write' option with '--fix', change you call to avoid future regressions when we remove old option.",
)
# cspell:ignore parseable
if value in ("-p", "--parseable"):
arguments[i] = "--format=pep8"
msg = f"Deprecated `{value}` cli option replaced with current `{arguments[i]}` option. This alias will be removed in a future release."
_logger.warning(msg)
options = Options(**vars(parser.parse_args(arguments)))

# docs is not document, being used for internal documentation building
Expand Down
1 change: 0 additions & 1 deletion src/ansiblelint/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ class Options: # pylint: disable=too-many-instance-attributes
list_tags: bool = False
write_list: list[str] = field(default_factory=list)
write_exclude_list: list[str] = field(default_factory=list)
parseable: bool = False
quiet: bool = False
rulesdirs: list[Path] = field(default_factory=list)
skip_list: list[str] = field(default_factory=list)
Expand Down
4 changes: 2 additions & 2 deletions src/ansiblelint/formatters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def apply(self, match: MatchError) -> str:
)


class ParseableFormatter(BaseFormatter[Any]):
"""Parseable uses PEP8 compatible format."""
class PEP8Formatter(BaseFormatter[Any]):
"""Parsable uses PEP8 compatible format."""

def apply(self, match: MatchError) -> str:
result = (
Expand Down
5 changes: 0 additions & 5 deletions src/ansiblelint/schemas/ansible-lint-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@
"title": "Only Builtins Allow Modules",
"type": "array"
},
"parseable": {
"default": true,
"title": "Parseable",
"type": "boolean"
},
"profile": {
"enum": [
"min",
Expand Down
3 changes: 0 additions & 3 deletions test/fixtures/parseable.yml

This file was deleted.

1 change: 0 additions & 1 deletion test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def fixture_base_arguments() -> list[str]:
@pytest.mark.parametrize(
("args", "config_path"),
(
pytest.param(["-p"], "test/fixtures/parseable.yml", id="1"),
pytest.param(["-q"], "test/fixtures/quiet.yml", id="2"),
pytest.param(
["-r", "test/fixtures/rules/"],
Expand Down
19 changes: 0 additions & 19 deletions test/test_formatter_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import json
import pathlib
import subprocess
import sys

import pytest

Expand Down Expand Up @@ -123,20 +121,3 @@ def test_validate_codeclimate_schema_with_positions(self) -> None:
assert result[0]["location"]["positions"]["begin"]["line"] == 1
assert result[0]["location"]["positions"]["begin"]["column"] == 42
assert "lines" not in result[0]["location"]


def test_code_climate_parsable_ignored() -> None:
"""Test that -p option does not alter codeclimate format."""
cmd = [
sys.executable,
"-m",
"ansiblelint",
"-v",
"-p",
]
file = "examples/playbooks/empty_playbook.yml"
result = subprocess.run([*cmd, file], check=False)
result2 = subprocess.run([*cmd, "-p", file], check=False)

assert result.returncode == result2.returncode
assert result.stdout == result2.stdout
17 changes: 0 additions & 17 deletions test/test_formatter_sarif.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,6 @@ def test_validate_sarif_schema(self) -> None:
assert results[1]["message"]["text"] == self.matches[1].message


def test_sarif_parsable_ignored() -> None:
"""Test that -p option does not alter SARIF format."""
cmd = [
sys.executable,
"-m",
"ansiblelint",
"-v",
"-p",
]
file = "examples/playbooks/empty_playbook.yml"
result = subprocess.run([*cmd, file], check=False)
result2 = subprocess.run([*cmd, "-p", file], check=False)

assert result.returncode == result2.returncode
assert result.stdout == result2.stdout


@pytest.mark.parametrize(
("file", "return_code"),
(
Expand Down
2 changes: 1 addition & 1 deletion test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def test_broken_ansible_cfg() -> None:


def test_list_tags() -> None:
"""Asserts that we can list tags and that the output is parseable yaml."""
"""Asserts that we can list tags and that the output is parsable yaml."""
result = subprocess.run(
["ansible-lint", "--list-tags"],
check=True,
Expand Down
2 changes: 1 addition & 1 deletion test/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_runner_exclude_globs(
("formatter_cls"),
(
pytest.param(formatters.Formatter, id="Formatter-plain"),
pytest.param(formatters.ParseableFormatter, id="ParseableFormatter-colored"),
pytest.param(formatters.PEP8Formatter, id="PEP8Formatter-colored"),
pytest.param(formatters.QuietFormatter, id="QuietFormatter-colored"),
pytest.param(formatters.Formatter, id="Formatter-colored"),
),
Expand Down
2 changes: 1 addition & 1 deletion test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def test_cli_auto_detect(capfd: CaptureFixture[str]) -> None:
"-x",
"schema", # exclude schema as our test file would fail it
"-v",
"-p",
"--format=pep8",
"--nocolor",
"--offline",
"--exclude=examples",
Expand Down
Loading