Skip to content

Issue #16802: improve spelling and typo in CheckstyleAntTask #16774

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

Closed
wants to merge 1 commit into from

Conversation

Pankraz76
Copy link

@Pankraz76 Pankraz76 commented Apr 6, 2025

Issue #16802: improve spelling and typo in CheckstyleAntTask

fix whitespace typo
Running Checkstyle on 1 files.
Running Checkstyle on 1 files.

I was wondering about this issue myself and found it accidentally while refactoring this class in #16772.

Pankraz76 pushed a commit to Pankraz76/checkstyle that referenced this pull request Apr 6, 2025
@Pankraz76 Pankraz76 changed the title Pull #16772: fix whitespace typo Running Checkstyle on 1 files. Pull #16774: fix whitespace typo Running Checkstyle on 1 files. Apr 6, 2025
@Pankraz76 Pankraz76 marked this pull request as ready for review April 6, 2025 12:15
@Pankraz76
Copy link
Author

Pankraz76 commented Apr 7, 2025

this might be a low hanging fruit, what do you think @nrmancuso?

Pankraz76 pushed a commit to Pankraz76/checkstyle that referenced this pull request Apr 7, 2025
Pankraz76 pushed a commit to Pankraz76/checkstyle that referenced this pull request Apr 7, 2025
new MessageLevelPair("Adding standalone file for audit", Project.MSG_VERBOSE),
new MessageLevelPair("To locate the files took \\d+ ms.", Project.MSG_VERBOSE),
new MessageLevelPair("Running Checkstyle on 1 files", Project.MSG_INFO),
new MessageLevelPair("Running Checkstyle on 1 files", Project.MSG_INFO),
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to not use singular “file” here? This has always bothered me.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I wanted to use "file(s)" but the test breaks due to regex matching. Using plural "files" would work better since we typically process multiple files in a codebase, though the test case specifically mentions singular.

Currently we have inconsistent usage of singular vs plural ("file" vs "files") when processing. This makes sense since we usually process multiple files, but the test expects singular.

I initially standardized on singular for consistency everywhere, but now I'm considering:

  1. Reverting to plural ("files") everywhere since it's more accurate
  2. Only applying singular ("file") in this specific test case

Which approach would you prefer?

Log messages should match
expected to match: Running Checkstyle on 1 file(s).
but was          : Running Checkstyle on 1 file(s).
Looks like you want to use .isEqualTo() for an exact equality assertion.

Pankraz76 pushed a commit to Pankraz76/checkstyle that referenced this pull request Apr 7, 2025
@Pankraz76 Pankraz76 requested a review from nrmancuso April 7, 2025 13:51
Pankraz76 pushed a commit to Pankraz76/checkstyle that referenced this pull request Apr 8, 2025
new MessageLevelPair("Using configuration file:.*", Project.MSG_VERBOSE),
new MessageLevelPair(auditStartedMessage, Project.MSG_DEBUG),
new MessageLevelPair(auditFinishedMessage, Project.MSG_DEBUG),
new MessageLevelPair("To process the files took \\d+ ms.", Project.MSG_VERBOSE),
new MessageLevelPair("File processing took \\d+ ms.", Project.MSG_VERBOSE),
Copy link
Author

Choose a reason for hiding this comment

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

It's more compact and less verbose (boilerplate), and more focused on what’s actually happening.
It also aligns with the existing pattern.
This sounds more professional to me.

Copy link
Author

Choose a reason for hiding this comment

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

Any reason to not use singular “file” here? This has always bothered me.

now singular makes sense, as its very generic, simple and basic; making the plural overhead obsolet.

@Pankraz76
Copy link
Author

is this any good? @rdiachenko

Pankraz76 pushed a commit to Pankraz76/checkstyle that referenced this pull request Apr 8, 2025
Pankraz76 pushed a commit to Pankraz76/checkstyle that referenced this pull request Apr 8, 2025
@@ -277,6 +272,9 @@ public void execute() {
if (config == null) {
throw new BuildException("Must specify 'config'.", getLocation());
}
final String version = CheckstyleAntTask.class.getPackage().getImplementationVersion();
log("Checkstyle version: " + version, Project.MSG_VERBOSE);
log("Using config " + config, Project.MSG_VERBOSE);
Copy link
Author

Choose a reason for hiding this comment

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

This increases cohesion and reduces coupling, as the config file is now actually used here—we just verified the valid state for later use in logging. So, it makes sense to group these elements together, rather than where the usage was previously.

It also contributes to the narrative in the logging info, since the config file is somewhat related to the version; both are meta-information and therefore logically belong together.

@@ -875,14 +875,14 @@ public final void testExecuteLogOutput() throws Exception {
final String auditFinishedMessage = bundle.getString(DefaultLogger.AUDIT_FINISHED_MESSAGE);

final List<MessageLevelPair> expectedList = Arrays.asList(
new MessageLevelPair("checkstyle version .*", Project.MSG_VERBOSE),
new MessageLevelPair("Checkstyle version: .*", Project.MSG_VERBOSE),
new MessageLevelPair("Using config file:.*", Project.MSG_VERBOSE),
Copy link
Author

Choose a reason for hiding this comment

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

It also contributes to the narrative in the logging info, since the config file is somewhat related to the version; both are meta-information and therefore logically belong together.

assertLoggedTime(loggedMessages, testingTime, "To locate the files");
assertLoggedTime(loggedMessages, testingTime, "To process the files");
assertLoggedTime(loggedMessages, testingTime, "File discovery took");
assertLoggedTime(loggedMessages, testingTime, "File processing took");
Copy link
Author

Choose a reason for hiding this comment

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

you can not take away without breaking
you can not spell clean without lean

@Pankraz76 Pankraz76 changed the title Pull #16774: fix whitespace typo Running Checkstyle on 1 files. Pull #16774: fix spelling and whitespace typo in CheckstyleAntTask Apr 8, 2025
@Pankraz76 Pankraz76 changed the title Pull #16774: fix spelling and whitespace typo in CheckstyleAntTask Pull #16774: improve spelling and fix whitespace typo in CheckstyleAntTask Apr 8, 2025
@Pankraz76 Pankraz76 changed the title Pull #16774: improve spelling and fix whitespace typo in CheckstyleAntTask Pull #16774: improve spelling and fix whitespace typo in CheckstyleAntTask Apr 8, 2025
@Pankraz76 Pankraz76 changed the title Pull #16774: improve spelling and fix whitespace typo in CheckstyleAntTask Pull #16774: improve spelling and fix whitespace typo in CheckstyleAntTask Apr 8, 2025
@rdiachenko
Copy link
Contributor

@pankratz76 what issue are you trying to solve here? Please update description with a link to approved issue and make sure ci is green before we can proceed with review.

@Pankraz76 Pankraz76 changed the title Pull #16774: improve spelling and fix whitespace typo in CheckstyleAntTask Issue #16802: improve spelling and typo in CheckstyleAntTask Apr 9, 2025
@Pankraz76
Copy link
Author

Pankraz76 commented Apr 9, 2025

@pankratz76 what issue are you trying to solve here? Please update description with a link to approved issue and make sure ci is green before we can proceed with review.

created an dedicated issues for typo fix in #16802

@Pankraz76
Copy link
Author

space typo fix: #16806

nehamanoj1105 added a commit to nehamanoj1105/checkstyle that referenced this pull request Apr 10, 2025
Fix typo and simplify message in CheckstyleAntTask (issue checkstyle#16774)
@Pankraz76 Pankraz76 marked this pull request as draft April 13, 2025 19:06
@Pankraz76 Pankraz76 closed this Apr 14, 2025
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