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
8 changes: 4 additions & 4 deletions .github/workflows/test-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ jobs:
exit 1
fi
# The compile job is skipped when the change gate says nothing it covers moved.
# Only a real failure blocks, a skip must still pass.
# The matrix aggregates to a single result, failure if any leg failed.
if [[ "${{ needs.template-compile-test.result }}" == "failure" ]]; then
echo "Job 'template-compile-test' failed; refusing to pass."
# A skip must still pass, and anything else short of success blocks, a cancelled leg included.
result="${{ needs.template-compile-test.result }}"
if [[ "$result" != "success" && "$result" != "skipped" ]]; then
echo "Job 'template-compile-test' did not succeed ($result); refusing to pass."
exit 1
fi
8 changes: 8 additions & 0 deletions tests/compile_lint/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,11 @@ def test_an_args_entry_beside_a_substituted_format_still_matches(tmp_path: Path)
set_main(build, directive(root, 9), ' ESP_LOGD("main", "kitchen %.1f", x2.5);')
result = lint(root, build).run()
assert [(f.path, f.line) for f in result.findings] == [("test/device.yaml", 28)]


def test_an_inlined_expression_owns_only_the_occurrence_at_the_column(tmp_path: Path) -> None:
root, build = write_build(tmp_path, "")
# The lambda's y * 2.5 is on the line, but the warning sits on the first call, q * 2.5.
set_main(build, directive(root, 9), " other(q * 2.5); call.set_level(y * 2.5);")
result = lint(root, build).run()
assert result.findings == []
5 changes: 2 additions & 3 deletions tools/compile-lint/src/compile_lint/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,9 @@ def match_inline(self, diagnostic: Diagnostic, source: str) -> Iterator[Finding]
for line, pattern, literal in inline_expressions(self.index.scalars(relative)):
if literal and not format_pattern(literal).search(source):
continue
# Only the occurrence holding the diagnostic's column owns it.
spans = [m.span() for m in pattern.finditer(generated)]
if literal:
spans = [(a, b) for a, b in spans if a <= column < b]
if spans:
if any(a <= column < b for a, b in spans):
yield Finding(relative, line, 1, diagnostic.severity, diagnostic.message)


Expand Down
Loading