Skip to content

Issue #11163: Enforced file size on inputs#11177

Merged
rnveach merged 1 commit into
checkstyle:masterfrom
Vyom-Yadav:enforceFileSize
Jan 12, 2022
Merged

Issue #11163: Enforced file size on inputs#11177
rnveach merged 1 commit into
checkstyle:masterfrom
Vyom-Yadav:enforceFileSize

Conversation

@Vyom-Yadav

Copy link
Copy Markdown
Member

Resolves #11163: enforce file size on inputs

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/AbstractPathTestSupport.java Outdated
@Vyom-Yadav Vyom-Yadav force-pushed the enforceFileSize branch 3 times, most recently from 5f48fce to 411be70 Compare January 11, 2022 12:22
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/AbstractPathTestSupport.java Outdated
@Vyom-Yadav Vyom-Yadav closed this Jan 11, 2022
@Vyom-Yadav Vyom-Yadav reopened this Jan 11, 2022
@Vyom-Yadav Vyom-Yadav force-pushed the enforceFileSize branch 3 times, most recently from d5ea21c to 219bfa9 Compare January 11, 2022 13:53
@Vyom-Yadav Vyom-Yadav requested a review from rnveach January 11, 2022 14:01

@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/checkstyle_resources_suppressions.xml Outdated
<suppress checks="FileLength"
files="[\\/]expectedUppercaseInPackageNameAst\.txt"/>
<suppress checks="FileLength"
files="[\\/]expectedSpaceBeforeDescriptionInBlockJavadocTagsAst\.txt"/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would think we would not make violations on expected files. It is direct output of the input after going through the Checkstyle process. If the input file is flagged to be trimmed, then it will already affect the expected file. But if we are flagging only the expected file, then it may need extra scrutiny if we can even fix the issue.

@romani ping

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If the input file is flagged to be trimmed, then it will already affect the expected file.

I think that we would have to suppress expected files irrespective of whether the input file for the Checkstyle process is trimmed or not. The input file can be within the limit but the printed AST can exceed the length of 120.
Example -
https://github.com/checkstyle/checkstyle/blob/master/src/test/resources/com/puppycrawl/tools/checkstyle/asttreestringprinter/ExpectedAstTreeStringPrinterFullOfSinglelineComments.txt
The input file is under the limit but the output file is not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It depends on the type of output, but it may be a possibility we can trim the input file more so the output is within the size too. This is why I pinged @romani to confirm.

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.

Yes, we need to exclude txt files, we need to validate only java files.

@rnveach rnveach Jan 11, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For extra clarification after talking to @romani , we will only do Java files as part of this issue since this is the main chunk of our inputs. We will handle non-Java input files in a new issue ( #11178 ). We will exclude "Expected" or "Output" files for now. They are not considered inputs.

@nrmancuso nrmancuso Jan 12, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can use fileExtensions property of FileLengthCheck to specify java files only until #11178

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

@Vyom-Yadav Vyom-Yadav force-pushed the enforceFileSize branch 2 times, most recently from 27b5d56 to 263a1b9 Compare January 12, 2022 07:11
@Vyom-Yadav Vyom-Yadav force-pushed the enforceFileSize branch 2 times, most recently from a5474a5 to a892269 Compare January 12, 2022 09:47

@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.

Ok to merge

@rnveach rnveach merged commit 3b523bd into checkstyle:master Jan 12, 2022
@rnveach

rnveach commented Jan 12, 2022

Copy link
Copy Markdown
Contributor

Resolves #11163

This does not resolve the issue since all suppressions are tied to this issue.

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.

Enforce file size on Java inputs

4 participants