pymarkdown icon indicating copy to clipboard operation
pymarkdown copied to clipboard

pre-commit hook fails with alternate extension and README.md

Open skwde opened this issue 2 months ago • 3 comments

Prerequisites

  • [x] Are you running the latest version of this application?
  • [x] Have you checked the Frequently Asked Questions document?
  • [x] Have you simplified the bug report to the essential details?
    • [x] Do you have a distinct command line to report?
    • [x] Can you clearly state the configuration for this bug report?
    • [x] Do you have a minimal document that highlights this bug?
    • [x] Are any required files (configuration or Markdown document) attached to the issue?
  • [x] Did you perform a cursory search of other issues to look for related issues?

Bug Report

Bug Type

  • [ ] Assertion Failure
  • [ ] Documentation
  • [ ] Scan/Rule not working as expected
  • [ ] Fix/Rule not working as expected
  • [x] Other: pre-commit

Description

The pre-commit hook fails with

Provided file path 'README.md' is not a valid file. Skipping.

when --alternate-extension is used.

Specifics

  • OS: debian:bookworm
  • pre-commit hook version / pymarkdown: v0.9.26

Use test.qmd

# another extension md file

abc

and README.md

# Test

abc

with the pre-commit-config.yml

default_stages: ['pre-commit']
repos:
  - repo: https://github.com/jackdewinter/pymarkdown
    rev: v0.9.26
    hooks:
      - id: pymarkdown
        args: 
          - scan
          - --alternate-extension=.qmd

via

pre-commit run pymarkdown

Actual Behavior

pymarkdown seems to be confused by the README.md causing the pre-commit hook to fail.

Expected Behavior

pymarkdown should only check files with .qmd extension and ignore README.md.

skwde avatar Dec 17 '24 10:12 skwde