Skip to content

Commit 762484f

Browse files
committed
Drop broken globbing support
1 parent fe98aea commit 762484f

File tree

4 files changed

+16
-21
lines changed

4 files changed

+16
-21
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ exit with a bad (non-zero) exit code. The default is `true`.
4343
The following command will lint all files in the current directory:
4444

4545
```shell
46-
relint -c .relint.yml **
46+
relint -c .relint.yml FILE FILE2 ...
4747
```
4848

4949
The default configuration file name is `.relint.yml` within your working

Diff for: relint/__main__.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import argparse
2-
import glob
32
import subprocess # nosec
43
import sys
54
import warnings
@@ -72,16 +71,11 @@ def main(args=None):
7271

7372
print(f"relint: {__version__}")
7473
exit(0)
75-
paths = {
76-
path
77-
for file in args.files
78-
for path in glob.iglob(glob.escape(file), recursive=True)
79-
}
8074

8175
tests = list(load_config(args.config, args.fail_warnings, args.ignore_warnings))
8276

8377
matches = []
84-
for path in track(paths, description="Linting files..."):
78+
for path in track(args.files, description="Linting files..."):
8579
matches.extend(lint_file(path, tests))
8680

8781
output = ""

Diff for: tests/test_main.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_version(tmpdir, capsys):
1111
"""Test that the version is correct."""
1212
with tmpdir.as_cwd():
1313
with pytest.raises(SystemExit) as exc_info:
14-
main(["relint.py", "--version"])
14+
main(["--version"])
1515
assert "0" in str(exc_info.value)
1616
assert f"relint: {relint.__version__}" in capsys.readouterr().out
1717

@@ -24,7 +24,7 @@ def test_main_execution(self, tmpdir, fixture_dir):
2424
tmpdir.join("dummy.py").write("# TODO do something")
2525
with tmpdir.as_cwd():
2626
with pytest.raises(SystemExit) as exc_info:
27-
main(["relint.py", "dummy.py"])
27+
main(["dummy.py"])
2828

2929
assert exc_info.value.code == 0
3030

@@ -35,7 +35,7 @@ def test_main_execution_with_error(self, capsys, tmpdir, fixture_dir):
3535
tmpdir.join("dummy.py").write("# FIXME do something")
3636
with tmpdir.as_cwd():
3737
with pytest.raises(SystemExit) as exc_info:
38-
main(["relint.py", "dummy.py"])
38+
main(["dummy.py"])
3939

4040
out, _ = capsys.readouterr()
4141
assert "dummy.py:1" in out
@@ -44,15 +44,15 @@ def test_main_execution_with_error(self, capsys, tmpdir, fixture_dir):
4444
assert "❱ 1 # FIXME do something" in out
4545
assert exc_info.value.code == 1
4646

47-
@pytest.mark.parametrize("args", [tuple(), ("--summarize")])
47+
@pytest.mark.parametrize("args", [[], ["--summarize"]])
4848
def test_main_execution_without_hint(self, args, capsys, tmpdir, fixture_dir):
4949
with (fixture_dir / ".relint.yml").open() as fs:
5050
config = fs.read()
5151
tmpdir.join(".relint.yml").write(config)
5252
tmpdir.join("dummy.py").write("# hint: 🤐")
5353
with tmpdir.as_cwd():
5454
with pytest.raises(SystemExit):
55-
main(["relint.py", "dummy.py", *args])
55+
main(["dummy.py", *args])
5656

5757
out, _ = capsys.readouterr()
5858
assert "dummy.py:1" in out
@@ -65,7 +65,7 @@ def test_raise_for_warnings(self, tmpdir, fixture_dir):
6565
tmpdir.join("dummy.py").write("# TODO do something")
6666
with tmpdir.as_cwd():
6767
with pytest.raises(SystemExit) as exc_info:
68-
main(["relint.py", "dummy.py", "-W"])
68+
main(["dummy.py", "-W"])
6969

7070
assert exc_info.value.code == 1
7171

@@ -76,7 +76,7 @@ def test_ignore_warnings(self, tmpdir, fixture_dir):
7676
tmpdir.join("dummy.py").write("# TODO do something")
7777
with tmpdir.as_cwd():
7878
with pytest.raises(SystemExit) as exc_info:
79-
main(["relint.py", "dummy.py", "--ignore-warnings"])
79+
main(["dummy.py", "--ignore-warnings"])
8080

8181
assert exc_info.value.code == 0
8282

@@ -87,7 +87,7 @@ def test_summarize(self, tmpdir, fixture_dir, capsys):
8787
tmpdir.join("dummy.py").write("# FIXME do something")
8888
with tmpdir.as_cwd():
8989
with pytest.raises(SystemExit) as exc_info:
90-
main(["relint.py", "dummy.py", "--summarize"])
90+
main(["dummy.py", "--summarize"])
9191

9292
out, _ = capsys.readouterr()
9393
assert "dummy.py:1" in out
@@ -103,7 +103,7 @@ def test_code_padding_disabled(self, tmpdir, fixture_dir, capsys):
103103
tmpdir.join("dummy.py").write("# FIXME do something")
104104
with tmpdir.as_cwd():
105105
with pytest.raises(SystemExit) as exc_info:
106-
main(["relint.py", "dummy.py", "--code-padding=-1"])
106+
main(["dummy.py", "--code-padding=-1"])
107107

108108
out, _ = capsys.readouterr()
109109
assert "dummy.py:1" in out
@@ -126,7 +126,7 @@ def test_main_execution_with_diff(self, capsys, mocker, tmpdir, fixture_dir):
126126

127127
with tmpdir.as_cwd():
128128
with pytest.raises(SystemExit) as exc_info:
129-
main(["relint.py", "dummy.py", "--diff"])
129+
main(["dummy.py", "--diff"])
130130

131131
out, _ = capsys.readouterr()
132132
assert "Get it done right away!" in out

Diff for: tests/test_parse.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ def test_parse_complete_diff(self):
119119

120120
def test_empty_config_file(self, tmpdir):
121121
tmpdir.join(".relint.yml").write("")
122+
tmpdir.join("dummy.py").write("")
122123

123124
with tmpdir.as_cwd():
124125
with warnings.catch_warnings(record=True) as w:
125126
with pytest.raises(SystemExit) as exc_info:
126-
main(["**"])
127+
main(["dummy.py"])
127128

128129
assert exc_info.value.code == 0
129130
assert issubclass(w[-1].category, UserWarning)
@@ -160,7 +161,7 @@ def test_git_diff(self, capsys, tmpdir, fixture_dir):
160161

161162
with tmpdir.as_cwd():
162163
with pytest.raises(SystemExit) as exc_info:
163-
main(["relint.py", "dummy.py", "--git-diff"])
164+
main(["dummy.py", "--git-diff"])
164165

165166
assert "0" in str(exc_info.value)
166167

@@ -174,5 +175,5 @@ def test_no_unicode(capsys, tmpdir, fixture_dir):
174175
tmpdir.join("test.png").write(png, mode="wb")
175176
with tmpdir.as_cwd():
176177
with pytest.raises(SystemExit) as exc_info:
177-
main(["relint.py", "test.png"])
178+
main(["test.png"])
178179
assert "0" in str(exc_info.value)

0 commit comments

Comments
 (0)