Skip to content

Issue #16378: Validate that all Inputs mentioned all default properties#16760

Merged
romani merged 1 commit intocheckstyle:masterfrom
Anmol202005:inlineConfig
May 19, 2025
Merged

Issue #16378: Validate that all Inputs mentioned all default properties#16760
romani merged 1 commit intocheckstyle:masterfrom
Anmol202005:inlineConfig

Conversation

@Anmol202005
Copy link
Copy Markdown
Contributor

fixes #16378

updated InlineConfigParser.java to validate that all properties are specified in Input file. if all properties are default, all properties should be mentioned in Input file and all has prefix (default).

@Anmol202005 Anmol202005 force-pushed the inlineConfig branch 3 times, most recently from 6921ccd to 258daf7 Compare April 5, 2025 07:20
Copy link
Copy Markdown

@Pankraz76 Pankraz76 left a comment

Choose a reason for hiding this comment

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

well done

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
@Anmol202005
Copy link
Copy Markdown
Contributor Author

@pankratz76 will get started with beautification once the CI is green.

Copy link
Copy Markdown
Member

@rdiachenko rdiachenko left a comment

Choose a reason for hiding this comment

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

@Anmol202005 this PR is huge and hard to review properly. Could you think of a way to split it onto smaller ones. Can we focus on updating the inline parser first and applying its validation to a single test only, and after that gradually update all the rest test classes?

@Anmol202005
Copy link
Copy Markdown
Contributor Author

@Anmol202005 this PR is huge and hard to review properly. Could you think of a way to split it onto smaller ones.

agreed, what about if we raise a supplemental PR with all changes in input file and update the inline parser in this PR :)

@rdiachenko
Copy link
Copy Markdown
Member

@Anmol202005 this PR is huge and hard to review properly. Could you think of a way to split it onto smaller ones.

agreed, what about if we raise a supplemental PR with all changes in input file and update the inline parser in this PR :)

Let's update inline parser + one test file in this PR. In the follow-up PRs let's do one test package per PR. Please create a list of subtasks in the issue for each package so we can track what has been fixed.

@Anmol202005
Copy link
Copy Markdown
Contributor Author

Anmol202005 commented Apr 8, 2025

Let's update inline parser + one test file in this PR. In the follow-up PRs let's do one test package per PR. Please create a list of subtasks in the issue for each package so we can track what has been fixed.

look a better approach!
meanwhile i just updated all the input Files , will revert them :(

@Pankraz76
Copy link
Copy Markdown

Let's update inline parser + one test file in this PR. In the follow-up PRs let's do one test package per PR. Please create a list of subtasks in the issue for each package so we can track what has been fixed.

look a better approach! meanwhile i just updated all the input Files , will revert them :(

maybe keep them locally in a dedicated branch, so you can reuse later and try to merge after the supplemental PR is in main.

@Anmol202005
Copy link
Copy Markdown
Contributor Author

@rdiachenko,
updated the pr as discussed, only finalparameters package is updated.
raised issue for the rest: #16807

@rdiachenko
Copy link
Copy Markdown
Member

rdiachenko commented Apr 9, 2025

@rdiachenko, updated the pr as discussed, only finalparameters package is updated. raised issue for the rest: #16807

Thanks, @Anmol202005 . Please make use ci is green, there are failed inspections like this one:

<problem>
<file>file://$PROJECT_DIR$/src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java</file>
<line>958</line>
<module>project</module>
<package>com.puppycrawl.tools.checkstyle.bdd</package>
<entry_point TYPE="method" FQNAME="com.puppycrawl.tools.checkstyle.bdd.InlineConfigParser void setProperties(com.puppycrawl.tools.checkstyle.bdd.ModuleInputConfiguration.Builder inputConfigBuilder, java.lang.String inputFilePath, java.util.List<java.lang.String> lines, int beginLineNo, java.lang.String moduleName, java.util.Map<java.lang.String,java.lang.String> defaultProperties)"/>
<problem_class id="ParametersPerMethod" severity="ERROR" attribute_key="ERRORS_ATTRIBUTES">Method with too many parameters</problem_class>
<description><code>setProperties()</code> has too many parameters (num parameters = 6) #loc</description>
<highlighted_element>setProperties</highlighted_element>
<language>JAVA</language>
<offset>24</offset>
<length>13</length>
</problem>

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
@Anmol202005 Anmol202005 force-pushed the inlineConfig branch 2 times, most recently from b258725 to 951ddd5 Compare April 13, 2025 17:31
Copy link
Copy Markdown

@Pankraz76 Pankraz76 left a comment

Choose a reason for hiding this comment

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

nicely done now, try to increase cohesion.

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Copy link
Copy Markdown
Member

@rdiachenko rdiachenko left a comment

Choose a reason for hiding this comment

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

@Anmol202005 instead of having custom logic to load default properties, could you check if we can use XmlMetaReader.readAllModulesIncludingThirdPartyIfAny() please? From a quick glance, it does what you are trying to achieve and gives you a list of module objects including module properties.

@Anmol202005 Anmol202005 force-pushed the inlineConfig branch 3 times, most recently from 8c283d8 to 0bec7c6 Compare April 22, 2025 08:29
@Anmol202005
Copy link
Copy Markdown
Contributor Author

@rdiachenko XmlMetaReader.readAllModulesIncludingThirdPartyIfAny() works well and really improves the readability.
Although there is a CI failure, can u please help out with it.

Copy link
Copy Markdown

@Pankraz76 Pankraz76 left a comment

Choose a reason for hiding this comment

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

sugar

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
@rdiachenko
Copy link
Copy Markdown
Member

@rdiachenko XmlMetaReader.readAllModulesIncludingThirdPartyIfAny() works well and really improves the readability. Although there is a CI failure, can u please help out with it.

I don't see how it is related to your changes as mutations are in ImportControlCheck.java and other ImportXXX classes. Please try to update to latest master.

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Copy link
Copy Markdown

@Pankraz76 Pankraz76 left a comment

Choose a reason for hiding this comment

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

try to avoid feature envy.

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

item:

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

item:

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

item

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
@Anmol202005 Anmol202005 force-pushed the inlineConfig branch 3 times, most recently from 51242c1 to d8cd07f Compare May 17, 2025 18:46
Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

items:

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/bdd/InlineConfigParser.java Outdated
Copy link
Copy Markdown

@Pankraz76 Pankraz76 left a comment

Choose a reason for hiding this comment

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

thanks for consistent push, you will get this done.

Copy link
Copy Markdown

@Pankraz76 Pankraz76 left a comment

Choose a reason for hiding this comment

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

SOC

@romani
Copy link
Copy Markdown
Member

romani commented May 18, 2025

@Anmol202005 , please fix unresovled items above.

@Anmol202005 Anmol202005 force-pushed the inlineConfig branch 3 times, most recently from e6d9571 to 998506a Compare May 19, 2025 12:52
@Anmol202005
Copy link
Copy Markdown
Contributor Author

@Anmol202005 , please fix unresovled items above.

done.

Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

I am good with this .
I would like to make some call less nested (to avoid functional mess), but give it to next reviewee to decide

@romani
Copy link
Copy Markdown
Member

romani commented May 19, 2025

I reset review status from Pankraz76, not be blocker for review.

Copy link
Copy Markdown

@Pankraz76 Pankraz76 left a comment

Choose a reason for hiding this comment

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

polish.

Copy link
Copy Markdown
Member

@rdiachenko rdiachenko left a comment

Choose a reason for hiding this comment

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

lgtm

@rdiachenko rdiachenko assigned romani and unassigned rdiachenko May 19, 2025
@romani romani merged commit 140f152 into checkstyle:master May 19, 2025
117 checks passed
harshittomar0201 added a commit to harshittomar0201/checkstyle that referenced this pull request Apr 2, 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.

Validate that all Inputs mentioned all default properties in config

4 participants