Skip to content

Commit 9719a6c

Browse files
authored
Fix inverted logic in check_disallowed_field (#19)
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
1 parent b9238c2 commit 9719a6c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bibtex_linter/verification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def check_disallowed_field(entry: BibTeXEntry, field: str, explanation: str) ->
8585
If it does exist, include the explanation sentence in the invariant violation text to help the user understand
8686
why it is disallowed.
8787
"""
88-
if field not in entry.fields.keys():
88+
if field in entry.fields.keys():
8989
return [f"Entry '{entry.name}' contains disallowed field [{field}]. {explanation}"]
9090
return []
9191

0 commit comments

Comments
 (0)