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

Add support for returning 0 on successful execution (with or without findings) #744

Closed
aasmundbo opened this issue Aug 25, 2023 · 6 comments

Comments

@aasmundbo
Copy link

aasmundbo commented Aug 25, 2023

Reported based on using pymarkdown 0.9.12.

Today, pymarkdown returns

  1. 0 on successful execution when there are no findings
  2. Non-zero on successful execution when there are findings
  3. Non-zero on error, for example if there is e.g. configuration errors (e.g. when using mode.strict-config)

Please consider changing so that scenario 2 above also returns 0, or that you add a configuration option to return 0 in that case (for example --zero-on-success or --success-code 0).

Background: I want to run pymarkdown from subprocess.check_call() which raises exceptions for all non-zero return codes.

jackdewinter added a commit that referenced this issue Sep 4, 2023
@jackdewinter
Copy link
Owner

jackdewinter commented Sep 4, 2023

Decided to go in a slightly different direction with the --return-code-scheme argument. Let me know if that works for you. Just released v0.9.13 that has that fix in it.

@aasmundbo
Copy link
Author

aasmundbo commented Sep 8, 2023

v0.9.13 crashes for me:

$ pip list | grep pymarkdownlnt
pymarkdownlnt                 0.9.13

$ pymarkdownlnt -h
Traceback (most recent call last):
  File "/home/abo/.local/bin/pymarkdownlnt", line 5, in <module>
    from pymarkdown.__main__ import main
  File "/home/abo/.local/lib/python3.8/site-packages/pymarkdown/__init__.py", line 5, in <module>
    from pymarkdown.main import PyMarkdownLint  # noqa F401
  File "/home/abo/.local/lib/python3.8/site-packages/pymarkdown/main.py", line 22, in <module>
    from pymarkdown.extension_manager.extension_manager import ExtensionManager
  File "/home/abo/.local/lib/python3.8/site-packages/pymarkdown/extension_manager/extension_manager.py", line 20, in <module>
    from pymarkdown.extensions.front_matter_extension import FrontMatterExtension
  File "/home/abo/.local/lib/python3.8/site-packages/pymarkdown/extensions/front_matter_extension.py", line 15, in <module>
    from pymarkdown.extensions.front_matter_markdown_token import FrontMatterMarkdownToken
  File "/home/abo/.local/lib/python3.8/site-packages/pymarkdown/extensions/front_matter_markdown_token.py", line 7, in <module>
    from pymarkdown.general.parser_helper import ParserHelper
ModuleNotFoundError: No module named 'pymarkdown.general'

Reverting back to v0.9.12 with pip install pymarkdownlnt==0.9.12 and it works again.

@jackdewinter
Copy link
Owner

@aasmundbo
Copy link
Author

Tested 0.9.13.4 and I'm happy with the solution 👍
Not sure about the flow here, but I'm OK with closing this ticket.

@jackdewinter
Copy link
Owner

"not sure about the flow here"?

@aasmundbo
Copy link
Author

My apologies for not being clear. The “not sure about the flow” was related to whether I should close the ticket or someone else (I see the “close with comment” option)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants