-
Type:
Code Smell Detection
-
Status: Active
-
Resolution: Unresolved
-
Labels:
-
Message:Use either // or /* ... */ comments, but do not mix them (see lines X and Y).
-
Default Severity:Minor
-
Impact:Low
-
Likelihood:Low
-
Legacy Key:CommentMixedStyles
-
Covered Languages:C, C++, Objective-C
-
Irrelevant for Languages:ABAP, C#, Cobol, Flex, Go, HTML, Java, JavaScript, PHP, PL/I, PL/SQL, Python, RPG, Swift, T-SQL, TypeScript, VB.Net, VB6, XML
-
Remediation Function:Constant/Issue
-
Constant Cost:5min
-
Analysis Level:Syntactic Analysis
-
Common Rule:Yes
-
CERT:MSC55-J.
Use either the // ... or /* ... */ comment syntax, but be consistent and do not mix them within the same file.
Noncompliant Code Example
/* Noncompliant; both comment syntaxes are used in the same file */ // Foo /* Bar */
Compliant Solution
// Compliant; uniform comment syntax // Foo // Bar
See
- CERT, MSC55-J. - Use comments consistently and in a readable fashion
- is implemented by
-
CPP-312 New rule: Do not mix // and /* ... */ comment styles in a single file
-
- Closed
-
-
CPP-707 Create Objective-C rules repository containing targeted rules
-
- Closed
-
- relates to
-
RSPEC-1103 "/*" and "//" should not be used within comments
- Active
1.
|
C-Family | RSPEC-4354 |
|
Active | Unassigned |