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

Using the text plugin to check yaml files does not work and results in an error #235

Closed
hmvp opened this issue Nov 16, 2020 · 2 comments · Fixed by #249
Closed

Using the text plugin to check yaml files does not work and results in an error #235

hmvp opened this issue Nov 16, 2020 · 2 comments · Fixed by #249
Labels
bug Something isn't working released Feature/fix is released

Comments

@hmvp
Copy link

hmvp commented Nov 16, 2020

Expected Behavior

I tried the text plugin to check a yaml file using this style

[[".gitlab-ci.yml".contains]]
line = "    - mypy -p ims --junit-xml report-mypy.xml"
[[".gitlab-ci.yml".contains]]
line = "    - apache-license-check --copyright \"2019-2020 SURF\" ims"
[[".gitlab-ci.yml".contains]]
line = "    - flake8 --tee --output-file flake8.txt; exit_code=$?; flake8_junit flake8.txt report-flake8.xml"
[[".gitlab-ci.yml".contains]]
line = "    - if [ $exit_code -ne 0 ]; then exit 1; fi;"
[[".gitlab-ci.yml".contains]]
line = "    - isort -c ims"
[[".gitlab-ci.yml".contains]]
line = "    - black --check ."
[[".gitlab-ci.yml".contains]]
line = "    - pytest --cov=ims --cov-branch --junitxml=report-pytest-unit.xml --cov-fail-under="

Current Behavior

It fails because the text plugin only accepts plain-text files and thus it gives an error about files not being configured correctly

Expected Behavior

I expect the text plugin to always work (maybe even with binary files) since it provides an escape hatch for unsupported formats or weird files where inspect might do the wrong thing

Your Environment

  • nitpick version used: Latest

  • Python version: 3.8

  • Operating System and version: Ubuntu 20.04

@hmvp hmvp added the bug Something isn't working label Nov 16, 2020
@andreoliwa
Copy link
Owner

I saw this problem before...
For some reason I'm still not sure, using text instead of plain-text breaks a lot of tests: d179976

The current logic is not prepared to deal with a file that can be handled by multiple plugins.
YAML, TOML and JSON are also text files; the Text plugin is trying to process these files as well, and it's failing.

I expect the text plugin to always work (maybe even with binary files) since it provides an escape hatch for unsupported formats or weird files where inspect might do the wrong thing

I would like this feature myself.
But I'm afraid that solving this problem will be more complicated than I would like to.
The logic needs a good dose of refactoring to handle this case.

I will work on it; I just don't know when...

@github-actions
Copy link

🎉 This issue has been resolved in version 0.24.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released Feature/fix is released label Feb 23, 2021
@andreoliwa andreoliwa moved this to Done in Nitpick Roadmap Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Feature/fix is released
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants