Support formatting in the lint command using --format#642
Conversation
🤖 Augment PR SummarySummary: This PR extends the Changes:
Technical Notes: Formatting is only available in fix mode (no “check-only” behavior for lint formatting), and YAML inputs still error when 🤖 Was this summary useful? React with 👍 or 👎 |
docs/lint.markdown
Outdated
| **The `--fix/-f` option is not supported when passing YAML schemas.** | ||
|
|
||
| **The `--format/-m` option requires `--fix/-f` to be set and is not supported | ||
| for YAML schemas.** Use `--keep-ordering/-k` with `--format/-m` to preserve |
There was a problem hiding this comment.
The docs mention using --keep-ordering/-k with --format/-m, but the implementation treats it as a hard requirement (it errors if --keep-ordering is set without --format). Consider stating this explicitly (e.g., “requires --format”).
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
There was a problem hiding this comment.
3 issues found across 12 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="test/lint/fail_lint_keep_ordering_without_format.sh">
<violation number="1" location="test/lint/fail_lint_keep_ordering_without_format.sh:25">
P2: Add a JSON variant of this failure test. After the text assertion, run the same command with --json and verify the structured error output so JSON error reporting stays consistent.
(Based on your team's feedback about adding JSON variants for failure test cases.) [FEEDBACK_USED]</violation>
</file>
<file name="test/lint/fail_lint_fix_format_unfixable.sh">
<violation number="1" location="test/lint/fail_lint_fix_format_unfixable.sh:19">
P2: Failing tests are expected to include a JSON variant that exercises `--json` output. Add a JSON version of this test (or extend this script) that runs `lint ... --json` and asserts on the structured error output.
(Based on your team's feedback about adding JSON variants for failure test cases.) [FEEDBACK_USED]</violation>
</file>
<file name="test/lint/fail_lint_format_yaml.sh">
<violation number="1" location="test/lint/fail_lint_format_yaml.sh:15">
P2: Add a `--json` variant of this failure test so structured error output is validated alongside the text output.
(Based on your team's feedback about adding JSON variants for failure test cases.) [FEEDBACK_USED]</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| error: The --keep-ordering option requires --format to be set | ||
| EOF | ||
|
|
||
| diff "$TMP/stderr.txt" "$TMP/expected.txt" |
There was a problem hiding this comment.
P2: Add a JSON variant of this failure test. After the text assertion, run the same command with --json and verify the structured error output so JSON error reporting stays consistent.
(Based on your team's feedback about adding JSON variants for failure test cases.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At test/lint/fail_lint_keep_ordering_without_format.sh, line 25:
<comment>Add a JSON variant of this failure test. After the text assertion, run the same command with --json and verify the structured error output so JSON error reporting stays consistent.
(Based on your team's feedback about adding JSON variants for failure test cases.) </comment>
<file context>
@@ -0,0 +1,25 @@
+error: The --keep-ordering option requires --format to be set
+EOF
+
+diff "$TMP/stderr.txt" "$TMP/expected.txt"
</file context>
| } | ||
| EOF | ||
|
|
||
| "$1" lint "$TMP/schema.json" --fix --format && CODE="$?" || CODE="$?" |
There was a problem hiding this comment.
P2: Failing tests are expected to include a JSON variant that exercises --json output. Add a JSON version of this test (or extend this script) that runs lint ... --json and asserts on the structured error output.
(Based on your team's feedback about adding JSON variants for failure test cases.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At test/lint/fail_lint_fix_format_unfixable.sh, line 19:
<comment>Failing tests are expected to include a JSON variant that exercises `--json` output. Add a JSON version of this test (or extend this script) that runs `lint ... --json` and asserts on the structured error output.
(Based on your team's feedback about adding JSON variants for failure test cases.) </comment>
<file context>
@@ -0,0 +1,31 @@
+}
+EOF
+
+"$1" lint "$TMP/schema.json" --fix --format && CODE="$?" || CODE="$?"
+test "$CODE" = "2" || exit 1
+
</file context>
77939c6 to
043ab1e
Compare
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
043ab1e to
9f4b3e2
Compare
Signed-off-by: Juan Cruz Viotti jv@jviotti.com