Skip to content

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

@skwde

Description

@skwde

Prerequisites

  • Are you running the latest version of this application?
  • Have you checked the Frequently Asked Questions document?
  • Have you simplified the bug report to the essential details?
    • Do you have a distinct command line to report?
    • Can you clearly state the configuration for this bug report?
    • Do you have a minimal document that highlights this bug?
    • Are any required files (configuration or Markdown document) attached to the issue?
  • 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
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions