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

Add type and subtype to warnings #255

Merged
merged 2 commits into from Jul 7, 2021
Merged

Add type and subtype to warnings #255

merged 2 commits into from Jul 7, 2021

Conversation

stevenrhall
Copy link
Contributor

I’ve modified the logger.warning commands to include the fields
type (always “bibtex”) and subtype. This allows warnings to be
suppressed if desired in Sphinx. For example, setting

suppress_warnings = [“bibtex.duplicate_citation”]

will eliminate warnings about duplicate citations. These warnings can be
annoying in some use cases where the same citation might be desired on
multiple pages. While users are unlikely to suppress some of the other
warnings, i’ve include a type and subtype for each warning to make it
possible to do so. All available warning type to suppress are:

bibtex.filter_overrides_all
bibtex.filter_overrides_notcited
bibtex.filter_overrides_cited
bibtex.filter_syntax_error
bibtex.file_not_configured
bibtex.key_not_found
bibtex.unknown_list_type
bibtex.duplicate_citation
bibtex.duplicate_label
bibtex.missing_field

I’ve modified the logger.warning commands to include the fields
type (always “bibtex”) and subtype. This allows warnings to be 
suppressed if desired in Sphinx. For example, setting

suppress_warnings = [“bibtex.duplicate_citation”]

will eliminate warnings about duplicate citations. These warnings can be
annoying in some use cases where the same citation might be desired on
multiple pages. While users are unlikely to suppress some of the other
warnings, i’ve include a type and subtype for each warning to make it
possible to do so. All available warning type to suppress are:

	bibtex.filter_overrides_all
	bibtex.filter_overrides_notcited
	bibtex.filter_overrides_cited
	bibtex.filter_syntax_error
	bibtex.file_not_configured
	bibtex.key_not_found
	bibtex.unknown_list_type
	bibtex.duplicate_citation
	bibtex.duplicate_label
	bibtex.missing_field
@mcmtroffaes
Copy link
Owner

LGTM! Thanks for the contribution. Could you fix the flake8 errors, and perhaps also add a note about this in the documentation (under usage)?

@stevenrhall
Copy link
Contributor Author

stevenrhall commented Jul 7, 2021 via email

1. Added documentation of warning suppression to doc/usage.rst.

2. Fix malformed call to logger.warnings in directives.py.

3. Reformatted directives.py and domain.py to pass flake8 formatting
   tests.
@codecov
Copy link

codecov bot commented Jul 7, 2021

Codecov Report

Merging #255 (a3e4109) into develop (175f096) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           develop      #255   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           47        47           
  Lines         2138      2138           
  Branches       237       237           
=========================================
  Hits          2138      2138           
Impacted Files Coverage Δ
src/sphinxcontrib/bibtex/directives.py 100.00% <ø> (ø)
src/sphinxcontrib/bibtex/domain.py 100.00% <ø> (ø)
src/sphinxcontrib/bibtex/foot_roles.py 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 175f096...a3e4109. Read the comment docs.

@stevenrhall
Copy link
Contributor Author

OK, I've fixed the bug, reformatted the other files to pass flake8 formatting tests, and added documentation. All checks now pass it looks like.

@mcmtroffaes
Copy link
Owner

Awesome, thanks! I'll do a few small edits and rename a few things in a follow up, but very happy to merge this. Thanks again for contributing to the extension.

@mcmtroffaes mcmtroffaes merged commit 9605f01 into mcmtroffaes:develop Jul 7, 2021
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.

None yet

2 participants