Skip to content

Update checkExpressions #1351

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 5 commits into from
Closed

Conversation

DeHopen
Copy link
Contributor

@DeHopen DeHopen commented May 16, 2025

I have optimized the checkExpressions method in the CurlyBracketsStructureCheck class. Instead of looping through all EXPR nodes, FluentIterable is now used to filter only those nodes that are on the first or last row of the block. This reduces the number of iterations and makes the code more readable and declarative.

Reasons for the change:

  • Reducing the number of iterations: Previously, the code checked each node, even if it was not on the first or last line. Now we filter only the necessary nodes, which speeds up the execution.
  • Improved readability: Using FluentIterable makes the code more declarative and understandable, as it is clearly visible that we are filtering nodes according to a certain condition.
  • Following modern practices: Using a functional style with FluentIterable is consistent with modern Java development practices.

@DeHopen
Copy link
Contributor Author

DeHopen commented May 19, 2025

@yegor256

CI is green

@DeHopen
Copy link
Contributor Author

DeHopen commented May 20, 2025

@yegor256 ping

2 similar comments
@DeHopen
Copy link
Contributor Author

DeHopen commented May 21, 2025

@yegor256 ping

@DeHopen
Copy link
Contributor Author

DeHopen commented May 22, 2025

@yegor256 ping

@yegor256
Copy link
Owner

@DeHopen I don't see enough motivation for this change

@yegor256 yegor256 closed this May 22, 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.

2 participants