Update RSPEC
This commit is contained in:
parent
8830c7e5af
commit
3318c3a29a
@ -1,12 +1,13 @@
|
||||
{
|
||||
"title": "FIXME",
|
||||
"type": "CODE_SMELL",
|
||||
"title": "Numeric literal suffixes should not be mystyped",
|
||||
"type": "BUG",
|
||||
"status": "ready",
|
||||
"remediation": {
|
||||
"func": "Constant\/Issue",
|
||||
"constantCost": "5min"
|
||||
},
|
||||
"tags": [
|
||||
"clippy"
|
||||
],
|
||||
"defaultSeverity": "Major",
|
||||
"ruleSpecification": "RSPEC-7454",
|
||||
@ -16,10 +17,8 @@
|
||||
"quickfix": "unknown",
|
||||
"code": {
|
||||
"impacts": {
|
||||
"MAINTAINABILITY": "HIGH",
|
||||
"RELIABILITY": "MEDIUM",
|
||||
"SECURITY": "LOW"
|
||||
"RELIABILITY": "MEDIUM"
|
||||
},
|
||||
"attribute": "CONVENTIONAL"
|
||||
"attribute": "LOGICAL"
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,6 @@
|
||||
FIXME: add a description
|
||||
|
||||
// If you want to factorize the description uncomment the following line and create the file.
|
||||
//include::../description.adoc[]
|
||||
|
||||
== Why is this an issue?
|
||||
|
||||
FIXME: remove the unused optional headers (that are commented out)
|
||||
|
||||
//=== What is the potential impact?
|
||||
|
||||
== How to fix it
|
||||
//== How to fix it in FRAMEWORK NAME
|
||||
Mistyped suffixes in numeric literals can lead to incorrect interpretations of the values intended by the developer. This is typically seen as a typo which could impact the functionality of the code. The rule does not however address integers that would not fit within the assumed type or specific valid groupings such as `_127` in decimal and octal numbers.
|
||||
|
||||
=== Code examples
|
||||
|
||||
@ -18,27 +8,19 @@ FIXME: remove the unused optional headers (that are commented out)
|
||||
|
||||
[source,rust,diff-id=1,diff-type=noncompliant]
|
||||
----
|
||||
FIXME
|
||||
let x = 2_32; // Noncompliant: Mistyped literal suffix
|
||||
let y = 250_8; // Noncompliant: Mistyped literal suffix
|
||||
----
|
||||
|
||||
==== Compliant solution
|
||||
|
||||
[source,rust,diff-id=1,diff-type=compliant]
|
||||
----
|
||||
FIXME
|
||||
let x = 2_i32; // Compliant: Correct literal suffix
|
||||
let y = 250_u8; // Compliant: Correct literal suffix
|
||||
----
|
||||
|
||||
//=== How does this work?
|
||||
== Resources
|
||||
=== Documentation
|
||||
|
||||
//=== Pitfalls
|
||||
|
||||
//=== Going the extra mile
|
||||
|
||||
|
||||
//== Resources
|
||||
//=== Documentation
|
||||
//=== Articles & blog posts
|
||||
//=== Conference presentations
|
||||
//=== Standards
|
||||
//=== External coding guidelines
|
||||
//=== Benchmarks
|
||||
* Clippy Lints - https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
|
||||
|
Loading…
x
Reference in New Issue
Block a user