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

FAQ updates #11486

Merged
merged 5 commits into from
Jul 15, 2024
Merged
Changes from 2 commits
Commits
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
24 changes: 21 additions & 3 deletions docs/code-howtos/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,32 @@ parent: Code Howtos

Following is a list of common errors encountered by developers which lead to failing tests, with their common solutions:

* Failing <b>Checkstyle</b> tests:
* <span style="color:green">Fix</span> : JabRef follows a pre-defined style of code for uniformity and maintainabiltiy that must be adhered to during development. To set-up warnings and auto-fixes conforming to these style rules in your IDE, follow [Step 3](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html) of the process to set up a local workspace in the documentation. Ideally, follow all the [set up rules](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/) in the documentation end-to-end to avoid typical set-up errors.<br> <b>Note</b>: The steps provided in the documentation are for IntelliJ, which is the preferred IDE for Java development. The ```checkstyle.xml``` is also available for VSCode, in the same directory as mentioned in the steps.
Copy link
Member

Choose a reason for hiding this comment

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

Remove the space after </span>. Reason: A colon (":") is NOT proceeded by a space.

Do that for all other "Fix" things.


* Failing <b>OpenRewrite</b> tests:
* <span style="color:green">Fix</span> : [OpenRewrite](https://docs.openrewrite.org/) is an automated refactoring ecosystem for source code. Run ```gradle rewriteRun``` to apply the automated refactoring and pass the test.
Copy link
Member

Choose a reason for hiding this comment

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

Do NOT write gradle XY. Please write "execute gradle task rewriteRun. And state in which group in IntelliJ it is.

image

Reason: The guidelines are written in a away that the contributors DO NOT have a JDK installed. Therefore, "gradlew" probably does not work. Since most fixing tasks work with IntelliJ's gradle window and do not require gradle in the command line, we should also have the FAQ answers working without an JDK outside of IntelliJ

Copy link
Member

Choose a reason for hiding this comment

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

Moreover, use single backquotes; not triple ones. Triple are used for code blocks only.


* `org.jabref.logic.l10n.LocalizationConsistencyTest` `findMissingLocalizationKeys` <span style="color:red">FAILED</span>
* <span style="color:green">Fix</span> : You have probably used Strings that are visible on the UI (to the user) but not wrapped them using ```Localization.lang(...)``` and added them to the [localization properties file](https://github.com/JabRef/jabref/blob/main/src/main/resources/l10n/JabRef_en.properties).
Read more about the background and format of localization in JabRef [here](https://devdocs.jabref.org/code-howtos/localization.html).

* ```org.jabref.logic.l10n.LocalizationConsistencyTest``` ```findObsoleteLocalizationKeys``` <span style="color:red">FAILED</span>
* <span style="color:green">Fix</span> : There are localization keys [localization properties file](https://github.com/JabRef/jabref/blob/main/src/main/resources/l10n/JabRef_en.properties) that are not used in the code, probably due to the removal of existing code. Navigate to the unused key-value pairs in the file and remove them. You can always click on the details of the failing test to pinpoint which keys are unused.
Copy link
Member

Choose a reason for hiding this comment

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

Please link the localization howto here, too. - Impatient readers won't use the link of another bullet point.


* ```org.jabref.logic.citationstyle.CitationStyle``` ```discoverCitationStyles``` <span style="color:red">ERROR: Could not find any citation style. Tried with /ieee.csl.</span>
* <span style="color:green">Fix</span> : Check the directory ```src/main/resources/csl-styles```. If it is missing or empty, run ```git submodule update```. Now, check inside if ```ieee.csl``` exists. If it does not, run ```git reset --hard``` <b>inside that directory</b>.

* ```java.lang.IllegalArgumentException``` : Unable to load locale en-US<br> <span style="color:red">ERROR: Could not generate BibEntry citation. The CSL engine could not create a preview for your item.</span>
* <span style="color:green">Fix</span> : Check the directory ```src/main/resources/csl-locales```. If it is missing or empty, run ```git submodule update```. If still not fixed, run ```git reset --hard``` <b>inside that directory</b>.

* `org.jabref.architecture.MainArchitectureTest` `restrictStandardStreams` <span style="color:red">FAILED</span>
* <span style="color:green">Fix</span> : Check if you've used ```System.out.println(...)``` (the standard output stream) to log anything into the console. This is an architectural violation, as you should use the Logger instead for logging. More details on how to log can be found [here](https://devdocs.jabref.org/code-howtos/logging.html).

* `org.jabref.architecture.MainArchitectureTest` `doNotUseLogicInModel` <span style="color:red">FAILED</span>
* <span style="color:green">Fix</span> : One common case when this test fails is when you put any class purely containing business logic at some level inside the ```model``` directory (```org/jabref/model/```). To fix this, shift the class to a subdirectory within the ```logic``` directory (```org/jabref/logic/```).
Copy link
Member

Choose a reason for hiding this comment

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

Talk about "package" and "refactor"

image


* `org.jabref.logic.l10n.LocalizationConsistencyTest` `findMissingLocalizationKeys` <span style="color:red">FAILED</span>
* <span style="color:green">Fix</span> : You have probably used Strings that are visible on the UI (to the user) but not wrapped them using ```Localization.lang(...)``` and added them to the [localization properties file](https://github.com/JabRef/jabref/blob/main/src/main/resources/l10n/JabRef_en.properties).
Read more about the background and format of localization in JabRef [here](https://devdocs.jabref.org/code-howtos/localization.html).
* `ANTLR Tool version 4.12.0 used for code generation does not match the current runtime version 4.13.1`
* <span style="color:green">Fix</span> : Execute ```gradle clean``` job.

<!-- markdownlint-disable-file MD033 -->
Loading