-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Crafting round-trip test for Cff importer/exporter #10957
Conversation
* Bump org.apache.lucene:lucene-queries from 9.9.1 to 9.10.0 Bumps org.apache.lucene:lucene-queries from 9.9.1 to 9.10.0. --- updated-dependencies: - dependency-name: org.apache.lucene:lucene-queries dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * introduce var for lucene --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Siedlerchr <siedlerkiller@gmail.com>
* Implemented the feature that deleting files which linked to selected entries when user select deletion, and keeping files unchanged when user select cut * The following features are implemented: 1.Initializes a pop-up dialog box to confirm whether the user wants to delete attached files from selected entry. 2.Keep track of user preference: if the user prefers always delete attached files, delete the files without displaying the dialog box. 3. Add preference options in File>Preference>Linked Files>Attached files so that users can manage preferences * update CHANGELOG.md * Add language keys to english language file * restore files in src/main/resources/csl-locales and src/main/resources/csl-styles * Removed unnecessary comments and finxed some requested changes. Added new features: 1. When deleting attached files, the name of files to be deleted will be displayed. 2. Solved the access error caused by repeated deletion of files when one file is attached to multiple entries. * Add language keys to english language file * Modify language keys to english language file * made deleteFileFromDisk method static * update comment of method deleteFileFromDisk * fixed coding styles * restored unexpected code changes * fix logic * try null * todo * Unify dialogs that confirmation deleting files * Get around LinkedFile in LIbraryTab, Encapsulate LinkedFile into LinkedFileViewModel * fix style * restore files * Unified the different dialogs when deleting entries, removerd unnecessary dialogs * fix csl-styles * try to fix csl-styles * try to fix csl-styles again * try to fix csl-styles again 2 * try to fix csl-styles again 3 * Update prompts in en.properties * New features - Add to Trash - Group file-related language strings together * Fix architecture tests * Introduce list of files to delete * Streamline 1 vs. many files * Fix openRewrite * Discard changes to src/test/resources/org/jabref/logic/search/test-library-with-attached-files.bib * Adapt true/false logic according to expectations * Add "Trash" to CHANGELOG.md * Fix localization * Fix JabRef_en.properties * Add some debug statements * Fix preferences * Separate log entries by empty line * More refined dialog --------- Co-authored-by: Siedlerchr <siedlerkiller@gmail.com> Co-authored-by: Oliver Kopp <kopp.dev@gmail.com> Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
#10914) * Fix duplicate check/merge entries dialog not triggered on import from browser Refs #5858 * changelog * remove double duplicate check * remove l10n * add icon, downloading is also handled in import entries * changelog * fix l10n * Update JabRef_en.properties * Update ImportEntriesDialog.java --------- Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Made a class comment in CffDate.java Replaced System.lineseparator() with OS.NEWLINE in CffDate.java Added a final newline in cff.layout file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff is too large for me to inspect wihtout tool support.
Until I manage to get a AST-based diff tool running, a small comment to keep you going.
assertEquals(1, entries.size()); | ||
BibEntry entry = entries.get(0); | ||
|
||
assertEquals("My awesome research software", entry.getField(StandardField.TITLE).orElse(null)); | ||
assertEquals("Mona Lisa and Hew Bot", entry.getField(StandardField.AUTHOR).orElse(null)); | ||
assertEquals("10.0000/00000", entry.getField(StandardField.DOI).orElse(null)); | ||
assertEquals("Journal Title", entry.getField(StandardField.JOURNAL).orElse(null)); | ||
assertEquals("1", entry.getField(StandardField.VOLUME).orElse(null)); | ||
assertEquals("1", entry.getField(StandardField.ISSUE).orElse(null)); | ||
assertEquals("1-10", entry.getField(StandardField.PAGES).orElse(null)); | ||
assertEquals("2021", entry.getField(StandardField.YEAR).orElse(null)); | ||
System.out.println("Test Successful!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rewrite using the idea of org.jabref.logic.database.DatabaseMergerTest#mergeAddsNonDuplicateEntries: List.of, BibEntry.withfield...
Please no Println with "test successful". IntelliJ will have green or red indicators. See the last part (marked as "optional") in our guide: https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-12-build.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure , I'll make the necessary changes. Thanks for the comments!
|
||
List<BibEntry> entriesList = new ArrayList<>(); | ||
entriesList.add(entry); | ||
|
||
return new ParserResult(entriesList); | ||
} | ||
|
||
private void PreferredCitationMethod(JsonNode preferredCitation, Map<Field, String> entryMap, BibEntry entry) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method start with a lower case letter (lower camel case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure I'll change the method name. Thank you!
@Raahitya-14 Please do not reference issues in commits. The pull request should reference an issue. Reasoning: There will be more than 1 commit referencing an issue. Thus, the issue will be swamped with references to commits, which are becoming obsolete while the implementation evolves. Round trip was asked for at #10917 (comment). Thus, the, referenced issue #10661 was not right.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting PRs with guidance without fully thinking through is a though work - when the own time limits are respected.
I think, the direction is OKish, but you should try to keep existing functionality, which is perfectly backed by tests. Therefore, you see failing unit tests at org.jabref.logic.importer.fileformat.CffImporterTest
. Please update the code to cover the existing use case
Work on importing https://github.com/JabRef/jabref/blob/main/CITATION.cff
In case there is a preferred citation, the other citation should be imported to another BibEntry. (I am not sure if the infrastructuire of JabRef supports that, but it should be able to generated muliple entries based on a single file)
src/main/java/org/jabref/logic/importer/fileformat/CffImporter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/importer/fileformat/CffImporter.java
Outdated
Show resolved
Hide resolved
@Raahitya-14 Please keep watching the red crosses of GitHub and try to fix them: |
This PR adds a round-trip test for Cff importer and exporter as requested in the comments of #10661. For the round-trip test to work, we need to address the difference in implementations between the importer and the exporter. In cff, there is one type of field, which is called 'preferred-citation' that can be used to give different types than 'sofware' to your entry, the exporter always uses it to pass the relevant type (i.e. 'article', 'inproceedings', 'book', etc) but the importer does not parse this field. Therefore, to address this issue and for the round-trip test to work, modification of the importer to parse the 'preferred-citation' field was required. There also is a problem with the author's name which needs to be changed to accept two arguments.
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)