Skip to content

Commit

Permalink
Codacy: Error-prone Code
Browse files Browse the repository at this point in the history
Member variable 'version_info::special_separator_' is not initialized in the constructor.
  • Loading branch information
GregoryLundberg committed Oct 26, 2018
1 parent 6a7abea commit aa28426
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/game_version.cpp
Expand Up @@ -27,6 +27,11 @@ version_info::version_info()
{
}

version_info::version_info(const char* str)
: version_info(std::string(str))
{
}

version_info::version_info(unsigned int major, unsigned int minor, unsigned int revision_level,
char special_separator, const std::string& special)
: nums_(3,0), special_(special), special_separator_(special_separator)
Expand Down
2 changes: 1 addition & 1 deletion src/game_version.hpp
Expand Up @@ -45,7 +45,7 @@ class version_info
public:
version_info(); /**< Default constructor. */
version_info(const std::string&); /**< String constructor. */
version_info(const char* str) : version_info(std::string(str)) {}
version_info(const char* str);

/** Simple list constructor. */
version_info(unsigned int major, unsigned int minor, unsigned int revision_level,
Expand Down

2 comments on commit aa28426

@jyrkive
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this commit improve anything? The new code is semantically identical.

@GregoryLundberg
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It moves the code to make their cppcheck run happy.

Actually, it's the source of an open ticket for Codacy. On my private fork, this commit fixes one issue and raises another. But on master they note neither. In actual point of fact, the specific message they produce is a false positive, but is hiding a true-positive. I'm using it as an example of how their system fails to provide consistent results, among other problems.

Please sign in to comment.