Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 14 Text Blocks Checks Support validation: MultipleStringLiteralsCheck #8616

Closed
nrmancuso opened this issue Aug 6, 2020 · 1 comment
Closed
Milestone

Comments

@nrmancuso
Copy link
Member

Child of #8601
Check documentation: https://checkstyle.sourceforge.io/config_coding.html#MultipleStringLiterals

Checks for multiple occurrences of the same string literal within a single file.

➜  text-blocks-grammar /usr/lib/jvm/java-14-openjdk/bin/javac --enable-preview --source 14 TestClass.java
Note: TestClass.java uses preview language features.
Note: Recompile with -Xlint:preview for details.
➜  text-blocks-grammar cat config.xml    
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
          "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
  <module name="TreeWalker">
      <module name="MultipleStringLiterals"/>
  </module>
</module>
➜  text-blocks-grammar cat TestClass.java
public class TestClass {
    String string1 = "string";
    String string2 = "string"; // violation
    String string3 = """
            other string""";
    String string4 = """
            other string"""; // should be violation

}
➜  text-blocks-grammar java $RUN_LOCALE -jar ~/IdeaProjects/checkstyle/target/checkstyle-8.36-SNAPSHOT-all.jar -c config.xml TestClass.java
Starting audit...
[ERROR] /home/nick/Desktop/text-blocks-grammar/TestClass.java:2:22: The String "string" appears 2 times in the file. [MultipleStringLiterals]
Audit done.
Checkstyle ends with 1 errors.

This check needs to be updated to support text block syntax.

nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 17, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 17, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 18, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 19, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 19, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 19, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 19, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 19, 2020
@pbludov pbludov added the bug label Aug 20, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 20, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 20, 2020
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Aug 20, 2020
@romani romani added this to the 8.36 milestone Aug 21, 2020
@romani
Copy link
Member

romani commented Aug 21, 2020

fix is merged

@romani romani closed this as completed Aug 21, 2020
shiliyu pushed a commit to shiliyu/checkstyle that referenced this issue Sep 1, 2020
shiliyu pushed a commit to shiliyu/checkstyle that referenced this issue Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants