Skip to content

refactor: reduce cognitive complexity in ExpressionParser.parseExpres… - #1899

Merged
lbroudoux merged 2 commits into
microcks:1.13.xfrom
Nimesh-0000:fix/reduce-cognitive-complexity-expression-parser
Jan 21, 2026
Merged

lbroudoux merged 2 commits into
microcks:1.13.xfrom
Nimesh-0000:fix/reduce-cognitive-complexity-expression-parser

Conversation

@Nimesh-0000

Copy link
Copy Markdown
Contributor

issue --> java:S3776 Cognitive Complexity of methods should not be too high
Link: https://sonarcloud.io/project/issues?issueStatuses=OPEN%2CCONFIRMED&id=microcks_microcks&open=AYmZthxVBCcdL_hhQMb2&tab=activity

Changes -->

  • Extract validation logic into separate helper methods
  • Reduce cognitive complexity from 20 to 15
  • Improve code readability and maintainability
  • No functional changes, all tests passing (41/41)

Methods extracted:

  • addLiteralIfNeeded(): Handle literal expression addition
  • validateSuffixFound(): Validate suffix existence
  • validateSuffixNotEmpty(): Validate non-empty expressions
  • extractAndValidateExpression(): Extract and validate expression string
  • addParsedExpression(): Handle expression parsing with curly brace wrapping

@github-actions

github-actions Bot commented Jan 6, 2026

Copy link
Copy Markdown

👋 @Nimesh-0000

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

🌟 ~~~~~~~~~ 🌟

📢 If you like Microcks, please ⭐ star ⭐ our repo to support it!

🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

@Nimesh-0000
Nimesh-0000 force-pushed the fix/reduce-cognitive-complexity-expression-parser branch from a44a24b to b99ce51 Compare January 6, 2026 09:32
@lbroudoux

Copy link
Copy Markdown
Member

Hey! Thanks for taking the time pushing this! It actually looks great but it's targeting the master branch instead of the current 1.13.x where development happens. Can you please rebase your work and target the 1.13.x branch in your PR? Thanks,

@Nimesh-0000
Nimesh-0000 force-pushed the fix/reduce-cognitive-complexity-expression-parser branch from b99ce51 to 58d0a4c Compare January 8, 2026 07:39
@Nimesh-0000
Nimesh-0000 changed the base branch from master to 1.13.x January 8, 2026 07:46
lbroudoux and others added 2 commits January 8, 2026 13:18
Signed-off-by: Laurent Broudoux <[email protected]>

Signed-off-by: Nimesh-0000 <[email protected]>
…sions

- Extract validation logic into separate helper methods
- Reduce cognitive complexity from 20 to 15
- Improve code readability and maintainability
- No functional changes, all tests passing (41/41)

Methods extracted:
- addLiteralIfNeeded(): Handle literal expression addition
- validateSuffixFound(): Validate suffix existence
- validateSuffixNotEmpty(): Validate non-empty expressions
- extractAndValidateExpression(): Extract and validate expression string
- addParsedExpression(): Handle expression parsing with curly brace wrapping

Signed-off-by: Nimesh-0000 <[email protected]>
@Nimesh-0000
Nimesh-0000 force-pushed the fix/reduce-cognitive-complexity-expression-parser branch from 58d0a4c to 08fcf23 Compare January 8, 2026 07:48
@lbroudoux lbroudoux added this to the Next milestone Jan 21, 2026
@lbroudoux

lbroudoux commented Jan 21, 2026 •

Copy link
Copy Markdown
Member

Build is ok and it looks good. I'll have a final review before merging. Thanks again for taking the time to push this @Nimesh-0000 !! 👍

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

It looks great!

@lbroudoux
lbroudoux merged commit 8b78ae6 into microcks:1.13.x Jan 21, 2026
8 of 9 checks passed
@github-actions

Copy link
Copy Markdown

🎉 @Nimesh-0000

You are now a Microcks community contributor! 💖

Thanks and congrats 🚀 on merging your first pull request! We are delighted and very proud of you! 👏

📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌"

Kudos and please keep going, we need you 🙌

🌟 ~~~~~~~~~ 🌟

📢 If you like Microcks, please ⭐ star ⭐ our repo to support it!

🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants