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

Fallback to text lexer when lexer not found #2133

Merged
merged 4 commits into from
Apr 1, 2022
Merged

Conversation

darrenburns
Copy link
Member

@darrenburns darrenburns commented Mar 30, 2022

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

Catches an exception raised inside pygments by guess_lexer_for_filename in the event that no lexer could be found. When this happens, we now fall back to the TextLexer.

Closes #2018

@codecov-commenter
Copy link

codecov-commenter commented Mar 30, 2022

Codecov Report

Merging #2133 (b777793) into master (7105781) will decrease coverage by 3.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #2133      +/-   ##
==========================================
- Coverage   99.46%   96.46%   -3.01%     
==========================================
  Files          72       72              
  Lines        7339     7415      +76     
==========================================
- Hits         7300     7153     -147     
- Misses         39      262     +223     
Flag Coverage Δ
unittests 96.46% <100.00%> (-3.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
rich/__main__.py 100.00% <ø> (ø)
rich/console.py 97.52% <100.00%> (-1.63%) ⬇️
rich/terminal_theme.py 100.00% <100.00%> (ø)
rich/traceback.py 99.55% <100.00%> (+<0.01%) ⬆️
rich/_windows_renderer.py 0.00% <0.00%> (-100.00%) ⬇️
rich/_win32_console.py 3.19% <0.00%> (-88.30%) ⬇️

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 9f43ccc...b777793. Read the comment docs.

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.

[BUG] rich.traceback: no lexer for filename X found
3 participants