Move "information" errors to "style" errors.
"information" severity is documented in lib/errorlogger.h as: Checking information. Information message about the checking (process) itself. These messages inform about header files not found etc issues that are not errors in the code but something user needs to know. It IS NOT for errors in the code. All the current "information"- severity errors fit nicely into description of the "style"- severity. We definitely need to separate processing information and actual errors in the code. It is highly confusing for users to mix these two different things. Hence all current "information" code error messages are moved to "style" category. Ticket: #3165 (Stop misusing the 'information' error severity!)
This commit is contained in:
parent
09df5de964
commit
3cfe7ca1a7
|
@ -191,5 +191,5 @@ void CheckAssignIf::multiConditionError(const Token *tok, unsigned int line1)
|
|||
errmsg << "'else if' condition matches previous condition at line "
|
||||
<< line1;
|
||||
|
||||
reportError(tok, Severity::information, "multiCondition", errmsg.str());
|
||||
reportError(tok, Severity::style, "multiCondition", errmsg.str());
|
||||
}
|
||||
|
|
|
@ -1762,7 +1762,7 @@ bool CheckClass::isVirtualFunc(const Scope *scope, const Token *functionToken) c
|
|||
|
||||
void CheckClass::checkConstError(const Token *tok, const std::string &classname, const std::string &funcname)
|
||||
{
|
||||
reportError(tok, Severity::information, "functionConst",
|
||||
reportError(tok, Severity::style, "functionConst",
|
||||
"Technically the member function '" + classname + "::" + funcname + "' can be const.\n"
|
||||
"The member function '" + classname + "::" + funcname + "' can be made a const "
|
||||
"function. Making this function const function should not cause compiler errors. "
|
||||
|
@ -1776,7 +1776,7 @@ void CheckClass::checkConstError2(const Token *tok1, const Token *tok2, const st
|
|||
std::list<const Token *> toks;
|
||||
toks.push_back(tok1);
|
||||
toks.push_back(tok2);
|
||||
reportError(toks, Severity::information, "functionConst",
|
||||
reportError(toks, Severity::style, "functionConst",
|
||||
"Technically the member function '" + classname + "::" + funcname + "' can be const.\n"
|
||||
"The member function '" + classname + "::" + funcname + "' can be made a const "
|
||||
"function. Making this function const function should not cause compiler errors. "
|
||||
|
|
|
@ -60,7 +60,7 @@ void CheckObsoleteFunctions::obsoleteFunctions()
|
|||
{
|
||||
// If checking an old code base it might be uninteresting to update obsolete functions.
|
||||
// Therefore this is "information"
|
||||
reportError(tok->tokAt(1), Severity::information, "obsoleteFunctions"+it->first, it->second);
|
||||
reportError(tok->tokAt(1), Severity::style, "obsoleteFunctions"+it->first, it->second);
|
||||
break;
|
||||
}
|
||||
else if (_settings->posix)
|
||||
|
@ -70,7 +70,7 @@ void CheckObsoleteFunctions::obsoleteFunctions()
|
|||
{
|
||||
// If checking an old code base it might be uninteresting to update obsolete functions.
|
||||
// Therefore this is "information"
|
||||
reportError(tok->tokAt(1), Severity::information, "obsoleteFunctions"+it->first, it->second);
|
||||
reportError(tok->tokAt(1), Severity::style, "obsoleteFunctions"+it->first, it->second);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1558,7 +1558,7 @@ void CheckOther::lookupVar(const Token *tok1, const std::string &varname)
|
|||
void CheckOther::variableScopeError(const Token *tok, const std::string &varname)
|
||||
{
|
||||
reportError(tok,
|
||||
Severity::information,
|
||||
Severity::style,
|
||||
"variableScope",
|
||||
"The scope of the variable '" + varname + "' can be reduced\n"
|
||||
"The scope of the variable '" + varname + "' can be reduced. Warning: It can be unsafe "
|
||||
|
|
|
@ -121,14 +121,14 @@ private:
|
|||
" if (x & 7);\n"
|
||||
" else if (x == 1);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (information) 'else if' condition matches previous condition at line 3\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (style) 'else if' condition matches previous condition at line 3\n", errout.str());
|
||||
|
||||
check("void foo(int x)\n"
|
||||
"{\n"
|
||||
" if (x & 7);\n"
|
||||
" else if (x & 1);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (information) 'else if' condition matches previous condition at line 3\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (style) 'else if' condition matches previous condition at line 3\n", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -85,7 +85,7 @@ private:
|
|||
"{\n"
|
||||
" bsd_signal(SIGABRT, SIG_IGN);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (information) Found obsolete function 'bsd_signal'. It is recommended that new applications use the 'sigaction' function\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (style) Found obsolete function 'bsd_signal'. It is recommended that new applications use the 'sigaction' function\n", errout.str());
|
||||
|
||||
check("int f()\n"
|
||||
"{\n"
|
||||
|
@ -105,7 +105,7 @@ private:
|
|||
" exit(1);\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (information) Found obsolete function 'gethostbyname'. It is recommended that new applications use the 'getaddrinfo' function\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (style) Found obsolete function 'gethostbyname'. It is recommended that new applications use the 'getaddrinfo' function\n", errout.str());
|
||||
}
|
||||
|
||||
void testgethostbyaddr()
|
||||
|
@ -118,7 +118,7 @@ private:
|
|||
" exit(1);\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:5]: (information) Found obsolete function 'gethostbyaddr'. It is recommended that new applications use the 'getnameinfo' function\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:5]: (style) Found obsolete function 'gethostbyaddr'. It is recommended that new applications use the 'getnameinfo' function\n", errout.str());
|
||||
}
|
||||
|
||||
void testusleep()
|
||||
|
@ -127,7 +127,7 @@ private:
|
|||
"{\n"
|
||||
" usleep( 1000 );\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (information) Found obsolete function 'usleep'. It is recommended that new applications use the 'nanosleep' or 'setitimer' function\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (style) Found obsolete function 'usleep'. It is recommended that new applications use the 'nanosleep' or 'setitimer' function\n", errout.str());
|
||||
}
|
||||
|
||||
void testindex()
|
||||
|
@ -168,7 +168,7 @@ private:
|
|||
" const char i = index(var, 0);\n"
|
||||
" return i;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (information) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n",
|
||||
ASSERT_EQUALS("[test.cpp:4]: (style) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n",
|
||||
errout.str());
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ private:
|
|||
check("void TDataModel::forceRowRefresh(int row) {\n"
|
||||
" emit dataChanged(index(row, 0), index(row, columnCount() - 1));\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (information) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n", errout.str());
|
||||
}
|
||||
|
||||
void testrindex()
|
||||
|
@ -193,7 +193,7 @@ private:
|
|||
" const char var[7] = 'rindex';\n"
|
||||
" print(rindex(var, 0));\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (information) Found obsolete function 'rindex'. It is recommended to use the function 'strrchr' instead\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:4]: (style) Found obsolete function 'rindex'. It is recommended to use the function 'strrchr' instead\n", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
@ -213,7 +213,7 @@ private:
|
|||
"{\n"
|
||||
" char *x = gets();\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (information) Found obsolete function 'gets'. It is recommended to use the function 'fgets' instead\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (style) Found obsolete function 'gets'. It is recommended to use the function 'fgets' instead\n", errout.str());
|
||||
}
|
||||
|
||||
// ticket #3121
|
||||
|
|
|
@ -604,7 +604,7 @@ private:
|
|||
" for ( ; i < 10; ++i) ;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (information) The scope of the variable 'i' can be reduced\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"
|
||||
|
@ -614,7 +614,7 @@ private:
|
|||
" for ( ; i < 10; ++i) ;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (information) The scope of the variable 'i' can be reduced\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (style) The scope of the variable 'i' can be reduced\n", errout.str());
|
||||
}
|
||||
|
||||
void varScope6()
|
||||
|
@ -680,7 +680,7 @@ private:
|
|||
" edgeResistance = (edge+1) / 2.0;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (information) The scope of the variable 'edgeResistance' can be reduced\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) The scope of the variable 'edgeResistance' can be reduced\n", errout.str());
|
||||
}
|
||||
|
||||
void varScope9()
|
||||
|
|
Loading…
Reference in New Issue