зеркало из https://github.com/mozilla/code-review.git
Support empty clang-format diff file (#2328)
This commit is contained in:
Родитель
40b172c198
Коммит
f6034dea94
|
@ -93,9 +93,15 @@ class ClangFormatTask(AnalysisTask):
|
|||
return f"`./mach clang-format -p {files}`"
|
||||
|
||||
def parse_issues(self, artifacts, revision):
|
||||
artifact = artifacts.get("public/code-review/clang-format.diff")
|
||||
if "public/code-review/clang-format.diff" not in artifacts:
|
||||
logger.warn(
|
||||
"public/code-review/clang-format.diff is missing from artifacts"
|
||||
)
|
||||
return []
|
||||
|
||||
artifact = artifacts["public/code-review/clang-format.diff"]
|
||||
if artifact is None:
|
||||
logger.warn("Missing clang-format.diff")
|
||||
logger.info("Empty clang-format.diff, no patches to process")
|
||||
return []
|
||||
|
||||
# Use all chunks provided by parsepatch
|
||||
|
|
|
@ -187,6 +187,18 @@ def test_empty_patch(patch):
|
|||
assert patches == []
|
||||
|
||||
|
||||
def test_missing_clang_format_diff(mock_task, mock_revision, capsys):
|
||||
"""
|
||||
Clang format task requires diff artifact to detect issues
|
||||
"""
|
||||
task = mock_task(ClangFormatTask, "mock-clang-format")
|
||||
assert task.parse_issues({}, mock_revision) == []
|
||||
assert (
|
||||
"public/code-review/clang-format.diff is missing from artifacts"
|
||||
in capsys.readouterr().out
|
||||
)
|
||||
|
||||
|
||||
def test_real_patch(mock_revision, mock_task):
|
||||
"""
|
||||
Test clang format patch parsing with a real patch
|
||||
|
|
Загрузка…
Ссылка в новой задаче