-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
#177: Forbid to use CRLF end-of-line #708
Changes from 5 commits
5b03923
44d2787
fcd8159
e35f1b9
5ad4d9a
96d62f8
96be525
4891a82
5636cdb
1fecd63
10ca2a4
66a4128
77a6b9d
a81dfda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,3 +1,5 @@ | ||||||
import os | ||||||
|
||||||
import subprocess | ||||||
from collections.abc import Callable | ||||||
|
||||||
|
@@ -82,15 +84,20 @@ def test_lint_wrong_fixture(fixture_path, all_violations): | |||||
assert str(violation_class.code) in stderr | ||||||
|
||||||
|
||||||
def test_lint_wrong_eol(fixture_path: Callable) -> None: | ||||||
def test_lint_wrong_eol(fixture_path: Callable[[str], str]) -> None: | ||||||
"""Checks that `lint` command works for with with CRLF end-of-line.""" | ||||||
temp_file_path = fixture_path('.env.temp') | ||||||
with open(temp_file_path, mode='w') as temp_file: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've used tmp_path pytest fixture instead, |
||||||
_ = temp_file.write("VARIABLE_WITH_CRLF_EOL=123\r\n") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
process = subprocess.Popen( | ||||||
[ | ||||||
'dotenv-linter', | ||||||
fixture_path('.env.eol'), | ||||||
fixture_path(temp_file_path), | ||||||
], | ||||||
stdout=subprocess.PIPE, | ||||||
stderr=subprocess.PIPE, | ||||||
# It is important to set this to `False`, otherwise eol are normalized | ||||||
universal_newlines=False, | ||||||
encoding='utf8', | ||||||
) | ||||||
|
@@ -99,3 +106,5 @@ def test_lint_wrong_eol(fixture_path: Callable) -> None: | |||||
assert process.returncode == 1 | ||||||
|
||||||
assert str(InvalidEOLViolation.code) in stderr | ||||||
|
||||||
os.remove(temp_file_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.