-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closes #13275 : export footer only for commands that support --output #13277
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?
Conversation
Err. No. |
Am I misunderstanding something ? |
Yes. Proposal: Write documentation for each CLI command to our user-documentation repository. Moreover, think of tests. As simple as expected --help output. Check for the strip after the "header". If you are not able to do the former, the latter is required. Otherwise, we cannot check without running all the commands for ourselves and thinking if this is right what you claim |
Fair enough, I'm not familiar with JUnit or the project's testing conventions though so I don't know if I approached it correctly in my last commit |
Be aware: We don't need to test if PicoCli works. I am sure that PicoCli has an extensive test suite. Test logic, not strings. |
In this case, some "grep"ing would make sense. Checking if the help output does not contain the export formats. (We do this in fetcher tests when we remove abstracts) Alterantively, full help output string checking. If we update the CLI, all tests need to be updated. We do this at fetcher tests (because we compare the complete result) I'm not sure, which way to go. Maybe "grep"ping is fine. |
|
||
if ("fetch".equals(name)) { | ||
// special case: expect footer NOT present | ||
assertEquals(false, containsExportFormats, |
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.
Assert the contents of objects (assertEquals), not checking for some Boolean conditions (assertTrue/assertFalse) to improve readability and maintainability.
assertEquals(false, containsExportFormats, | ||
"Did not expect 'Available export formats' in footer for special case: " + name); | ||
} else if (hasOutputOption) { | ||
assertEquals(true, containsExportFormats, |
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.
Assert the contents of objects (assertEquals), not checking for some Boolean conditions (assertTrue/assertFalse) to improve readability and maintainability.
Thank you both for your insights. It now accesses the raw data model in picocli where |
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.
Minor comment. Someone really needs to think through this.
@@ -91,10 +91,10 @@ public static void main(String[] args) { | |||
} | |||
} | |||
|
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.
} | ||
|
||
@Test | ||
public void testExportFormatFooterShownOnlyForCommandsWithOutputOption() { |
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 test prefix at naming (Openrewrite should tell)
@trag-bot didn't find any issues in the code! ✅✨ |
Unfortunately, not.
|
Your code currently does not meet JabRef's code guidelines. We use OpenRewrite to ensure "modern" Java coding practices. 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 "Tests / OpenRewrite (pull_request)" and click on it. The issues found can be automatically fixed. Please execute the gradle task |
In that case, if we look at commands with I suggest I change the logic to check for those two options (only the |
I meant matching on both |
Closes #13275
the
--output
option is more indicative of export behavior than--output-format
while checking among the option names.Steps to test
Commands that export
./gradlew :jabkit:run --args="convert --help"
./gradlew :jabkit:run --args="search --help"
Commands that don't
./gradlew :jabkit:run --args="check-consistency --help"
./gradlew :jabkit:run --args="pdf --help"
./gradlew :jabkit:run --args="generate-bib-from-aux --help"
./gradlew :jabkit:run --args="generate-citation-keys --help"
./gradlew :jabkit:run --args="pseudonymize --help"
./gradlew :jabkit:run --args="preferences --help"
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)