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

Non standard output between core and plugins? #435

Open
pawamoy opened this issue Apr 14, 2024 · 0 comments
Open

Non standard output between core and plugins? #435

pawamoy opened this issue Apr 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pawamoy
Copy link

pawamoy commented Apr 14, 2024

Describe the bug

context
When I format files, I get output lines that sometimes start with "Failed", sometimes "Warning:", and sometimes "error:". It can be a bit confusing.

expectation
I would expect all warnings to start with "warning:", and errors associated to these warnings be appended at the end of the warnings, since these errors do not cause the program to stop (also see #434).

bug
I'm actually not sure which lines come from plugin, from core, or why they differ.

Example:

% make format
Warning: Failed formatting content of a yaml code block (line 214 before formatting). Filename: /media/data/dev/website/docs/posts/save-pytest-logs-as-artifact-gitlab-ci.md
Failed formatting content of a yaml code block (line 177 before formatting). Filename: /media/data/dev/website/docs/posts/save-pytest-logs-as-artifact-gitlab-ci.md
error: Failed to parse at 1:1: Unexpected token Indent
Warning: Failed formatting content of a python code block (line 276 before formatting). Filename: /media/data/dev/website/docs/posts/unify-logging-for-a-gunicorn-uvicorn-app.md
error: Failed to parse at 1:1: Unexpected token Indent
Warning: Failed formatting content of a python code block (line 306 before formatting). Filename: /media/data/dev/website/docs/posts/unify-logging-for-a-gunicorn-uvicorn-app.md
error: Failed to parse at 1:1: Unexpected token Indent
Warning: Failed formatting content of a python code block (line 319 before formatting). Filename: /media/data/dev/website/docs/posts/unify-logging-for-a-gunicorn-uvicorn-app.md
error: Failed to parse at 1:1: Unexpected token Indent
Failed formatting content of a python code block (line 248 before formatting). Filename: /media/data/dev/website/docs/posts/unify-logging-for-a-gunicorn-uvicorn-app.md
error: Failed to parse at 1:1: Unexpected token Indent
Failed formatting content of a python code block (line 272 before formatting). Filename: /media/data/dev/website/docs/posts/unify-logging-for-a-gunicorn-uvicorn-app.md
error: Failed to parse at 1:1: Unexpected token Indent
Failed formatting content of a python code block (line 282 before formatting). Filename: /media/data/dev/website/docs/posts/unify-logging-for-a-gunicorn-uvicorn-app.md
error: Failed to parse at 4:6: Unexpected token '%'
Warning: Failed formatting content of a python code block (line 276 before formatting). Filename: /media/data/dev/website/docs/posts/how-to-deal-with-jinja2-spacing.md
error: Failed to parse at 6:6: Unexpected token '%'
Warning: Failed formatting content of a python code block (line 292 before formatting). Filename: /media/data/dev/website/docs/posts/how-to-deal-with-jinja2-spacing.md
error: Failed to parse at 4:6: Unexpected token '%'
Failed formatting content of a python code block (line 269 before formatting). Filename: /media/data/dev/website/docs/posts/how-to-deal-with-jinja2-spacing.md
error: Failed to parse at 6:6: Unexpected token '%'
Failed formatting content of a python code block (line 285 before formatting). Filename: /media/data/dev/website/docs/posts/how-to-deal-with-jinja2-spacing.md
Warning: Failed formatting content of a toml code block (line 157 before formatting). Filename: /media/data/dev/website/docs/posts/docker-compose-django-postgres-nginx.md
Warning: Failed formatting content of a toml code block (line 383 before formatting). Filename: /media/data/dev/website/docs/posts/docker-compose-django-postgres-nginx.md
Failed formatting content of a toml code block (line 124 before formatting). Filename: /media/data/dev/website/docs/posts/docker-compose-django-postgres-nginx.md
Failed formatting content of a toml code block (line 329 before formatting). Filename: /media/data/dev/website/docs/posts/docker-compose-django-postgres-nginx.md
error: Failed to parse at 1:1: Unexpected token Indent
Failed formatting content of a python code block (line 151 before formatting). Filename: /media/data/dev/website/docs/posts/adding-links-to-formatted-and-syntax-highlighted-code.md
error: Failed to parse at 4:5: Unexpected token 'entry_points'
Warning: Failed formatting content of a python code block (line 42 before formatting). Filename: /media/data/dev/website/docs/posts/write-and-use-a-tox-plugin-from-inside-your-package.md
error: Failed to parse at 4:5: Unexpected token 'entry_points'
Failed formatting content of a python code block (line 39 before formatting). Filename: /media/data/dev/website/docs/posts/write-and-use-a-tox-plugin-from-inside-your-package.md
Warning: Failed formatting content of a yaml code block (line 124 before formatting). Filename: /media/data/dev/website/docs/posts/add-alembic-migrations-to-existing-fastapi-ormar-project.md
Failed formatting content of a yaml code block (line 126 before formatting). Filename: /media/data/dev/website/docs/posts/add-alembic-migrations-to-existing-fastapi-ormar-project.md

problem
I think we could gain at standardizing error messages a bit 🙂
Typically, adding the plugin name would make it clear to which repository/project we should report an issue when something doesn't work as expected.

Reproduce the bug

git clone https://github.com/pawamoy/website --depth=1 /tmp/repro
cd /tmp/repro
python -m venv .venv
. .venv/bin/activate
python -m pip install mdformat-mkdocs[recommended]
python -m mdformat docs/posts --ignore-missing-references

List your environment

% python -V
Python 3.11.5
% mdformat --version
mdformat 0.7.17 (mdformat_tables: 0.4.1, mdformat_wikilink: 0.2.0, mdformat_admon: 2.0.2, mdformat_gfm: 0.3.6, mdformat_footnote: 0.1.1, mdformat_frontmatter: 2.0.8, mdformat_simple_breaks:
0.0.1, mdformat_mkdocs: 2.0.8, mdformat_config: 0.1.3, mdformat_ruff: 0.1.3, mdformat_web: 0.1.0, mdformat_beautysh: 0.1.1)
% uname -r
6.8.5-arch1-1
@pawamoy pawamoy added the bug Something isn't working label Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant