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

Store journal abbreviation lists in specified directory #12544

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b2dc993
feat: Allow user to set journal abbreviation directory and ensure cus…
adhamahmad Feb 23, 2025
53ac1f7
removed extra spaces
adhamahmad Feb 23, 2025
1eb3eb0
removed extra spaces
adhamahmad Feb 23, 2025
628a648
Merge branch 'main' into fix-for-issue-10557
adhamahmad Feb 23, 2025
c8d0eaf
Merge branch 'JabRef:main' into fix-for-issue-10557
adhamahmad Feb 26, 2025
b926f72
Merge branch 'main' into fix-for-issue-10557
adhamahmad Mar 16, 2025
cc70174
Implement automatic detection of journal lists and CSV to MVStore con…
adhamahmad Mar 16, 2025
b54cb36
Apply OpenRewrite fixes to follow JabRef coding guidelines
adhamahmad Mar 16, 2025
7fa15b1
Add detailed JavaDoc for initializeDirectory method
adhamahmad Mar 16, 2025
4b57648
Refactor: Extract magic strings as constants for maintainability
adhamahmad Mar 16, 2025
0ce80ba
Refactor: removed trivial comment
adhamahmad Mar 16, 2025
29eaf82
Merge branch 'main' into fix-for-issue-10557
adhamahmad Mar 16, 2025
ffd98f7
Regenerate missing .mv files even if CSV timestamps are unchanged
adhamahmad Mar 16, 2025
fdf074f
Created Unit tests for CsvToMv conversion
adhamahmad Mar 17, 2025
b8ee7ef
Removed .csv branch from JournalAbbreviationsTabViewModel.updtaeJour…
adhamahmad Mar 17, 2025
700f63c
Merge remote-tracking branch 'upstream/main' into fix-for-issue-10557
adhamahmad Mar 17, 2025
1b96435
Merge branch 'main' into fix-for-issue-10557
adhamahmad Mar 17, 2025
07acaff
Merge branch 'main' into fix-for-issue-10557
adhamahmad Mar 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
<!-- YOU HAVE TO MODIFY THE TEXT BELOW TO FIT YOUR PR. OTHERWISE, YOUR PR WILL BE CLOSED WITHOUT FURTHER COMMENT. -->
<!-- YOU HAVE TO MODIFY THIS TEXT TO FIT YOUR PR. OTHERWISE, YOUR PR WILL BE CLOSED WITHOUT FURTHER COMMENT. -->

<!-- LINK THE ISSUE WITH THE "Closes" KEYWORD -->
<!-- Example: Closes (link) OR Closes #12345 -->
Describe the changes you have made here: what, why, ...

Closes _____
Describe the changes you have made here: what, where, why, ...
If your work is not yet complete, please open a draft pull request. In that case, outline your intended next steps. Do you need feedback? Will you continue in parallel? ...
<!-- LINK THE ISSUE WITH THE "Closes" KEYWORD -->
<!-- Example: Closes (link) OR Closes #xyz -->

### Mandatory checks

<!--
Go throgh the checklist below. It is mandatory, even for a draft pull request.

Keep ALL the items. Mark them as follows:
[x] done
[ ] not done
[/] not applicable
- Go through the list below. Please don't remove any items.
- [x] done; [ ] not done / not applicable
-->

- [x] I own the copyright of the code submitted and I license it under the [MIT license](https://github.com/JabRef/jabref/blob/main/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 (if change is visible to the user)
- [ ] Screenshots added in PR description (for UI changes)
- [ ] [Checked developer's documentation](https://devdocs.jabref.org/): Is the information available and up to date? If not, I outlined it in this pull request.
- [ ] [Checked documentation](https://docs.jabref.org/): 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.
26 changes: 14 additions & 12 deletions .github/ghprcomment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@
message: |
While the PR was in progress, a new version of JabRef has been released.
You have to merge `upstream/main` and move your entry in `CHANGELOG.md` up to the section `## [Unreleased]`.
- jobName: 'Unit tests'
message: >
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](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-12-build.html#final-build-system-checks) in our setup guide.
- jobName: no-force-push
message: >
Do not force-push!
Expand Down Expand Up @@ -96,18 +105,11 @@
- ✅ `Fixes https://github.com/JabRef/jabref/issues/xyz` links pull-request to issue. Merging the PR will close the issue.
- ✅ `Fixes https://github.com/Koppor/jabref/issues/xyz` links pull-request to issue. Merging the PR will close the issue.
- ❌ `Fixes [#xyz](https://github.com/JabRef/jabref/issues/xyz)` links pull-request to issue. Merging the PR will **NOT** close the issue.
- jobName: 'Submodules not modified'
message: >
Your pull request modified git submodules.


Please follow our [FAQ on submodules](https://devdocs.jabref.org/code-howtos/faq.html#submodules) to fix.
- jobName: 'Unit tests'
- jobName: 'Conflicts with target branch'
message: >
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.
Your pull request conflicts with the target branch.


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](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-12-build.html#final-build-system-checks) in our setup guide.
Please merge `upstream/main` with your code.
Preferrably, do this using `git` in your machine:
Conflicts in `CHANGELOG.md` will be handled by a union of changes.
4 changes: 2 additions & 2 deletions .github/workflows/on-issue-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: takanome-dev/assign-issue-action@edge
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
days_until_unassign: 14
days_until_unassign: 45
maintainers: 'koppor,Siedlerchr,ThiloteE,calixtus,HoussemNasri,subhramit,LinusDietz'
assigned_comment: |
👋 Hey @{{ handle }}, thank you for your interest in this issue! 🎉
Expand All @@ -29,7 +29,7 @@ jobs:

Happy coding! 🚀

⏳ Please note, you will be automatically unassigned if there is not a (draft) pull request within **{{ total_days }} days** (by **{{ unassigned_date }}**).
⏳ Please note, you will be automatically unassigned if the issue isn't closed within **{{ total_days }} days** (by **{{ unassigned_date }}**). A maintainer can also add the "**{{ pin_label }}**" label to prevent automatic unassignment.
assignment_suggestion_comment: >
👋 Hey @{{ handle }}, looks like you’re eager to work on this issue—great! 🎉
It also looks like you skipped reading our [CONTRIBUTING.md](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md), which explains exactly how to participate. No worries, it happens to the best of us.
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/on-pr-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ jobs:
run: gh issue edit ${{ steps.get_issue_number.outputs.ticketNumber }} --remove-label "📍 Assigned"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Remove pinned label
run: gh issue edit ${{ steps.get_issue_number.outputs.ticketNumber }} --remove-label "📌 Pinned"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Remove FirstTimeCodeContribution label
run: gh issue edit ${{ steps.get_issue_number.outputs.ticketNumber }} --remove-label "FirstTimeCodeContribution"
env:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/on-pr-opened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ jobs:
run: gh issue edit ${{ steps.get_issue_number.outputs.ticketNumber }} --add-label "📌 Pinned"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

conflicts_with_target:
name: Conflicts with target branch
runs-on: ubuntu-latest
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -390,32 +390,6 @@ jobs:
exit 1
fi

unmodified_submodules:
name: Submodules not modified
if: github.actor != 'dependabot[bot]' && github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
show-progress: 'false'
- name: Check for submodule modifications
id: check_submodule
run: |
git fetch origin ${{ github.base_ref }}

# enable diffing of submodules
sed -i "s/ all/ untracked/" .gitmodules

if ! git diff --submodule=log origin/${{ github.base_ref }} HEAD | grep -vzq "Submodule src"; then
echo "Debug:"
echo git diff --submodule=log origin/${{ github.base_ref }} HEAD
git diff --submodule=log origin/${{ github.base_ref }} HEAD
echo "❌ Submodule modifications detected"
exit 1
fi
echo "✅ No submodule modifications"

other_than_main:
if: github.event_name == 'pull_request'
name: Source branch is other than "main"
Expand Down
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We added an integrity check if a URL appears in a title. [#12354](https://github.com/JabRef/jabref/issues/12354)
- We added a feature for enabling drag-and-drop of files into groups [#12540](https://github.com/JabRef/jabref/issues/12540)
- We added support for reordering keywords via drag and drop, automatic alphabetical ordering, and improved pasting and editing functionalities in the keyword editor. [#10984](https://github.com/JabRef/jabref/issues/10984)
- We added a new functionality where author names having multiple spaces in-between will be considered as separate user block as it does for " and ". [#12701](https://github.com/JabRef/jabref/issues/12701)

### Changed

Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ An explanation of donation possibilities and usage of donations is available at
[![Test Status](https://github.com/JabRef/jabref/workflows/Tests/badge.svg)](https://github.com/JabRef/jabref/actions?query=workflow%3ATests)
[![codecov.io](https://codecov.io/github/JabRef/jabref/coverage.svg?branch=master)](https://codecov.io/github/JabRef/jabref?branch=main)

Want to be part of a free and open-source project that tens of thousands of researchers use every day?
Want to be part of a free and open-source project that tens of thousands of scientists use every day?
Check out the ways you can contribute, below:

- Please have a look at our [guidelines for contributing](CONTRIBUTING.md).
- Make sure to follow our [step-by-step guide on how to set-up your workspace](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace).
- For a quick overview of the architecture, check out our [high-level documentation](https://devdocs.jabref.org/getting-into-the-code/high-level-documentation).
- You are welcome to fix bugs, contribute new features or add documentation. To get your contribution included into JabRef, just [fork](https://help.github.com/en/articles/fork-a-repo) the JabRef repository, make your changes, and submit a [pull request](https://help.github.com/en/articles/about-pull-requests).
- Not a programmer? Help translating JabRef at [Crowdin](https://crowdin.com/project/jabref) or learn how to help at [contribute.jabref.org](https://contribute.jabref.org)
- Quick overview on the architecture needed? Look at our [high-level documentation](https://devdocs.jabref.org/getting-into-the-code/high-level-documentation)
- For details on how to contribute, have a look at our [guidelines for contributing](CONTRIBUTING.md).
- You are welcome to contribute new features. To get your code included into JabRef, just [fork](https://help.github.com/en/articles/fork-a-repo) the JabRef repository, make your changes, and create a [pull request](https://help.github.com/en/articles/about-pull-requests).
- To work on existing JabRef issues, check out our [issue tracker](https://github.com/JabRef/jabref/issues). New to open source contributing? Look for issues with the ["good first issue"](https://github.com/JabRef/jabref/labels/good%20first%20issue) label to get started.
- Not a programmer? Help translating JabRef at [Crowdin](https://crowdin.com/project/jabref) or improve the user documentation. Learn how to help at [contribute.jabref.org](https://contribute.jabref.org).
- To report an issue, request a feature or suggest enhancements, please open an issue at our [issues page](https://github.com/JabRef/jabref/issues).

Please follow our [step-by-step guide on how to set-up your workspace](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace).

We use [GitHub Actions](https://github.com/JabRef/jabref/actions) for executing the tests after each commit.
For developing, it is sufficient to only run the associated test locally (see example [here](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-12-build.html)) for the classes you changed.
GitHub will report any other failure. To find solutions to the most common errors that lead to such failures, check our [FAQ page](https://devdocs.jabref.org/code-howtos/faq).
For developing, it is sufficient to locally only run the associated test for the classes you changed.
GitHub will report any other failure.

We view pull requests as a collaborative process.
Submit a pull request early to get feedback from the team on work in progress.
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

id 'com.github.andygoossens.modernizer' version '1.10.0'

id 'me.champeau.jmh' version '0.7.3'
id 'me.champeau.jmh' version '0.7.2'

// This is https://github.com/java9-modularity/gradle-modules-plugin/pull/282
id 'com.github.koppor.gradle-modules-plugin' version 'v1.8.15-cmd-1'
Expand All @@ -29,7 +29,7 @@ plugins {

id 'idea'

id 'org.openrewrite.rewrite' version '7.2.0'
id 'org.openrewrite.rewrite' version '7.1.4'

id "org.itsallcode.openfasttrace" version "3.0.1"
}
Expand Down Expand Up @@ -277,7 +277,7 @@ dependencies {
implementation 'org.tinylog:tinylog-impl:2.7.0'

// route all requests to java.util.logging to SLF4J (which in turn routes to tinylog)
implementation 'org.slf4j:jul-to-slf4j:2.0.17'
implementation 'org.slf4j:jul-to-slf4j:2.0.16'
// route all requests to log4j to SLF4J
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.24.3'

Expand Down Expand Up @@ -382,7 +382,7 @@ dependencies {
implementation 'io.zonky.test.postgres:embedded-postgres-binaries-linux-arm64v8'

testImplementation 'io.github.classgraph:classgraph:4.8.179'
testImplementation 'org.junit.jupiter:junit-jupiter:5.12.1'
testImplementation 'org.junit.jupiter:junit-jupiter:5.12.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.11.4'

testImplementation 'org.mockito:mockito-core:5.16.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.jabref.logic.journals.Abbreviation;
import org.jabref.logic.journals.AbbreviationWriter;
import org.jabref.logic.journals.JournalAbbreviationLoader;
import org.jabref.logic.journals.JournalAbbreviationMvGenerator;

/**
* This class provides a model for abbreviation files. It actually doesn't save the files as objects but rather saves
Expand Down Expand Up @@ -58,13 +59,27 @@ public void readAbbreviations() throws IOException {
}
}

public void readAbbreviationsFromMv() throws IOException {
Copy link

Choose a reason for hiding this comment

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

Method lacks JavaDoc despite being a complex method that handles file loading and data transformation. The method's purpose and behavior should be documented.

if (path.isPresent()) {
// Load abbreviations from the MV file using MV processor.
Collection<Abbreviation> abbreviationList = JournalAbbreviationMvGenerator.loadAbbreviationsFromMv(path.get());

// Convert each Abbreviation into an AbbreviationViewModel and add it to the internal list.
for (Abbreviation abbreviation : abbreviationList) {
abbreviations.add(new AbbreviationViewModel(abbreviation));
}
} else {
throw new FileNotFoundException("MV file not specified");
}
}

/**
* This method will write all abbreviations of this abbreviation file to the file on the file system.
* It essentially will check if the current file is a builtin list and if not it will call
* {@link AbbreviationWriter#writeOrCreate}.
*/
public void writeOrCreate() throws IOException {
if (!isBuiltInList.get()) {
if (!isBuiltInList.get() && !isMvFile()) {
List<Abbreviation> actualAbbreviations =
abbreviations.stream().filter(abb -> !abb.isPseudoAbbreviation())
.map(AbbreviationViewModel::getAbbreviationObject)
Expand Down Expand Up @@ -107,4 +122,8 @@ public boolean equals(Object obj) {
return false;
}
}

public boolean isMvFile() {
return path.isPresent() && path.get().toString().endsWith(".mv");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
</Button>
</HBox>

<HBox spacing="10.0" alignment="CENTER_LEFT">
<Button fx:id="changeDirectoryButton" onAction="#handleChangeDirectory" text="Change Directory"/>
<CustomTextField fx:id="directoryPathField" editable="false" minWidth="250"/>
</HBox>

<VBox spacing="10.0" HBox.hgrow="ALWAYS">
<CustomTextField fx:id="searchBox" promptText="%Filter" VBox.vgrow="NEVER">
<VBox.margin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public class JournalAbbreviationsTab extends AbstractPreferenceTabView<JournalAb
@FXML private CustomTextField searchBox;
@FXML private CheckBox useFJournal;

@FXML private Button changeDirectoryButton;
@FXML private CustomTextField directoryPathField;

@Inject private TaskExecutor taskExecutor;
@Inject private JournalAbbreviationRepository abbreviationRepository;

Expand Down Expand Up @@ -87,6 +90,7 @@ private void initialize() {

searchBox.setPromptText(Localization.lang("Search..."));
searchBox.setLeft(IconTheme.JabRefIcons.SEARCH.getGraphicNode());
directoryPathField.textProperty().bind(viewModel.directoryPathProperty());
}

private void setUpTable() {
Expand Down Expand Up @@ -190,6 +194,11 @@ private void editAbbreviation() {
journalTableNameColumn);
}

@FXML
private void handleChangeDirectory() {
viewModel.handleChangeDirectory();
}

private void selectNewAbbreviation() {
int lastRow = viewModel.abbreviationsCountProperty().get() - 1;
journalAbbreviationsTable.scrollTo(lastRow);
Expand Down
Loading
Loading