-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Support customized entry types in BibliographyConsistencyCheck #13799
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
base: main
Are you sure you want to change the base?
Support customized entry types in BibliographyConsistencyCheck #13799
Conversation
…blatexEntryTypeDefinitions#ALL`
jablib/src/main/java/org/jabref/logic/quality/consistency/BibliographyConsistencyCheck.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/logic/quality/consistency/BibliographyConsistencyCheck.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/logic/quality/consistency/BibliographyConsistencyCheck.java
Outdated
Show resolved
Hide resolved
List<BibEntryType> entryTypeDefinitions = bibEntryTypesManager | ||
.getAllTypes(bibContext.getMode()) | ||
.stream() | ||
.toList(); |
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.
No need to convert to a list - Collection
should directly work?
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.
Collection is a interface though–i need some class to implement it right? For example HashSet class implement the Set interface.
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.
…iographyConsistencyCheck.java Co-authored-by: Oliver Kopp <[email protected]>
…cyCheck constructor
I've modified the |
Nice
Oh, let's think if the intention of that... The intention was that test inputs and outputs should not change. If the test setup changes (e.g., new parameter required), it is perfectly fine! |
…ckResultTxtWriterTest` and `BibliographyConsistencyCsvWriterTest` testing with `CliPreference` parameter
} | ||
|
||
Injector.setModelOrService(BibEntryTypesManager.class, preferences.getCustomEntryTypesRepository()); | ||
Injector.setModelOrService(BibEntryTypesManager.class, preferences.getCustomEntryTypesRepository(bibEntryTypesManager)); |
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.
Direct dependency injection manipulation in GUI code violates layered architecture principle. This logic should be moved to a service layer in org.jabref.logic.
@subhramit hello I might need some help to resolve the conflicts. I tried to solve them but they still appear. What's still happening? Thank you |
Go to Resolve conflicts in the GitHub editor. Here, there will be two pieces of code separated by ======= These sections of code are basically conflicting, that is, trying to take the same lines. In most cases, only one of them should be there after your changes, but sometimes a combination can also be there, depending on your branch's logic. After resolution, pull your changes to your local. Please ask again if something is unclear. Alternative: |
Thank you I've resolved by following this, will surely ask again if necessity arises. |
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.
Too many changes regarding BibEntryTypesManager
. Most of them can be undone.
Start with reverting all changes in CliPreferences
Injector.setModelOrService(BuildInfo.class, new BuildInfo()); | ||
|
||
final JabRefGuiPreferences preferences = JabRefGuiPreferences.getInstance(); | ||
final BibEntryTypesManager bibEntryTypesManager = new BibEntryTypesManager(); |
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 do not store it as variable - you only need it once below.
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.
fixed.
} | ||
|
||
PreferencesMigrations.runMigrations(preferences); | ||
PreferencesMigrations.runMigrations(preferences, bibEntryTypesManager); |
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.
Remove the parameter.
Later, use preferences.getCustomEntryTypesRepository()
to get the bibEntryTypesManager
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.
What is the advantage of declaring BibEntryTypesManager bibEntryTypesManager = preferences.getCustomEntryTypesRepository();
and then upgradeStoredBibEntryTypes(preferences, mainPrefsNode, bibEntryTypesManager);
instead of just upgradeStoredBibEntryTypes(preferences, mainPrefsNode, preferences.getCustomEntryTypesRepository());
? Am i missing something here?
dialogService, | ||
fileUpdateMonitor, | ||
preferences, | ||
cliPreferences, |
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 remove this.
See that GuiPreferences extends CliPreferences
.
Thus, the GuiPreferences
have all the CliPreferences
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.
fixed.
@Override | ||
public BibEntryTypesManager getCustomEntryTypesRepository() { | ||
BibEntryTypesManager bibEntryTypesManager = new BibEntryTypesManager(); | ||
public BibEntryTypesManager getCustomEntryTypesRepository(BibEntryTypesManager bibEntryTypesManager) { |
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 undo this - the point here is that a new repository is generated.
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.
Ohhh I should implement both, the one without the parameter and then override with the parameter did I get it right?
…extends `CliPreferences`
…one parameter, the `BibEntryTypesManager` is retrieved later
…ferences` interface
Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Source Code Tests / Checkstyle (pull_request)" and click on it. In case of issues with the import order, double check that you activated Auto Import. You can trigger fixing imports by pressing Ctrl+Alt+O to trigger Optimize Imports. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues, commit, and push. |
jablib/src/main/java/org/jabref/logic/quality/consistency/BibliographyConsistencyCheck.java
Outdated
Show resolved
Hide resolved
…eld set or a missing field
…eld set or a missing field
@subhramit Hi, I'm running into a design issue with the filtering logic in I have two types of inconsistencies to handle:
The problem is that the method only receives The failing tests show that:
The current logic cannot satisfy both cases. I need a refactoring to pass more context or change the filtering approach. I'd like some help on how to proceed? |
Your code currently does not meet JabRef's code guidelines. IntelliJ auto format covers some cases. There seem to be issues with your code style and autoformat configuration. Please reformat your code (Ctrl+Alt+L) and commit, then push. In special cases, consider using |
BibDatabaseContext bibContext = databaseContext.get(); | ||
|
||
BibliographyConsistencyCheck consistencyCheck = new BibliographyConsistencyCheck(); | ||
BibliographyConsistencyCheck consistencyCheck = new BibliographyConsistencyCheck(preferences, entryTypesManager); |
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 patch introduces a constructor call with parameters, but it does not ensure that null is never passed to the method, which violates the guideline that null should never be passed to a method.
Passing more context is fine, also, when you say change the filtering approach, what do you propose? |
Closes #13794
Steps to test
Mandatory checks
CHANGELOG.md
in a way that is understandable for the average user (if change is visible to the user)