Skip to content
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

CU-86b35ftpj_PW-2113--parsing comments and extracting MT from multi-format message #135

Conversation

ptorres-prowide
Copy link
Contributor

@ptorres-prowide ptorres-prowide commented Dec 13, 2024

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added support for extracting comments from XML messages.
    • Introduced methods for parsing comments based on specific criteria and extracting MT from multi-format messages.
  • Bug Fixes

    • Addressed various issues from previous versions, including a NullPointerException.
  • Documentation

    • Updated changelog to reflect new features and bug fixes in version 9.4.8 and previous versions.
  • Tests

    • Enhanced test coverage for new functionalities related to comment parsing and multi-format message handling.

Copy link

coderabbitai bot commented Dec 13, 2024

Caution

Review failed

The pull request is closed.

📝 Walkthrough
<details>
<summary>📝 Walkthrough</summary>

## Walkthrough
The pull request introduces updates to the XML message handling capabilities within the software. It adds new methods for extracting comments from XML strings and for creating MT messages from multi-format inputs. The `MxParseUtils` class has been enhanced with several new parsing methods, and corresponding tests have been added to ensure functionality. Additionally, the changelog has been updated to reflect these changes, including bug fixes and enhancements across multiple versions.

## Changes

| File                                                                 | Change Summary                                                                                          |
|----------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
| `CHANGELOG.md`                                                      | Updated to include version 9.4.8 features: XML comment extraction and MT creation from multi-format messages. Documented bug fixes and updates from versions 9.4.7 to 9.5.4. |
| `iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/MxParseUtils.java` | Added methods: `parseComments`, `parseCommentsStartsWith`, `parseCommentsContains`, and `parseMtFromMultiformatMessage` to enhance XML parsing capabilities. Updated imports. |
| `iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/MxParseUtilsTest.java` | Added tests: `testParseComments`, `testParseCommentsStartsWith`, `testParseCommentsContains`, and `testParseMtFromMultiFormatMessage` to validate new parsing functionalities. Modified existing test methods for XML consistency. |

## Possibly related PRs
- #135: The changes in this PR directly relate to the addition of new APIs in the `MxParseUtils` class for extracting comments from XML and parsing multi-format messages, which aligns with the enhancements described in the main PR.

## Suggested reviewers
- zubri

</details>

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a355ffc and 5e2ad50.

📒 Files selected for processing (1)
  • iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/MxParseUtils.java (2 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 89fb355 and cfe9069.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/MxParseUtils.java (2 hunks)
  • iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/MxParseUtilsTest.java (4 hunks)
🧰 Additional context used
🪛 Markdownlint (0.37.0)
CHANGELOG.md

3-3: Expected: h2; Actual: h4
Heading levels should only increment by one level at a time

(MD001, heading-increment)


4-4: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


5-5: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


3-3: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


4-4: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)

🔇 Additional comments (1)
iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/MxParseUtilsTest.java (1)

423-426: ⚠️ Potential issue

Incorrect method used in testParseCommentsContents

In the testParseCommentsContents method, you are calling parseCommentsStartsWith(xml, "TranslationResult");, but based on the method name, it seems you intended to use parseCommentsContains.

Please update the test to use parseCommentsContains to accurately test the intended functionality.

-    List<String> strings = MxParseUtils.parseCommentsStartsWith(xml, "TranslationResult");
+    List<String> strings = MxParseUtils.parseCommentsContains(xml, "TranslationResult");

Likely invalid or redundant comment.

@zubri zubri changed the title CU-86b35ftpj_PW-2113--A-way-to-parse-the-MT-value-from-a-ISO-20022-mu… CU-86b35ftpj_PW-2113--parsing comments in the XML Dec 19, 2024
@zubri zubri changed the title CU-86b35ftpj_PW-2113--parsing comments in the XML CU-86b35ftpj_PW-2113--parsing comments and extracting MT from multi-format message Dec 19, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cfe9069 and a355ffc.

📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/MxParseUtils.java (2 hunks)
  • iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/MxParseUtilsTest.java (4 hunks)
🧰 Additional context used
🪛 Markdownlint (0.37.0)
CHANGELOG.md

3-3: Expected: h2; Actual: h4
Heading levels should only increment by one level at a time

(MD001, heading-increment)


4-4: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


5-5: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


6-6: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


3-3: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


4-4: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)

🔇 Additional comments (4)
iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/MxParseUtils.java (2)

297-301: Inaccurate JavaDoc: Method does not remove prefix from comments
This has already been flagged in a previous review. The JavaDoc states “removes the prefix from each matching comment,” but the implementation does not actually remove the prefix.


318-322: Inaccurate JavaDoc: Method does not remove prefix from comments
This has also been flagged before. The JavaDoc for this method claims to remove a prefix, but the code simply filters comments based on substring.

CHANGELOG.md (1)

3-5: 🧹 Nitpick (assertive)

Fix heading level and list indentation for consistency
The heading at line 3 should maintain a consistent level (e.g., h2), with blank lines around headings and list items.

Apply this diff to comply with common Markdown standards:

-#### 9.4.8 - SNAPSHOT
+## 9.4.8 - SNAPSHOT

-  * (PW-2113) Added API in the `MxParseUtils` to extract comments from XML string
+  * (PW-2113) Added API in the `MxParseUtils` to extract comments from XML string

-  * (PW-2113) Added API in the `MxParseUtils` to extract the enclosed MT from a multi-format MX message
+  * (PW-2113) Added API in the `MxParseUtils` to extract the enclosed MT from a multi-format MX message

Likely invalid or redundant comment.

🧰 Tools
🪛 Markdownlint (0.37.0)

3-3: Expected: h2; Actual: h4
Heading levels should only increment by one level at a time

(MD001, heading-increment)


4-4: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


5-5: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


3-3: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


4-4: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)

iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/MxParseUtilsTest.java (1)

336-368: Good use of representative XML snippet for coverage
The test method “testIdentifyMessage_FromBAH” offers excellent coverage by validating business service and message ID.

@zubri zubri merged commit 1cfa0a4 into main Dec 19, 2024
1 check was pending
@zubri zubri deleted the CU-86b35ftpj_PW-2113--A-way-to-parse-the-MT-value-from-a-ISO-20022-multi-format-message branch December 19, 2024 00:21
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