format-real
Enforce consistent format for Real values
INFO
☑️ The predefined configuration "mslint:recommended"
enables this rule.
Rule details
This rule verifies that real numbers are formatted accurately with both integer and decimal parts.
Settings
hasIntegerPart
real numbers must have an integer part. Defaulttrue
.hasDecimalPart
real numbers must have a decimal part. Defaultfalse
.
Example of incorrect code for this rule:
maniascript
// { "hasIntegerPart" = true, "hasDecimalPart" = false }
main() {
.1;
}
// { "hasIntegerPart" = false, "hasDecimalPart" = true }
main() {
1.;
}
// { "hasIntegerPart" = true, "hasDecimalPart" = true }
main() {
.1;
1.;
}
Example of correct code for this rule:
maniascript
// { "hasIntegerPart" = true, "hasDecimalPart" = false }
main() {
1.0;
1.;
}
// { "hasIntegerPart" = false, "hasDecimalPart" = true }
main() {
0.1;
.1;
}
// { "hasIntegerPart" = true, "hasDecimalPart" = true }
main() {
1.0;
}
// { "hasIntegerPart" = false, "hasDecimalPart" = false }
main() {
1.0;
1.;
0.1;
.1;
}