Skip to content

Commit

Permalink
Fix shredding errors/warnings reported by rstcheck. (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein authored Jan 28, 2025
1 parent 5c02c98 commit a386936
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/188-rstcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "When linting found RST problems with rstcheck, the error messages were reduced to a single letter (https://github.com/ansible-community/antsibull-changelog/pull/188)."
4 changes: 2 additions & 2 deletions src/antsibull_changelog/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,12 @@ def _lint_lines(
results = ChangelogFragmentLinter._check_content(
line, fragment.fragment_format, fragment.path
)
errors += [(fragment.path, 0, 0, result[2]) for result in results]
errors += [(fragment.path, 0, 0, result) for result in results]
elif isinstance(lines, str):
results = ChangelogFragmentLinter._check_content(
lines, fragment.fragment_format, fragment.path
)
errors += [(fragment.path, 0, 0, result[2]) for result in results]
errors += [(fragment.path, 0, 0, result) for result in results]

def lint(self, fragment: ChangelogFragment) -> list[tuple[str, int, int, str]]:
"""
Expand Down
2 changes: 2 additions & 0 deletions tests/functional/test_changelog_basic_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ def test_changelog_fragment_lint_broken( # pylint: disable=redefined-outer-name
],
},
)
collection_changelog.add_fragment_line("bad-rst.yml", "bugfixes", ["This is *foo"])

# Lint fragments
rc, stdout, stderr = collection_changelog.run_tool_w_output("lint", [])
assert rc == C.RC_INVALID_FRAGMENT
assert (
stdout
== r"""
changelogs/fragments/bad-rst.yml:0:0: (WARNING/2) Inline emphasis start-string without end-string.
changelogs/fragments/int-instead-of-list.yml:0:0: section "bugfixes" must be type list not int
changelogs/fragments/int-instead-of-string.yml:0:0: section "release_summary" must be type str not int
changelogs/fragments/invalid-add-obj.yaml:0:0: section "add moo.role"'s name must be of format "add (object|plugin).(type)"
Expand Down

0 comments on commit a386936

Please sign in to comment.