C & C++

C & C++

Made by DeepSource
Found the use of static member variable through class instance rather then class name CXX-C2022
Style
Minor

Accessing static member variables through class instances can give the impression that the member belongs to the instance, which is incorrect. This can lead to confusion and make the code harder to understand and maintain. To fix this issue, simply replace the instance access with the class name followed by the member variable. This clearly indicates that the member is a static member of the class and avoids any confusion.

Multiple declarations in single statement CXX-C2013
Style
Minor

Local variable declarations with more than one variable in a single statement can lead to confusion and make the code harder to read. It is recommended to refactor the code to have one declaration per statement, with each statement on a separate line.

Misleading indentation CXX-C2011
Style
Minor

Incorrect indentation and missing braces can lead to code that is difficult to read and understand which can result in developers spending more time identifying issues in the code.

Redundant access specifiers CXX-C2012
Style
Minor
Autofix

Classes, structs, and unions containing redundant member (field and method) access specifiers can lead to code that is more difficult to read and maintain.

Indirect subscript for STL containers CXX-C2016
Style
Minor
Autofix

Found a subscript expressions on the STL container that can be further simplified directly using subscript operator.

Initializing std:string or std::string_view is redundant CXX-C2023
Style
Minor
Autofix

Initializing std::string or std::string_view with an empty string is unnecessary and can be considered redundant. This is redundant because both types already have a default constructor that performs necessary initialization. Also, by removing the redundant initialization, the code becomes cleaner and more concise.

Found unnecessary conversion from std::string to C-style string CXX-C2024
Style
Minor
Autofix

Found conversion of a std::string to a C-style string using the c_str() or data() methods. This is unnecessary and can lead to potential memory issues while also being less efficient. To fix this issue, usestd::string` directly without converting it to a C-style string.

Found access to std::unique_ptr's raw pointer while deleting the pointer CXX-C2020
Style
Minor
Autofix

Accessing the raw pointer of a std::unique_ptr and calling delete on it is unnecessary as std::unique_ptr provides API to do it safely. To fix this issue, replace delete <unique_ptr>.release() with <unique_ptr> = nullptr. This is a shorter and simpler way to reset the std::unique_ptr and ensures that the object is properly deallocated.