Skip to content

Commit dc7cfd3

Browse files
Rename option "never" to "replace_with_linebreak" for self explainability
1 parent 1373f81 commit dc7cfd3

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

CodeFormatCore/include/CodeFormatCore/Config/LuaStyleEnum.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ enum class AlignChainExpr {
8787

8888
enum class EndStmtWithSemicolon {
8989
Keep,
90-
Never,
90+
ReplaceWithLinebreak,
9191
Always,
9292
SameLine
9393
};

CodeFormatCore/src/Config/LuaStyle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ void LuaStyle::Parse(std::map<std::string, std::string, std::less<>> &configMap)
293293
end_statement_with_semicolon = EndStmtWithSemicolon::Keep;
294294
} else if (configMap.at("end_statement_with_semicolon") == "always") {
295295
end_statement_with_semicolon = EndStmtWithSemicolon::Always;
296-
} else if (configMap.at("end_statement_with_semicolon") == "never") {
297-
end_statement_with_semicolon = EndStmtWithSemicolon::Never;
296+
} else if (configMap.at("end_statement_with_semicolon") == "replace_with_linebreak") {
297+
end_statement_with_semicolon = EndStmtWithSemicolon::ReplaceWithLinebreak;
298298
} else if (configMap.at("end_statement_with_semicolon") == "same_line") {
299299
end_statement_with_semicolon = EndStmtWithSemicolon::SameLine;
300300
}

CodeFormatCore/src/Diagnostic/CodeStyle/CodeStyleChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void CodeStyleChecker::BasicResolve(LuaSyntaxNode syntaxNode, const LuaSyntaxTre
9696
}
9797
case TokenStrategy::StmtEndSemicolon: {
9898
switch (d.GetState().GetStyle().end_statement_with_semicolon) {
99-
case EndStmtWithSemicolon::Never: {
99+
case EndStmtWithSemicolon::ReplaceWithLinebreak: {
100100
d.PushDiagnostic(DiagnosticType::Semicolon, textRange,
101101
LText("expected statement not to end with ;"));
102102
break;

CodeFormatCore/src/Format/Analyzer/SemicolonAnalyzer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void SemicolonAnalyzer::Analyze(FormatState &f, const LuaSyntaxTree &t) {
2525
}
2626
break;
2727
}
28-
case EndStmtWithSemicolon::Never: {
28+
case EndStmtWithSemicolon::ReplaceWithLinebreak: {
2929
// no action needed when there's no semicolons at all!
3030
if (ContainsSemicolon(syntaxNode, t)) {
3131
if (EndsWithSemicolon(syntaxNode, t)) {

Test/src/FormatStyle_unitest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ local table1 = { 1, 2, 3 };
16211621
)",
16221622
style));
16231623

1624-
style.end_statement_with_semicolon = EndStmtWithSemicolon::Never;
1624+
style.end_statement_with_semicolon = EndStmtWithSemicolon::ReplaceWithLinebreak;
16251625
EXPECT_TRUE(TestHelper::TestFormatted(
16261626
R"(
16271627
local func = testFunc; print(type(nil)); -- nil;

0 commit comments

Comments
 (0)