jackdewinter / pymarkdown

MIT License
75 stars 17 forks source link

Issue 1162 1163 #1210

Closed jackdewinter closed 1 month ago

jackdewinter commented 1 month ago

Closes #1162 closes #1163

Summary by Sourcery

Add new test cases for complex markdown scenarios involving nested lists and block quotes with fenced code blocks. Refactor and enhance the handling of spacing in lists and block quotes in the markdown processing logic. Update test configurations and reports to accommodate these changes.

New Features:

Enhancements:

Tests:

Chores:

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This pull request addresses issues #1162 and #1163 by making several changes to the PyMarkdown project, primarily focusing on improving the handling of block quotes, lists, and fenced code blocks within Markdown parsing. The changes include modifications to test cases, adjustments to the MD031 rule (fenced code blocks should be surrounded by blank lines), and updates to various helper functions and processors.

File-Level Changes

Change Details Files
Added new test cases for block quotes and fenced code blocks
  • Added test_extra_044mcxa() to test a specific Markdown structure
  • Added test_extra_046cc2(), test_extra_046cc3(), and test_extra_046cc4() for testing fenced code blocks in nested list structures
  • Added test_extra_047d0() and test_extra_047d1() for testing fenced code blocks in block quotes within lists
test/test_markdown_extra.py
Modified the MD031 rule implementation to improve handling of fenced code blocks in complex structures
  • Updated fix_spacing_block_quote() method to adjust spacing calculations
  • Refactored fix_spacing_list() method into smaller, more focused methods
  • Added fix_spacing_list_remove_list() and __fix_spacing_list_not_remove_list() methods
  • Updated process_pending_container_end_block_quote() to handle a new edge case
pymarkdown/plugins/rule_md_031.py
Enhanced block quote processing to handle edge cases
  • Added do_block_quote_leading_spaces_adjustments_adjust_bleading_kludge() method to handle a specific edge case
  • Updated do_block_quote_leading_spaces_adjustments_adjust_bleading() to use the new kludge method
  • Added a new flag 'weird_kludge_six' to BlockQuoteMarkdownToken
pymarkdown/block_quotes/block_quote_non_fenced_helper.py
pymarkdown/tokens/block_quote_markdown_token.py
Updated test utilities and configurations
  • Added a new flag 'mark_scan_as_skipped' to pluginRuleTest class
  • Implemented calculate_scan_tests() function to handle skipped scan tests
  • Updated test configurations in test_md027.py and test_md031.py
test/rules/utils.py
test/rules/test_md027.py
test/rules/test_md031.py
Minor adjustments and code cleanup
  • Commented out unused code in __handle_existing_block_quote_fenced_special_part_two()
  • Updated test results and coverage information
pymarkdown/block_quotes/block_quote_processor.py
publish/test-results.json
publish/coverage.json

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.
codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 93.87755% with 3 lines in your changes missing coverage. Please review.

Project coverage is 99.90%. Comparing base (11d4ff7) to head (aa9423c). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pymarkdown/plugins/rule_md_031.py 88.88% 2 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1210 +/- ## ======================================= Coverage 99.90% 99.90% ======================================= Files 190 190 Lines 20843 20876 +33 Branches 2666 2674 +8 ======================================= + Hits 20823 20856 +33 Misses 13 13 Partials 7 7 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.