prowide/prowide-core

View on GitHub
src/test/java/com/prowidesoftware/swift/model/field/GetValueDisplayTest.java

Summary

Maintainability
A
0 mins
Test Coverage

Remove the non-escaped \u00A0 character from this literal.
Open

        assertEquals("1 234,23456789012", f.getValueDisplay(Locale.FRANCE));

Non-encoded control characters and whitespace characters are often injected in the source code because of a bad manipulation. They are either invisible or difficult to recognize, which can result in bugs when the string is not what the developer expects. If you actually need to use a control character use their encoded version (ex: ASCII \n,\t,... or Unicode U+000D, U+0009,...).

This rule raises an issue when the following characters are seen in a literal string:

No issue will be raised on the simple space character. Unicode U+0020, ASCII 32.

Noncompliant Code Example

String tabInside = "A   B";  // Noncompliant, contains a tabulation
String zeroWidthSpaceInside = "foo​bar"; // Noncompliant, it contains a U+200B character inside
char tab = '    ';

Compliant Solution

String tabInside = "A\tB";  // Compliant, uses escaped value
String zeroWidthSpaceInside = "foo\u200Bbar";  // Compliant, uses escaped value
char tab = '\t';

Exceptions

Text Blocks string literals (java 13 three double-quote marks) can contain tabulations to allow indentation using tabulations.

Remove the non-escaped \u00A0 character from this literal.
Open

        assertEquals("1 234,567", f.getValueDisplay(3, Locale.FRANCE));

Non-encoded control characters and whitespace characters are often injected in the source code because of a bad manipulation. They are either invisible or difficult to recognize, which can result in bugs when the string is not what the developer expects. If you actually need to use a control character use their encoded version (ex: ASCII \n,\t,... or Unicode U+000D, U+0009,...).

This rule raises an issue when the following characters are seen in a literal string:

No issue will be raised on the simple space character. Unicode U+0020, ASCII 32.

Noncompliant Code Example

String tabInside = "A   B";  // Noncompliant, contains a tabulation
String zeroWidthSpaceInside = "foo​bar"; // Noncompliant, it contains a U+200B character inside
char tab = '    ';

Compliant Solution

String tabInside = "A\tB";  // Compliant, uses escaped value
String zeroWidthSpaceInside = "foo\u200Bbar";  // Compliant, uses escaped value
char tab = '\t';

Exceptions

Text Blocks string literals (java 13 three double-quote marks) can contain tabulations to allow indentation using tabulations.

There are no issues that match your filters.

Category
Status