Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark static code analysis checks deprecated #1613

Merged
merged 2 commits into from
Dec 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
key = "BooleanEqualityComparison",
name = "Literal boolean values should not be used in condition expressions",
priority = Priority.MINOR,
tags = {Tag.CONVENTION})
tags = {Tag.CONVENTION},
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
public class BooleanEqualityComparisonCheck extends SquidCheck<Grammar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
key = "CollapsibleIfCandidate",
name = "Collapsible 'if' statements should be merged",
priority = Priority.MAJOR,
tags = {Tag.BRAIN_OVERLOAD})
tags = {Tag.BRAIN_OVERLOAD},
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
public class CollapsibleIfCandidateCheck extends SquidCheck<Grammar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
key = "CommentedCode",
name = "Sections of code should not be 'commented out'",
tags = {Tag.BAD_PRACTICE},
priority = Priority.CRITICAL)
priority = Priority.CRITICAL,
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
public class CommentedCodeCheck extends SquidCheck<Grammar> implements AstAndTokenVisitor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
key = "HardcodedAccount",
name = "Do not hard code sensitive data in programs",
tags = {Tag.CERT, Tag.SECURITY},
priority = Priority.BLOCKER)
priority = Priority.BLOCKER,
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("30min")
public class HardcodedAccountCheck extends SquidCheck<Grammar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
key = "HardcodedIp",
name = "IP addresses should not be hardcoded",
tags = {Tag.CERT, Tag.SECURITY},
priority = Priority.CRITICAL)
priority = Priority.CRITICAL,
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("30min")
public class HardcodedIpCheck extends SquidCheck<Grammar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
key = "MagicNumber",
name = "Magic number should not be used",
tags = {Tag.CONVENTION},
priority = Priority.MINOR)
priority = Priority.MINOR,
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
public class MagicNumberCheck extends SquidCheck<Grammar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
key = "MissingCurlyBraces",
name = "if/else/for/while/do statements should always use curly braces",
tags = {Tag.CONVENTION, Tag.PITFALL},
priority = Priority.MAJOR)
priority = Priority.MAJOR,
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
public class MissingCurlyBracesCheck extends SquidCheck<Grammar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
key = "NestedStatements",
name = "Control flow statements \"if\", \"switch\", \"try\" and iterators should not be nested too deeply",
tags = {Tag.BRAIN_OVERLOAD},
priority = Priority.MAJOR
priority = Priority.MAJOR,
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("10min")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
key = "ReservedNames",
name = "Reserved names should not be used for preprocessor macros",
tags = {Tag.PREPROCESSOR},
priority = Priority.BLOCKER)
priority = Priority.BLOCKER,
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
public class ReservedNamesCheck extends SquidCheck<Grammar> implements CxxCharsetAwareVisitor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
key = "SafetyTag",
name = "Risk mitigation implementation shall be defined in separate file",
priority = Priority.BLOCKER,
tags = {Tag.CONVENTION})
tags = {Tag.CONVENTION},
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
public class SafetyTagCheck extends SquidCheck<Grammar> implements AstAndTokenVisitor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
key = "StringLiteralDuplicated",
name = "String literals should not be duplicated",
priority = Priority.MINOR,
tags = {Tag.BAD_PRACTICE})
tags = {Tag.BAD_PRACTICE},
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
public class StringLiteralDuplicatedCheck extends SquidCheck<Grammar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
key = "SwitchLastCaseIsDefault",
name = "Switch statements should end with a default case",
priority = Priority.MAJOR,
tags = {Tag.BAD_PRACTICE, Tag.PITFALL})
tags = {Tag.BAD_PRACTICE, Tag.PITFALL},
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
public class SwitchLastCaseIsDefaultCheck extends SquidCheck<Grammar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
key = "UnnamedNamespaceInHeader",
name = "Unnamed namespaces are not allowed in header files",
tags = {Tag.CONVENTION},
priority = Priority.BLOCKER)
priority = Priority.BLOCKER,
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
//similar Vera++ rule T017
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
key = "UseCorrectInclude",
name = "#include directive shall not use relative path",
tags = {Tag.PREPROCESSOR},
priority = Priority.BLOCKER)
priority = Priority.BLOCKER,
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
public class UseCorrectIncludeCheck extends SquidCheck<Grammar> implements CxxCharsetAwareVisitor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
key = "UseCorrectType",
name = "C++ type(s) shall be used",
tags = {Tag.CONVENTION},
priority = Priority.MINOR)
priority = Priority.MINOR,
status = "DEPRECATED"
)
@RuleTemplate
@NoSqale
public class UseCorrectTypeCheck extends SquidCheck<Grammar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
key = "UselessParentheses",
name = "Useless parentheses around expressions should be removed to prevent any misunderstanding",
priority = Priority.MAJOR,
tags = {Tag.CONFUSING})
tags = {Tag.CONFUSING},
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("1min")
public class UselessParenthesesCheck extends SquidCheck<Grammar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
key = "UsingNamespaceInHeader",
name = "Using namespace directives are not allowed in header files",
tags = {Tag.CONVENTION, Tag.PITFALL, Tag.BAD_PRACTICE},
priority = Priority.BLOCKER)
priority = Priority.BLOCKER,
status = "DEPRECATED"
)
@ActivatedByDefault
@SqaleConstantRemediation("5min")
//similar Vera++ rule T018
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
key = "TooManyParameters",
priority = Priority.MAJOR,
name = "Functions, methods and lambdas should not have too many parameters",
tags = {Tag.BRAIN_OVERLOAD}
tags = {Tag.BRAIN_OVERLOAD},
status = "DEPRECATED"
)
@SqaleConstantRemediation("20min")
@ActivatedByDefault
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<p>
Boolean expressions should not be compared against boolean literals, as their value can be directly used.
</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>The following code:</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<p>Merging collapsible <code>if</code> statements increases the code's readability.</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>The following code:</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<p>Remove commented code.</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>Here are the main reasons why commented code is a code smell:</p>

<ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<p>Be careful while handling sensitive data, such as passwords, in program code.</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>Hard coding sensitive data is considered very bad programming practice because it enforces the requirement of the development environment to be secure.</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<p>Remove hardcoded IP addresses.</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>Hardcoding an IP address into source code is a bad idea for several reasons:</p>

<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Numbers are not self-explanatory, they only are made of a value, which does not explain their purpose.
Moreover, if the same number should be consistently used in multiple places, using a constant will ensure that all occurrences are updated at once.
</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>The following code:</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<p>
Not using curly braces could be error-prone in some cases. For instance in the following example, the two statements seems to be attached to the if statement whereas this is the case only for the first one:
</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<pre>
if (condition) // Non-Compliant
executeSomething();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<code>do</code>) statements are a key ingredient for making what's known as "Spaghetti code". Such code is hard to read,
refactor and therefore maintain.
</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<h2>Noncompliant Code Example</h2>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<p>Don't use reserved names.</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p> The C++ Standard reserves some forms of names for language
implementations. One of the most frequent violations is a
definition of preprocessor macro that begins with underscore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@

<p>Therefore separation of the source code makes it easier to monitor updates or test coverage.</p>

<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Duplicated string literals are error-prone to refactor, as one must pay attention to update all occurrences.
Constants can be referenced from many places, but there value is updated in a single place.
</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>The following code:</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
The requirement for a final default clause is defensive programming.
This clause should either take appropriate action or contain a suitable comment as to why no action is taken.
</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>
The following code snippet illustrates this rule:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
<p>
Functions with many parameters are hard to test, maintain and reuse.
</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>


Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<p>Unnamed namespaces in header files.</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>The typical use of unnamed namespace is to hide module-internal
names from the outside world. Header files are physically
concatenated in a single translation unit, which logically
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<p>
The #include directive shall only refer to predefined folders and therefore relative paths are not allowed.
</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>
The following code snippet illustrates this rule:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Legacy code often use primitive types which shall be avoided or limited to platform APIs.
C++ types shall be used instead.
</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>Avoid using the following types:</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<p>
Useless parentheses can sometimes be misleading and so should be removed.
</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>
The following code snippet illustrates this rule:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<p>Namespace directive in header files.</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>The using namespace directive imports names from the given
namespace and when used in a header file influences the global
namespace of all the files that directly or indirectly include
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<p>
Boolean expressions should not be compared against boolean literals, as their value can be directly used.
</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>The following code:</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<p>Merging collapsible <code>if</code> statements increases the code's readability.</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>The following code:</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<p>Remove commented code.</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>Here are the main reasons why commented code is a code smell:</p>

<ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<p>Be careful while handling sensitive data, such as passwords, in program code.</p>
<ul>
<li><b>DEPRECATED</b>: Static code analysis checks will no longer be supported in future versions. Use an external tool for static code analysis instead.</li>
</ul>

<p>Hard coding sensitive data is considered very bad programming practice because it enforces the requirement of the development environment to be secure.</p>

Expand Down
Loading