Skip to content

CheckStyle - IDEA Code Style configuration#16349

Closed
Anmol202005 wants to merge 1 commit into
checkstyle:masterfrom
Anmol202005:AutoConfig
Closed

CheckStyle - IDEA Code Style configuration#16349
Anmol202005 wants to merge 1 commit into
checkstyle:masterfrom
Anmol202005:AutoConfig

Conversation

@Anmol202005

@Anmol202005 Anmol202005 commented Feb 17, 2025

Copy link
Copy Markdown
Contributor

Issue #16427: IntelliJ IDEA Code Style configuration that matches our checkstyle_check.xml settings

@romani

romani commented Feb 17, 2025

Copy link
Copy Markdown
Member

Please create issue and list Checks that we have , list of checkboxes, and checkout all that you covered, so we might improve step by step to cover all other .

Please reference this issue in this PR and commit.

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Items

Comment thread config/intellij-checkstyle-config.xml Outdated
@Anmol202005

Anmol202005 commented Feb 26, 2025

Copy link
Copy Markdown
Contributor Author

@romani issue opened : #16427

@Anmol202005 Anmol202005 force-pushed the AutoConfig branch 2 times, most recently from bdae172 to e6d2816 Compare February 26, 2025 08:31
@romani

romani commented Feb 27, 2025

Copy link
Copy Markdown
Member

Please keep ci green.
We usually do not review until CI is green.

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Items

Comment thread config/intellij-checkstyle-config.xml Outdated

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Items

Comment thread config/intellij-checkstyle-config.xml Outdated
@romani

romani commented Feb 27, 2025

Copy link
Copy Markdown
Member

Did you reformat code by idea?
looks suspicious that no changes detected.

@Anmol202005 Anmol202005 force-pushed the AutoConfig branch 3 times, most recently from d34b872 to b9c7c72 Compare February 28, 2025 06:46
@Anmol202005

Copy link
Copy Markdown
Contributor Author

@romani Yes, I did reformat the code using IntelliJ IDEA's formatter.

Before reformatting, Checkstyle reported 28 errors, and after reformatting, it's down to 15 errors. The remaining issues require manual fixes :

  • Class name test should start with uppercase (naming convention)
  • Variables that could be declared as final
  • Operator placement (&& and + should be on new lines)
  • Missing newline at end of file

Here's the test code for reference:

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class test {
     private static final int MAX_LENGTH = 100;
    private final List<String> items;
    public Map<String, Integer> data = new HashMap<>();

    public test() {this.items = new ArrayList<>();}
    
    public test(List<String> items) {
        this.items = items;
    }
    
    /**
     * This method violates several formatting rules.
     */
    public List<String> processItems(String input, int count) throws IllegalArgumentException {
        if (input == null) { return null; }
        
        String veryLongString = "This string intentionally goes beyond the 100 character limit to demonstrate a line length violation in the configuration";
        
        boolean isValid = input.length() > 0 &&
                count > 0;
        
        String[] parts = new String[]{"a", "b", "c"};
        
                List<String> results = new ArrayList<>();
        
        if(isValid) {
            for (int i = 0; i < count; i++)
            {
                results.add(input + i);
            }
        } else return Collections.emptyList();
        
        try {
            validateResults(results);
        } catch (Exception e) {
            results.clear();
        }finally {
            System.out.println("Done");
        }
        
        String result;
        if (results.isEmpty()) {
            result = "empty" +
                "list";
        }
        else {
            result = "populated list";
        }
        
        return results;
    }
    
    private void validateResults(List<String> results) {
        assert results != null:"Results cannot be null";
        
        String status;
        if (results.isEmpty()) {
            status = "Empty";
        }
        else {
            status = "Not empty";
        }
    }
    
    public enum ProcessingType { SIMPLE, NORMAL, COMPLEX, ADVANCED, SPECIAL, CUSTOM }
}

@romani

romani commented Feb 28, 2025

Copy link
Copy Markdown
Member

Before reformatting, Checkstyle reported 28 errors, and after reformatting, it's down to 15 errors.

please share in commit all IDEA formatting.
We have 0 errors now from checkstyle, I am not sure how you get 15 and 28.

Class name test should start with uppercase (naming convention)
Variables that could be declared as final

lets postpone this for later, IDEA formatting does not tell user what is best practice on naming. It is reponsibility of tools checkstyle or IDEA inspections.

@Anmol202005

Anmol202005 commented Feb 28, 2025

Copy link
Copy Markdown
Contributor Author

please share in commit all IDEA formatting. We have 0 errors now from checkstyle, I am not sure how you get 15 and 28.

@romani i have commited the idea config that's i used

i guess there will be violations by checkstyle here like

[ERROR] C:\Users\anmol\IdeaProjects\checkstyle3\src\main\java\com\puppycrawl\tools\checkstyle\temp\test.java:36:9: 'if' is not followed by whitespace. [WhitespaceAfter]
[ERROR] C:\Users\anmol\IdeaProjects\checkstyle3\src\main\java\com\puppycrawl\tools\checkstyle\temp\test.java:36:9: 'if' is not followed by whitespace. [WhitespaceAround]

pls clarify, I guess there is a bit confusion from my side . I intended to tell that the idea config is formatting code in line with checkstyle.

@romani

romani commented Mar 1, 2025

Copy link
Copy Markdown
Member

I am confused, there is no test.java in our repository. Lets not put extra files.

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

items:

Comment thread config/intellij-checkstyle-config.xml
@romani

romani commented Mar 1, 2025

Copy link
Copy Markdown
Member

I imported your config,

select CheckstyleAntTask.java , right click, choose "Reformat code" menu, in popup window select only "Optimize imports".
Whole file is changed :( .

@Anmol202005

Anmol202005 commented Mar 2, 2025

Copy link
Copy Markdown
Contributor Author

Fixed it! Turns out the issue was the missing version in the config—we had removed it earlier.

The updated config now covers all the checks and everything is working perfectly :)

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

item:

Comment thread config/intellij-idea-code-style.xml
@romani

romani commented Mar 2, 2025

Copy link
Copy Markdown
Member

I tried again, same result:

$ git diff
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java b/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
index c7b8f09890..522d4124e9 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
@@ -1,4 +1,4 @@
-///////////////////////////////////////////////////////////////////////////////////////////////
+/// ////////////////////////////////////////////////////////////////////////////////////////////
 // checkstyle: Checks Java source code and other text files for adherence to a set of rules.
 // Copyright (C) 2001-2025 the original author or authors.
 //
@@ -255,6 +255,7 @@ public class CheckstyleAntTask extends Task {
 
     ////////////////////////////////////////////////////////////////////////////
     // The doers
+
     ////////////////////////////////////////////////////////////////////////////
 

please investigate IDEA CLI.

example of how we use it

./.ci/idea-inspection.sh

IDEA_OUTPUT=$("$IDEA_PATH"/bin/inspect.sh "$PROJECT_DIR" "$INSPECTIONS_PATH" "$RESULTS_DIR" \

please run it on our local from terminal.
Lets start usiing terminal.

@Anmol202005

Anmol202005 commented Mar 2, 2025

Copy link
Copy Markdown
Contributor Author

C:\Users\anmol>"C:\Users\anmol\AppData\Local\JetBrains\IntelliJ IDEA 2024.2.4\bin\format.bat" -settings "C:\Users\anmol\IdeaProjects\checkstyle3\config\intellij-idea-code-style.xml" -optimize-imports-only "C:\Users\anmol\IdeaProjects\checkstyle3\src\main\java\com\puppycrawl\tools\checkstyle\ant\CheckstyleAntTask.java"

PS C:\Users\anmol\IdeaProjects\checkstyle3> git diff 
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java b/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
index c7b8f09890..034e3ec34d 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
@@ -124,7 +124,7 @@ public class CheckstyleAntTask extends Task {
      * is a violation.
      *
      * @param propertyName the name of the property to set
-     *                      in the event of a failure.
+     *     in the event of a failure.
      */
     public void setFailureProperty(String propertyName) {
         failureProperty = propertyName;
@@ -198,10 +198,10 @@ public class CheckstyleAntTask extends Task {
      * Creates classpath.
      *
      * @return a created path for locating classes
-     * @deprecated left in implementation until #12556 only to allow users to migrate to new gradle
-     *     plugins. This method will be removed in Checkstyle 11.x.x .
      * @noinspection DeprecatedIsStillUsed
      * @noinspectionreason DeprecatedIsStillUsed - until #12556
+     * @deprecated left in implementation until #12556 only to allow users to migrate to new gradle
+     *     plugins. This method will be removed in Checkstyle 11.x.x .
      */

Looks like it mainly adjusted indentation and spacing—I don't see any significant changes in the diff report.

@romani

romani commented Mar 12, 2025

Copy link
Copy Markdown
Member

not working as expected on my side:

✔ ~/java/github/romani/checkstyle [Anmol202005/AutoConfig L|⚑ 2] 
$ /home/roman/java/intelij-idea/idea-IU-243.22562.218/bin/format.sh -settings config/intellij-idea-code-style.xml src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
[0.017s][warning][cds] Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "com.intellij.util.lang.PathClassLoader"). To use archived non-system classes, this property must not be set
2025-03-12 06:15:08,711 [    730]   WARN - c.i.o.u.r.overrides - Conflicting registry key definition for key kotlin.mpp.tests.force.gradle: it was defined by plugin org.jetbrains.kotlin but redefined by plugin org.jetbrains.kotlin. Consider adding overrides="true" for one of the plugins, see the documentation for com.intellij.openapi.util.registry.RegistryKeyBean.overrides for more details.
2025-03-12 06:15:08,716 [    735]   WARN - c.i.o.u.r.overrides - Conflicting registry key definition for key domains.spring.component.by.name.endpoint: it was defined by plugin com.intellij.spring but redefined by plugin com.intellij.spring.data. Consider adding overrides="true" for one of the plugins, see the documentation for com.intellij.openapi.util.registry.RegistryKeyBean.overrides for more details.
2025-03-12 06:15:08,934 [    953]   WARN - #c.i.u.p.CommonProxy - main authenticator is not yet registered
IntelliJ IDEA 2024.3.1.1, build IU-243.22562.218 Formatter
2025-03-12 06:15:12,254 [   4273]   WARN - #c.i.s.ComponentManagerImpl - `preload=TRUE` must be used only for core services (service=org.jetbrains.idea.maven.project.MavenProjectsManagerEx, plugin=org.jetbrains.idea.maven)
2025-03-12 06:15:12,254 [   4273]   WARN - #c.i.s.ComponentManagerImpl - `preload=TRUE` must be used only for core services (service=org.jetbrains.idea.maven.navigator.MavenProjectsNavigator, plugin=org.jetbrains.idea.maven)
2025-03-12 06:15:12,255 [   4274]   WARN - #c.i.s.ComponentManagerImpl - `preload=TRUE` must be used only for core services (service=org.jetbrains.idea.maven.tasks.MavenShortcutsManager, plugin=org.jetbrains.idea.maven)
2025-03-12 06:15:12,255 [   4274]   WARN - #c.i.s.ComponentManagerImpl - `preload=TRUE` must be used only for core services (service=com.intellij.cwm.plugin.users.BackendUserManager, plugin=com.jetbrains.codeWithMe)
2025-03-12 06:15:12,255 [   4274]   WARN - #c.i.s.ComponentManagerImpl - `preload=TRUE` must be used only for core services (service=com.intellij.cwm.plugin.ports.CwmPortForwardingToolWindowManager, plugin=com.jetbrains.codeWithMe)
2025-03-12 06:15:12,255 [   4274]   WARN - #c.i.s.ComponentManagerImpl - `preload=TRUE` must be used only for core services (service=com.intellij.cwm.plugin.following.FollowMeManagerService, plugin=com.jetbrains.codeWithMe)
Formatting /home/roman/java/github/romani/checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java...2025-03-12 06:15:13,632 [   5651]   WARN - #c.i.o.e.c.i.EditorColorsManagerImpl - Dark color scheme is missing
OK

1 file(s) scanned.
1 file(s) formatted.


✔ ~/java/github/romani/checkstyle [Anmol202005/AutoConfig L|✚ 1⚑ 2] 
$ git diff
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java b/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
index c7b8f09890..522d4124e9 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java
@@ -1,4 +1,4 @@
-///////////////////////////////////////////////////////////////////////////////////////////////
+/// ////////////////////////////////////////////////////////////////////////////////////////////
 // checkstyle: Checks Java source code and other text files for adherence to a set of rules.
 // Copyright (C) 2001-2025 the original author or authors.
 //
@@ -255,6 +255,7 @@ public class CheckstyleAntTask extends Task {
 
     ////////////////////////////////////////////////////////////////////////////
     // The doers
+
     ////////////////////////////////////////////////////////////////////////////
 
     @Override
@@ -268,11 +269,11 @@ public class CheckstyleAntTask extends Task {
 
             // Check for no arguments
             if (fileName == null
-                    && fileSets.isEmpty()
-                    && paths.isEmpty()) {
+                && fileSets.isEmpty()
+                && paths.isEmpty()) {
                 throw new BuildException(
-                        "Must specify at least one of 'file' or nested 'fileset' or 'path'.",
-                        getLocation());
+                    "Must specify at least one of 'file' or nested 'fileset' or 'path'.",
+                    getLocation());
             }
             if (config == null) {
                 throw new BuildException("Must specify 'config'.", getLocation());
@@ -325,7 +326,7 @@ public class CheckstyleAntTask extends Task {
      *     or if the build failed due to violations.
      */
     private void processFiles(RootModule rootModule, final SeverityLevelCounter warningCounter,
-            final String checkstyleVersion) {
+        final String checkstyleVersion) {
         final long startTime = System.currentTimeMillis();
         final List<File> files = getFilesToCheck();
         final long endTime = System.currentTimeMillis();
@@ -333,9 +334,9 @@ public class CheckstyleAntTask extends Task {

@romani

romani commented Mar 12, 2025

Copy link
Copy Markdown
Member

plase try to use same version of as me.
try to not use -optimize-imports-only

@romani

romani commented Mar 22, 2025

Copy link
Copy Markdown
Member

@Anmol202005 , can we finish this PR ?

@Anmol202005

Anmol202005 commented Mar 23, 2025

Copy link
Copy Markdown
Contributor Author

@romani
please try the updated config.
it should work (hopefully not like before) :)

@romani

romani commented Mar 27, 2025

Copy link
Copy Markdown
Member

while I waiting for laptop time to validate it...

@Anmol202005 , can you make it as CI job ? same as we have idea inspection execution

@Anmol202005

Copy link
Copy Markdown
Contributor Author

@romani is the config working now !

@Anmol202005 Anmol202005 force-pushed the AutoConfig branch 2 times, most recently from 9c41ffc to 612e57b Compare May 24, 2025 12:11

@Pankraz76 Pankraz76 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

polish

Comment thread .ci/idea-format.sh
Comment thread .circleci/config.yml
Comment thread .circleci/config.yml Outdated
Comment thread .ci/idea-format.bat

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

item:

Comment thread .circleci/config.yml
echo "Running Checkstyle..."
./mvnw -e --no-transfer-progress clean compile antrun:run@ant-phase-verify
working_directory: ~/project
- store_artifacts:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lets run git diff as "run" and fail is any diff is present. Now it is hard for me to see what is a diff
We have this, that is used in other CIs.

git-diff)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

then, it is always going to fail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

am i missing something ?
we can't rely on git-diff IMO

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if you have some diff, please share in gist of github, to let me investigate.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

in final result we need CI to fail if any diff is noticed :) .
right now we investigating if diff that we have is valid to be merged or we need to change configs

@romani romani May 24, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we need same as at:

./.ci/google-java-format.sh .ci-temp/google-java-format-${{env.VERSION}}-all-deps.jar
./.ci/validation.sh git-diff

if diff exists we failing a CI .
for IDEA formatter we also need to run checkstye to see its output and understand we can follow IDEA formatting.

so checkstyle vaildation failing CI, git-diff runs on failures also(always).

https://discuss.circleci.com/t/on-fail-for-commands-in-steps/42496
when: on_fail

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please do diff after checkstyle execution.
To let me see what is ok by checkstyle and what is not.

Diff likely always exists, but it is ok, user will just apply patch from formatter (CI output, same as we do with spelling) or run IDEA formatter.

But what will be show stopper is conflict with checkstyle after formatting.
So I and all users should see diff and checkstyle execution at the same time in CI.
I suggesting to run checkstyle first, let it fail a CI, and git diff execution is done when: always to let it run on_fail and passed.

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

items

Comment thread .ci/idea-suppression-update.sh Outdated
Comment on lines +11 to +18
# Remove closing tag and add new suppression with closing tag
sed -i '/<\/suppressions>/d' "$file"
cat >> "$file" << 'EOF'
<suppress-xpath
files=".*"
checks="WhitespaceAfterCheck"
query="//ARRAY_INIT/COMMA[following-sibling::*[1][self::RCURLY]]"/>
<suppress-xpath
files=".*"
checks="IndentationCheck"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is concerning, we wil discuss this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

just to make ci green

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

idea does not autoformat indentation and whitespaceAfter properly for array declaration.
if we are going to rely on git diff, it will be reverted.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

idea does not autoformat indentation and whitespaceAfter properly for array declaration.

I need to see it, we can open issue on Idea to fix, if we see a problem. But we might need to change settings of checkstyle to not conflict with it, if they is not critical

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Anmol202005 , as this suppression is hack for now, please print git diff right after formatter run, but it should not fail a build by "exit 1", just infromational print of diff.
later on we run checkstyle
later on we do diff one more time but will "exit 1" if diff is found.

@Pankraz76

Copy link
Copy Markdown

@Anmol202005

Anmol202005 commented May 24, 2025

Copy link
Copy Markdown
Contributor Author

@romani just need a little clarification on how to proceed :)

@romani

romani commented May 24, 2025

Copy link
Copy Markdown
Member

Please do git diff to let me see a problem.
Right now I don't know what idea changed at all.

@Anmol202005

Anmol202005 commented May 25, 2025

Copy link
Copy Markdown
Contributor Author

Please do git diff to let me see a problem. Right now I don't know what idea changed at all.

Done.

diff: https://app.circleci.com/pipelines/github/checkstyle/checkstyle/34160/workflows/47dcc2ad-5423-4279-a37a-979b303bdaec/jobs/957060

vs checkstyle conflict after suppressions:
https://app.circleci.com/pipelines/github/checkstyle/checkstyle/34144/workflows/9243e73b-8c2a-40f3-a9dd-5f26a1cbc0dc/jobs/956322?invite=true#step-105-3913_85

[INFO]      [echo] Checkstyle started (checkstyle-checks.xml): 24/05/2025 02:07:00 PM
[INFO] [checkstyle] Running Checkstyle  on 2204 files
[ERROR] [checkstyle] [ERROR] /home/circleci/project/src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java:269:5: 'createChildrenNodes' has incorrect indentation level 4, expected level should be 8. [Indentation]
[ERROR] [checkstyle] [ERROR] /home/circleci/project/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java:625:5: 'getNextSubTreeNode' has incorrect indentation level 4, expected level should be 8. [Indentation]
[ERROR] [checkstyle] [ERROR] /home/circleci/project/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java:436:5: 'searchVariableUsageExpressions' has incorrect indentation level 4, expected level should be 8. [Indentation]
[ERROR] [checkstyle] [ERROR] /home/circleci/project/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java:748:5: 'getNextSubTreeNode' has incorrect indentation level 4, expected level should be 8. [Indentation]
[ERROR] [checkstyle] [ERROR] /home/circleci/project/src/test/java/com/puppycrawl/tools/checkstyle/filefilters/BeforeExecutionExclusionFileFilterTest.java:88:5: 'createExclusionBeforeExecutionFileFilter' has incorrect indentation level 4, expected level should be 8. [Indentation]

first:

@@ -269,13 +266,13 @@ public class JavadocDetailNodeParser {
      * @return array of Javadoc nodes
      */
     private JavadocNodeImpl[]
-            createChildrenNodes(DetailNode parentJavadocNode, ParseTree parseTreeNode) {
+    createChildrenNodes(DetailNode parentJavadocNode, ParseTree parseTreeNode) {

bad formatting by IDEA.

second violation is same as first:

     private static DetailAST
-        getNextSubTreeNode(DetailAST currentNodeAst, DetailAST subTreeRootAst) {
+    getNextSubTreeNode(DetailAST currentNodeAst, DetailAST subTreeRootAst) {

third is same problem:

     private static Entry<List<DetailAST>, Integer>
-        searchVariableUsageExpressions(final DetailAST variableAst, final DetailAST statementAst) {
+    searchVariableUsageExpressions(final DetailAST variableAst, final DetailAST statementAst) {

all other are same problem:

     private static BeforeExecutionExclusionFileFilter
-            createExclusionBeforeExecutionFileFilter(String fileName) {
+    createExclusionBeforeExecutionFileFilter(String fileName) {

it is known issue https://stackoverflow.com/a/53224774

@romani

romani commented May 25, 2025

Copy link
Copy Markdown
Member

@Anmol202005

Copy link
Copy Markdown
Contributor Author

@romani

romani commented May 25, 2025

Copy link
Copy Markdown
Member

@romani

romani commented May 25, 2025

Copy link
Copy Markdown
Member

@Anmol202005 ,

I need to get access to violations on WhitespaceAfterCheck and IndentationCheck .
to make decision is this defect of Checkstyle or we need some new changes on IDEA formatter side, or report just another issue for IDEA.

<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@Pankraz76 Pankraz76 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

polish.

Comment thread .ci/idea-format.sh
fi
mkdir -p "$RESULTS_DIR"

# Compile the project with Maven

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
# Compile the project with Maven
:: Compile the project with Maven

whats difference between # and :: ? assuming its both comments?

https://stackoverflow.com/a/43158193

Comment thread .ci/idea-format.bat
call "%IDEA_LOCATION%" format -r -s "%FORMAT_PATH%" -m "*.java" ^
"%PROJECT_DIR%\src\xdocs-examples\java"

echo Formatting completed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
echo Formatting completed.
echo Formatting complete.

try present not past. as all logs before have present time form as well

Comment thread .ci/idea-format.bat
echo Running Maven compile...
call mvn -e compile

::Launch inspections

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
::Launch inspections
# Launch inspections

whats difference between # and :: ? assuming its both comments?

https://stackoverflow.com/a/43158193

Comment thread .ci/idea-format.bat
Comment on lines +3 to +9
::----------------------------------------------------------------------
:: IntelliJ IDEA inspections for checkstyle.
::
:: Example:
:: SET IDEA_PATH=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.1\bin\idea.bat
:: .ci\idea-inspection.bat
::----------------------------------------------------------------------

This comment was marked as off-topic.

@Anmol202005

Copy link
Copy Markdown
Contributor Author

I need to get access to violations on WhitespaceAfterCheck and IndentationCheck .

done.

@Pankraz76

Copy link
Copy Markdown

its again very related. If we have eclipse config we can simply automate the checkstyle issues.

@Pankraz76

Copy link
Copy Markdown

spotless has recently gained idea support, might apply this via spot instead of having the custom version. Assuming you also just call the CLI as the spot plugin does.

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

items:

Comment thread .circleci/config.yml

run-formatter:
docker:
- image: checkstyle/idea-docker:jdk11-idea2023.3.4

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we migrated to qodana (official way to run inspections)
may it has formatting also

@romani romani closed this Mar 15, 2026
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.

3 participants