Skip to content

Google-style: Improper enforcement of horizontal whitespace for double slash // #17193

@mohitsatr

Description

@mohitsatr

split from #8122

From: https://google.github.io/styleguide/javaguide.html#s4.6.2-horizontal-whitespace

Between a double slash (//) which begins a comment and the comment's text. Multiple spaces are allowed.

/** somejavadoc. */
public class InputTry {
  // EXPECTED VIOLATION BELOW
  String gooG = "Google"; //google
    
  /** somejavadoc. */
  public static void main(String[] args) {
    // EXPECTED VIOLATION BELOW
    int pro1 = 0; //the main variable
  }
}

$ java -jar checkstyle-10.25.0-all.jar -c google_checks.xml InputTry.java 
Starting audit...
Audit done.
$ java -jar google-java-format-1.27.0-all-deps.jar InputTry.java 
/** somejavadoc. */
public class InputTry {

  String gooG = "Google"; // google

  /** somejavadoc. */
  public static void main(String[] args) {
    int pro1 = 0; // the main variable
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions