File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
src/java/detectors/string_format_arguments Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 7
7
8
8
import lombok .extern .slf4j .Slf4j ;
9
9
import java .io .File ;
10
- import static java .lang .String .format ;
11
10
12
11
@ Slf4j
13
12
public class StringFormatArguments {
14
13
// {fact rule=string-format-arguments@v1.0 defects=1}
15
14
void formatStringNoncompliant (final File file ) {
16
15
final long length = file .length ();
17
16
// Noncompliant: avoids using the correct format strings for their argument types.
18
- final String s = format ("File length is %s" , length );
17
+ final String s = String . format ("File length is %s" , length );
19
18
log .info (s );
20
19
}
21
20
// {/fact}
@@ -24,7 +23,7 @@ void formatStringNoncompliant(final File file) {
24
23
void formatStringCompliant (final File file ) {
25
24
final long length = file .length ();
26
25
// Compliant: uses the correct format strings for their argument types.
27
- final String s = format ("File length is %d" , length );
26
+ final String s = String . format ("File length is %d" , length );
28
27
log .info (s );
29
28
}
30
29
// {/fact}
You can’t perform that action at this time.
0 commit comments