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

allow long lines in block comments and whole strings #84

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

jflinchbaugh
Copy link
Contributor

@jflinchbaugh jflinchbaugh commented Nov 22, 2024

fix a bug: javadocs deeper than class-level were note allowed to go long like class-level docs would.
enhancement: long, contiguous strings are allowed without requiring introduction of messy breaks.

<!-- Allow longer lines in comments. -->
<property name="ignorePattern" value="^ \*.*"/>
<!-- Allow longer lines in block comments and whole string literals -->
<property name="ignorePattern" value='^ +\*|"[^"]{100,}"'/>
Copy link
Contributor Author

@jflinchbaugh jflinchbaugh Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: allow 1 or more space in block comments, so it works for block comments at any level.
new: if the line is mostly a string of more than 100 characters, then leave it. these are often test inputs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

examples that are allowed now for line length:

  /**
   * javadoc comments for fields and methods, not just class-level
   */

strings without unnecessary breaks:

    String id =
        "pkg:hf-model/org/repo/path%2Fto%2Fmodel@commit-hash?classifier=format&sonatype_repository=huggingface.co&type=ext";

parameters in CSV format in data-driven tests:

  @CsvSource({
      "conan, cctz, 2.3, , , pkg:conan/[email protected]?sonatype_naming_authority=conan",
      "bincrafters, cctz, 2.3, bincrafters, stable, pkg:conan/bincrafters/[email protected]?channel=stable&sonatype_naming_authority=bincrafters"
  })

if it's a shorter string in a long parameter list or something, that could be wrapped sensibly, then it's still triggered.

<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.42</version>
</dependency>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default checkstyle that comes with the plugin is fine.

<dependency>
<groupId>com.sonatype</groupId>
<artifactId>checkstyle-checks</artifactId>
<version>15</version>
<version>20</version>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

20 will be the next release.

@jflinchbaugh jflinchbaugh merged commit 52cd601 into main Dec 6, 2024
@jflinchbaugh jflinchbaugh deleted the long-comment-lines branch December 6, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants