From a74e0edc014a0ada1232e7be6fb7846e82a4f2a0 Mon Sep 17 00:00:00 2001 From: s-heppner Date: Fri, 24 Oct 2025 20:34:30 +0200 Subject: [PATCH] Fix inverted logic in `check_disallowed_field` Previously, the logic of the `verification.check_disallowed_field` method was inverted. Instead of returning a violation when the disallowed field was present, it was returning the violation when it was not present. My suspicion is that this was due to a copy/paste error. This fixes this bug, by returning a violation only when a disallowed field is present. The bug was first found in the logic of the linter rule of: `ieeetran_rules.check_in_collection`. Fixes #18 --- bibtex_linter/verification.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bibtex_linter/verification.py b/bibtex_linter/verification.py index 35aa030..140e527 100644 --- a/bibtex_linter/verification.py +++ b/bibtex_linter/verification.py @@ -85,7 +85,7 @@ def check_disallowed_field(entry: BibTeXEntry, field: str, explanation: str) -> If it does exist, include the explanation sentence in the invariant violation text to help the user understand why it is disallowed. """ - if field not in entry.fields.keys(): + if field in entry.fields.keys(): return [f"Entry '{entry.name}' contains disallowed field [{field}]. {explanation}"] return []