Skip to content

Let consistency checker yield a return code#13329

Merged
koppor merged 3 commits intoJabRef:mainfrom
stephanlukasczyk:13328-consistency-checker-return-code
Jun 15, 2025
Merged

Let consistency checker yield a return code#13329
koppor merged 3 commits intoJabRef:mainfrom
stephanlukasczyk:13328-consistency-checker-return-code

Conversation

@stephanlukasczyk
Copy link
Copy Markdown
Contributor

@stephanlukasczyk stephanlukasczyk commented Jun 15, 2025

Closes #13328

A rough sketch of my idea how the consistency checker could yield a return code in cases where it did not find some inconsistencies. This can be especially useful, when the checker is used in scripts or CI, where it could mark the stage as failing due to the non-zero return code.

@Siedlerchr @koppor This is a probably very hacky way of doing it, to sketch the idea. I'd like to know your feedback about it, though.

Steps to test

Run the jabkit CLI with argument check-consistency --input /path/to/erronueous.bib

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT 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)
  • [/] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • [/] Checked documentation: 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.

Copy link
Copy Markdown
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

Thank you for taking up on the issue.

In general, I like it.

Two things: Just remove the failOnError and use the exit code "structure" from https://github.com/DavidAnson/markdownlint-cli2#exit-codes - meaning: 1 for linting issue and > 1 for all other errors. 😅

Comment thread jabkit/src/main/java/org/jabref/cli/CheckConsistency.java Outdated
As suggested by @koppor it makes totally sense to always exit with a
non-zero exit code in case of issues.  Exit code 0 means no issues in
linting, exit code 1 means linting issues, exit code 2 means any other
issues.

Also remove the CLI flag to enable/disable the feature.
@trag-bot
Copy link
Copy Markdown

trag-bot Bot commented Jun 15, 2025

@trag-bot didn't find any issues in the code! ✅✨

@koppor koppor enabled auto-merge June 15, 2025 08:54
@koppor koppor added this pull request to the merge queue Jun 15, 2025
Merged via the queue into JabRef:main with commit d82e369 Jun 15, 2025
1 check passed
Siedlerchr added a commit to FlyJoanne/jabref that referenced this pull request Jun 15, 2025
* upstream/main:
  New Crowdin updates (JabRef#13330)
  Add arm 64 linux runner (JabRef#13258)
  Rename strings and variables in New Entry (JabRef#13312)
  Let consistency checker yield a return code (JabRef#13329)
  Update LETTER fragment to resolve Windows parsing issue (JabRef#13327)
  Add support for "dev: no-bot-comments"
  Update dependency org.hibernate.validator:hibernate-validator to v9.0.1.Final (JabRef#13322)
  Endnote XML Exporter: Move factory initialization to constructor (JabRef#13321)
  Refine assignment reminder (JabRef#13315)
  Add welcome message to first time contributors (JabRef#13314)
  New Crowdin updates (JabRef#13311)
  Added a setting to show File annotations' tab only when the PDF actually contains highlights or comments (JabRef#13279)
  Update dependency org.postgresql:postgresql to v42.7.7 (JabRef#13306)
  Refine PULL_REQUEST_TEMPLATE.md (JabRef#13304)
  Move module tweaking of merged module to launcher (JabRef#13303)
  Speed up gradle update (JabRef#13300)
  testImplementation is enough (JabRef#13299)
Siedlerchr added a commit to JustinHennis1/jabref that referenced this pull request Jun 16, 2025
* upstream/main:
  New Crowdin updates (JabRef#13330)
  Add arm 64 linux runner (JabRef#13258)
  Rename strings and variables in New Entry (JabRef#13312)
  Let consistency checker yield a return code (JabRef#13329)
  Update LETTER fragment to resolve Windows parsing issue (JabRef#13327)
  Add support for "dev: no-bot-comments"
  Update dependency org.hibernate.validator:hibernate-validator to v9.0.1.Final (JabRef#13322)
  Endnote XML Exporter: Move factory initialization to constructor (JabRef#13321)
  Refine assignment reminder (JabRef#13315)
  Add welcome message to first time contributors (JabRef#13314)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let Consistency Checker Yield a Return Code

2 participants