Skip to content

Conversation

@priyanshu16095
Copy link
Contributor

@priyanshu16095 priyanshu16095 commented Feb 12, 2025

Fixes #11419

This PR introduces a functionality to fix integrity issues either individually or all at once by selecting a type.

Mandatory checks

  • I own the copyright of the code submitted and I licence it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

Screenshot (121)
Screenshot (122)

@priyanshu16095
Copy link
Contributor Author

Recording.2025-02-13.mp4

There is a problem with selecting messages using the Shift key. One has to click on a message first, as the focus moves to the entry editor. However, when clicking again with the mouse, all the selected entries are lost.

@priyanshu16095
Copy link
Contributor Author

priyanshu16095 commented Feb 12, 2025

Recording.2025-02-13.mp4

github-actions[bot]

This comment was marked as outdated.

github-actions[bot]

This comment was marked as outdated.

github-actions[bot]

This comment was marked as outdated.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@priyanshu16095
Copy link
Contributor Author

Please review

@priyanshu16095
Copy link
Contributor Author

I have refactored the code a lot and used better practices.
I have used an enum as, without it I would have to use switch-case in every method.
Please guide me on whether I am moving in the right direction.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.
You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.
You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.
You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@priyanshu16095
Copy link
Contributor Author

Recording.2025-02-20.mp4

The feature is completed.
The fixes for the issue are left to be added.

@koppor
Copy link
Member

koppor commented Mar 19, 2025

It lists all the messages that are present in the table. I will improve this. I will identify issues that cannot be fixed automatically and remove them from the dropdown or AI can be used to fix these.

No need to add AI. Just use existing cleanup actions (see docs.jabref.org/finding-sorting-and-cleaning-entries/saveactions for a list)

Note that I linked the actions in the screenshot at #12495 (review) - and I hoped, you could find the code starting from that 😅

@priyanshu16095
Copy link
Contributor Author

priyanshu16095 commented Mar 20, 2025

In some of methods like formatPageNumberRange, replaceNonASCIICharacters, ensureValidEdition, as well as writing tests for them, I have used AI due to lack of understanding about the fields, I should rather ask or search on the web.

I have planned to ask for improvements about the fixes, which is why I have created fixes for only some issues to limit the usage of AI.

Everything else was planned by me, it took me so much iterations from using switch-case in every method to make use of enum, then solving decoupling issues. I used AI just for writing fix methods due to lack of knowledge.

@subhramit
Copy link
Member

subhramit commented Mar 20, 2025

In some of methods like formatPageNumberRange, replaceNonASCIICharacters, ensureValidEdition, as well as writing tests for them, I have used AI due to lack of understanding about the fields, I should rather ask or search on the web.

I have planned to ask for improvements about the fixes, which is why I have created fixes for only some issues to limit the usage of AI.

Everything else was planned by me, it took me so much iterations from using switch-case in every method to make use of enum, then solving decoupling issues. I used AI just for writing fix methods due to lack of knowledge.

Hi, it's fine that you learnt what AI does when you use it without full understanding (issue with >95% PRs we see these days) - and thanks for being honest about it. Please be more careful next time, we are all here to answer questions.

Also, review AI code very well before using. Even if you didn't have idea about fields, the hardcoding of pages "1-10" in updateField(message, StandardField.PAGES, "1-10"); should have given you a hint that something is out of place (I am guessing that's what @koppor was referring to).

Edit: this was answer to your question in #12495 (comment):

Please tell me about the confusion, I am not clear about it.
I created this method because this code was being used in every method for updating fields.

@priyanshu16095 priyanshu16095 marked this pull request as draft March 20, 2025 01:52
Comment on lines +73 to +77
public static Optional<IntegrityIssue> fromMessage(IntegrityMessage message) {
return Arrays.stream(IntegrityIssue.values())
.filter(symbol -> symbol.getText().equals(message.message()))
.findFirst();
}
Copy link

Choose a reason for hiding this comment

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

The method fromMessage does not handle null input for the message parameter, which could lead to a NullPointerException.

@priyanshu16095
Copy link
Contributor Author

Made the combo box display real-time values.

Recording.2025-04-01.mp4

entryTypeCombo.getSelectionModel().selectFirst();
}

public void fix(IntegrityIssue issue, IntegrityMessage message) {
Copy link
Member

Choose a reason for hiding this comment

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

Fix seems a bit slang. "resolveIssue" maybe?

}

public void fix(IntegrityIssue issue, IntegrityMessage message) {
// fixes
Copy link
Member

Choose a reason for hiding this comment

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

fixes,,,?

boolean asciiOnly = CharMatcher.ascii().matchesAllOf(field.getValue());
if (!asciiOnly) {
results.add(new IntegrityMessage(Localization.lang("Non-ASCII encoded character found"), entry,
results.add(new IntegrityMessage(IntegrityIssue.NON_ASCII_ENCODED_CHARACTER_FOUND.getText(), entry,
Copy link
Member

Choose a reason for hiding this comment

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

Goes a bit beyond the scope of this PR, but you could refactor the IntegrityMessage to accept just the symbol and to resolve the symbol to a string at the caller.

@priyanshu16095
Copy link
Contributor Author

Some changes I haven't commited such as removed the issuesListProperty, because I am working on it.

return messages;
}

public void resolveIssue(IntegrityIssue issue, IntegrityMessage message) {
Copy link

Choose a reason for hiding this comment

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

The method 'resolveIssue' is public and should not return null. It should use java.util.Optional to handle potential null values.

@jabref-machine
Copy link
Collaborator

Note that your PR will not be reviewed/accepted until you have gone through the mandatory checks in the description and marked each of them them exactly in the format of [x] (done), [ ] (not done yet) or [/] (not applicable).

@koppor koppor moved this to Paring in JabRef Sep 29, 2025
@koppor koppor added this to JabRef Sep 29, 2025
@calixtus
Copy link
Member

calixtus commented Oct 9, 2025

I think the idea is very nice of the simple fix options, but i believe this PR is too far behind the commits in the main branch the fix all the merge conflicts. Closing this now, work is not lost, but archived. Thank you for your efforts and your contributions to JabRef. We really appreciate it.

@calixtus calixtus closed this Oct 9, 2025
@github-project-automation github-project-automation bot moved this from Pairing to Done in JabRef Oct 9, 2025
@palukku palukku moved this from Done to Pairing in JabRef Oct 10, 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.

integrity check and follow up actions

6 participants