Fixed #1070 (Improve scope error message)
This commit is contained in:
parent
814eb6caee
commit
374def4a53
|
@ -2081,7 +2081,7 @@ void CheckOther::charBitOpError(const Token *tok)
|
|||
|
||||
void CheckOther::variableScopeError(const Token *tok, const std::string &varname)
|
||||
{
|
||||
reportError(tok, Severity::style, "variableScope", "The scope of the variable " + varname + " can be limited");
|
||||
reportError(tok, Severity::style, "variableScope", "The scope of the variable " + varname + " can be reduced");
|
||||
}
|
||||
|
||||
void CheckOther::conditionAlwaysTrueFalse(const Token *tok, const std::string &truefalse)
|
||||
|
|
|
@ -534,7 +534,7 @@ private:
|
|||
" for ( ; i < 10; ++i) ;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (style) The scope of the variable i can be limited\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (style) The scope of the variable i can be reduced\n", errout.str());
|
||||
|
||||
varScope("void f(int x)\n"
|
||||
"{\n"
|
||||
|
@ -544,7 +544,7 @@ private:
|
|||
" for ( ; i < 10; ++i) ;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (style) The scope of the variable i can be limited\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (style) The scope of the variable i can be reduced\n", errout.str());
|
||||
}
|
||||
|
||||
void varScope6()
|
||||
|
|
Loading…
Reference in New Issue