mirror of
https://github.com/nlohmann/json.git
synced 2026-08-22 09:03:18 +00:00
Name the test's locals so Flawfinder stops matching them
The code scanning job reports CWE-362 - "check when opening files" - for a test that opens no files: Flawfinder matched a local variable called open. Rename it and its partner. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -79,18 +79,18 @@ TEST_CASE("Better diagnostics with positions")
|
|||||||
CAPTURE(depth)
|
CAPTURE(depth)
|
||||||
CAPTURE(objects)
|
CAPTURE(objects)
|
||||||
|
|
||||||
const std::string open = objects ? R"({"a":)" : "[";
|
const std::string opening = objects ? R"({"a":)" : "[";
|
||||||
const std::string close = objects ? "}" : "]";
|
const std::string closing = objects ? "}" : "]";
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
for (std::size_t i = 0; i < depth; ++i)
|
for (std::size_t i = 0; i < depth; ++i)
|
||||||
{
|
{
|
||||||
text += open;
|
text += opening;
|
||||||
}
|
}
|
||||||
text += "12";
|
text += "12";
|
||||||
for (std::size_t i = 0; i < depth; ++i)
|
for (std::size_t i = 0; i < depth; ++i)
|
||||||
{
|
{
|
||||||
text += close;
|
text += closing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const json original = json::parse(text);
|
const json original = json::parse(text);
|
||||||
|
|||||||
Reference in New Issue
Block a user