Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add json alias for codeclimate formatter #1942

Merged
merged 1 commit into from
Feb 26, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ are also handled:
:returncode: 2
:nostderr:

A codeclimate report in JSON format can be generated with ansible-lint.
A ``JSON`` report, based on codeclimate specification, can be generated with
ansible-lint.

.. command-output:: ansible-lint -f codeclimate examples/playbooks/norole.yml
.. command-output:: ansible-lint -f json examples/playbooks/norole.yml
:cwd: ..
:returncode: 2
:nostderr:
2 changes: 1 addition & 1 deletion src/ansiblelint/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def choose_formatter_factory(
r: Type[formatters.BaseFormatter[Any]] = formatters.Formatter
if options_list.format == "quiet":
r = formatters.QuietFormatter
elif options_list.format == "codeclimate":
elif options_list.format in ("json", "codeclimate"):
r = formatters.CodeclimateJSONFormatter
elif options_list.parseable or options_list.format == "pep8":
r = formatters.ParseableFormatter
Expand Down
4 changes: 2 additions & 2 deletions src/ansiblelint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def get_cli_parser() -> argparse.ArgumentParser:
"-f",
dest="format",
default="rich",
choices=["rich", "plain", "rst", "codeclimate", "quiet", "pep8"],
help="Format used rules output, (default: %(default)s)",
choices=["rich", "plain", "rst", "json", "codeclimate", "quiet", "pep8"],
help="stdout formatting, json being an alias for codeclimate. (default: %(default)s)",
)
parser.add_argument(
"-q",
Expand Down