Skip to content

Commit

Permalink
test: yaml file as text
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoliwa committed Jan 14, 2021
1 parent f9090c0 commit d179976
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nitpick/plugins/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ def plugin_class() -> Type["NitpickPlugin"]:
@hookimpl
def handler(file_name: str, tags: Set[str]) -> Optional["NitpickPlugin"]:
"""Handle text files."""
if "plain-text" in tags:
if "text" in tags:
return TextPlugin(file_name)
return None
14 changes: 14 additions & 0 deletions tests/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,17 @@ def test_text_file_contains_line(request):
qqq\x1b[0m
"""
)


def test_yaml_file_as_text(request):
ProjectMock(request).style(
"""
[[".gitlab-ci.yml".contains]]
line = " - mypy -p ims --junit-xml report-mypy.xml"
"""
).save_file(".gitlab-ci.yml", "def\nghi\nwww").flake8().assert_errors_contain(
"""
NIP352 File .gitlab-ci.yml has missing lines:\x1b[32m
- mypy -p ims --junit-xml report-mypy.xml\x1b[0m
"""
)

0 comments on commit d179976

Please sign in to comment.