Remove second "Citation key" column from the Consistency check results table.#12699
Conversation
There was a problem hiding this comment.
Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues.
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.
|
|
||
| removeColumnByTitle(InternalField.KEY_FIELD.getName()); |
There was a problem hiding this comment.
At least, there should be a Java comment why this can be removed. (You can say that this is already displayed in the first column. But then, you need to somehow point in the coude where it is added)
There was a problem hiding this comment.
Maybe, this column should be removed from the viewModel in the first place?
There was a problem hiding this comment.
Yes, this is more of a hotfix. @Paras-Gupta16 please investigate the cause and fix the bug there.
There was a problem hiding this comment.
On debugging the viewmodel class the getColumnNames() method returns a string. This can be done by deleting the column by manipulating the string.
Another thing is code is already written here.
There was a problem hiding this comment.
I took a look. Some hints:
The function you mention returns a list of strings. If by "deleting the column by manipulating the string" you mean removing result.add("Citation Key");, that will not work as it will remove the first Citation key column. One way is either making the second one functional and removing the first, or keeping the first and putting a filter such that in the section:
allReportedFields.forEach(field -> {
result.add(field.getDisplayName());
});field.getDisplayName() is added only if it is not equal to Citation Key.
Not letting the column be generated is better than generating it and then removing it - the latter is more expensive - so the current solution has to be changed to one of the above.
What do you think would be better? @priyanshu16095
There was a problem hiding this comment.
Not letting the column be generated is better than generating it and then removing it - the latter is more expensive - so the current solution has to be changed to one of the above.
Yeah, I also learned from this point.
Firstly, as he commented, "the code is already there," I thought this was more appropriate.
A simple check can be added, and tableData and writeBibEntry should also be checked.
There was a problem hiding this comment.
Removed it in class before creating the table.
There was a problem hiding this comment.
Why is this line still needed then?
|
@priyanshu16095 Can you review, too, please? |
|
Sure, I will. |
|
I have a thought after this task: the results from the GUI and CLI will be different? Should this also be done for the CLI |
If it is about the citatoin key column removal: Yes, please. Then, the CLI is also wrong. -- Which means, the input data is wrong? Regarding the other columns (#12696), my thoughts are (but you haven'T ask for it) The CLI has a complete table of all types - and one cannot filter. The GUI shows a single type - and not all types together. The GUI should be compact. Thus, removing columns is OK there. |
| }); | ||
| return result; | ||
| allReportedFields.forEach(field-> result.add(field.getDisplayName().trim())); | ||
| return new ArrayList<>(result); |
There was a problem hiding this comment.
The new ArrayList should not be returned. Modify the methods to use the set instead.
Also fix the check.
| public Set<String> getColumnNames() { | ||
| Set<String> result = new LinkedHashSet<>(columnCount + EXTRA_COLUMNS_COUNT); | ||
| result.add("Entry Type"); | ||
| result.add("Citation Key"); |
There was a problem hiding this comment.
Please rename it to "CitationKey" as it is used in InternalField. Otherwise the column will not be removed.
|
Please take a look at the documentation for codestyle. |
|
@trag-bot didn't find any issues in the code! ✅✨ |
|
Tried it, works fine! |
| public Set<String> getColumnNames() { | ||
| Set<String> result = new LinkedHashSet<>(columnCount + EXTRA_COLUMNS_COUNT); |
There was a problem hiding this comment.
Modern Java: https://www.baeldung.com/java-21-sequenced-collections -
|
@priyanshu16095 Thank you for reviewing! |
…s table. (JabRef#12699) * fix-consistency-check * Add import statement * Remove 'CitationKey' column from table * Use set * Update Checkstyle * Update checkstyle check * rename variable * Correct checkstyle * Correct checkstyle * Fix fail fast principle
Closes #12697
This PR remove the second "Citation key" column from the Consistency check results table.
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)