Repository: markdownlint/markdownlint

Issue #339: mdl v0.10.0 git-recurse flag is having issues
Created: 2020-08-11T20:39:48Z
Description
Using the --git-recurse flag, mdl version 0.10.0 is unable to read .github/PULL_REQUEST_TEMPLATE.md. This was working in 0.9.0.
Environment
ruby 2.4.3
freshly installed mdl gem
MDL Version 0.10.0
Expected Behavior
All Markdown files ok. Exit code 0
Actual Behavior
/path/to/home/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/mdl-0.10.0/lib/mdl/doc.rb:50:in `read': No such file or directory @ rb_sysopen - .github/PULL_REQUEST_TEMPLATE.md (Errno::ENOENT)
	from /path/to/home/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/mdl-0.10.0/lib/mdl/doc.rb:50:in `new_from_file'
	from /path/to/home/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/mdl-0.10.0/lib/mdl.rb:82:in `block in run'
	from /path/to/home/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/mdl-0.10.0/lib/mdl.rb:80:in `each'
	from /path/to/home/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/mdl-0.10.0/lib/mdl.rb:80:in `run'
	from /path/to/home/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/mdl-0.10.0/bin/mdl:10:in `<top (required)>'
	from /path/to/home/.rbenv/versions/2.4.3/bin/mdl:23:in `load'
	from /path/to/home/.rbenv/versions/2.4.3/bin/mdl:23:in `<main>'

Replication Case
mdl --git-recurse .

Duplicate issue #341: Markdownlint 0.10.0 reports file not found error when given a directory
Created: 2020-08-14T19:38:58Z
Description
Markdownlint reports an internal error No such file or directory @ rb_sysopen and halts on the first Markdown file found if a directory is passed on the command line.
Environment
macOS 10.14 and 10.15; ruby 2.7.1p83 installed by Homebrew.
MDL Version: 0.10.0 freshly updated with gem update --user-install --no-document mdl
Expected Behaviour
Markdownlint does not report an internal error and does not halt.
Actual Behaviour
$ mdl .  # or <path-to-directory>
Traceback (most recent call last):
	7: from ~/.gem/ruby/2.7.0/bin/mdl:23:in `<main>'
	6: from ~/.gem/ruby/2.7.0/bin/mdl:23:in `load'
	5: from ~/.gem/ruby/2.7.0/gems/mdl-0.10.0/bin/mdl:10:in `<top (required)>'
	4: from ~/.gem/ruby/2.7.0/gems/mdl-0.10.0/lib/mdl.rb:80:in `run'
	3: from ~/.gem/ruby/2.7.0/gems/mdl-0.10.0/lib/mdl.rb:80:in `each'
	2: from ~/.gem/ruby/2.7.0/gems/mdl-0.10.0/lib/mdl.rb:82:in `block in run'
	1: from ~/.gem/ruby/2.7.0/gems/mdl-0.10.0/lib/mdl/doc.rb:50:in `new_from_file'
~/.gem/ruby/2.7.0/gems/mdl-0.10.0/lib/mdl/doc.rb:50:in `read': No such file or directory @ rb_sysopen - <somefile.md> (Errno::ENOENT)
$ mdl <somefile.md>
# no output because file is OK
Replication Case
Markdownlint 0.9.0 was functioning without internal error, this problem occurred immediately on upgrade to version 0.10.0 and can be reproduced on two different macOS installations.
Note: There's a different, perhaps related, bug on my Linux installation where mdl --git-recurse . does not report a formatting error but a formatting error is expected (see: #342) and will be shown if the file is specified on the command line:
% mdl --git-recurse . # Gives a formatting violation with 0.9.0 but no output with 0.10.0.
% mdl .gitlab/issue_templates/<template>.md  # The violation is still flagged when the file is passed.
.gitlab/issue_templates/<template>.md:1: MD002 First header should be a top level header

A detailed description of the rules is available at https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md

Closing comment (2020-08-18T23:22:41Z): This is a duplicate of #339; my .mdlrc had git_recurse true which meant that mdl . on the command line was effectively mdl --git-recurse . which then encounters bug #339.
FWIW, I don't actually want git_recurse and removed it from my .mdlrc I've confirmed that this resolves the error message with version 1.10.0.