Skip to content

Commit

Permalink
Merge pull request #185 from alex-courtis/184-diagnosis-as-error-for-…
Browse files Browse the repository at this point in the history
…workspace

fix(#184): --diagnosis-as-error when using --workspace
  • Loading branch information
CppCXY authored Sep 28, 2024
2 parents 996b325 + 2128c55 commit 6bbe77f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CodeFormat/src/LuaCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ bool LuaCheck::CheckSingleFile(const FormatContext &context, std::string_view pa

bool LuaCheck::CheckWorkspace(const FormatContext &context) {
auto workspace = context.GetWorkspace();
bool diagnosis = false;
FileFinder finder(workspace);
finder.AddFindExtension(".lua");
finder.AddFindExtension(".lua.txt");
Expand All @@ -136,10 +137,12 @@ bool LuaCheck::CheckWorkspace(const FormatContext &context) {
auto style = context.GetStyle(relativePath);
if (CheckSingleFile(context, relativePath, std::move(opText.value()), style)) {
std::cerr << util::format("Check {} ok.", relativePath) << std::endl;
} else {
diagnosis = true;
}
} else {
std::cerr << util::format("Can not read file {}", relativePath) << std::endl;
}
}
return true;
}
return !diagnosis;
}

0 comments on commit 6bbe77f

Please sign in to comment.