File tree 3 files changed +36
-3
lines changed
3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 2
2
Changelog
3
3
=========
4
4
5
+ 1.5.2 (2022-09-28)
6
+ ~~~~~~~~~~~~~~~~~~
7
+ Fixed bug in which, when running ``nbqa `` on a directory,
8
+ it wasn't ignoring invalid files (thanks @francesco-ballarin for the report!)
9
+
5
10
1.5.1 (2022-09-20)
6
11
~~~~~~~~~~~~~~~~~~
7
12
Built-in hooks now have ``types_or: [jupyter, markdown] ``, so that
Original file line number Diff line number Diff line change @@ -120,7 +120,6 @@ def _get_notebooks(root_dir: str) -> Iterator[Path]:
120
120
jupytext_installed = False
121
121
else :
122
122
jupytext_installed = True
123
-
124
123
if os .path .isfile (root_dir ):
125
124
_ , ext = os .path .splitext (root_dir )
126
125
if (jupytext_installed and ext in (".ipynb" , ".md" )) or (
@@ -306,7 +305,6 @@ def _run_command(
306
305
else :
307
306
python_module = COMMAND_TO_PYTHON_MODULE .get (main_command , main_command )
308
307
cmd = [sys .executable , "-m" , python_module , * sub_commands ]
309
-
310
308
output = subprocess .run (
311
309
[* cmd , * args , * cmd_args ],
312
310
capture_output = True ,
@@ -660,7 +658,11 @@ def _main(cli_args: CLIArgs, configs: Configs) -> int:
660
658
[
661
659
i .file
662
660
for key , i in nb_to_tmp_mapping .items ()
663
- if key not in saved_sources .failed_notebooks
661
+ if key
662
+ not in (
663
+ * saved_sources .failed_notebooks ,
664
+ * saved_sources .non_python_notebooks ,
665
+ )
664
666
],
665
667
shell = configs ["shell" ],
666
668
)
Original file line number Diff line number Diff line change @@ -275,3 +275,29 @@ def test_invalid_config_file(tmpdir: "LocalPath") -> None:
275
275
match = r"Passing unrecognized arguments to super\(JupytextConfiguration\)" ,
276
276
):
277
277
main (["black" , os .path .join (tmpdir , "foo.md" )])
278
+
279
+
280
+ def test_jupytext_on_folder (capsys : "CaptureFixture" ) -> None :
281
+ """Check invalid files aren't checked."""
282
+ path = os .path .join ("tests" , "invalid_data" )
283
+ main (
284
+ [
285
+ "pydocstyle" ,
286
+ path ,
287
+ ]
288
+ )
289
+ out , _ = capsys .readouterr ()
290
+ expected = (
291
+ f'{ os .path .join (path , "invalid_syntax.ipynb" )} :cell_1:0:1: D100 Missing docstring in public module\n '
292
+ f'{ os .path .join (path , "assignment_to_literal.ipynb" )} :cell_1:0:1: D100 Missing docstring in public module\n '
293
+ f'{ os .path .join (path , "automagic.ipynb" )} :cell_1:0:1: D100 Missing docstring in public module\n '
294
+ )
295
+ expected = (
296
+ f'{ os .path .join (path , "invalid_syntax.ipynb" )} :cell_1:0 at module level:\n '
297
+ " D100: Missing docstring in public module\n "
298
+ f'{ os .path .join (path , "assignment_to_literal.ipynb" )} :cell_1:0 at module level:\n '
299
+ " D100: Missing docstring in public module\n "
300
+ f'{ os .path .join (path , "automagic.ipynb" )} :cell_1:0 at module level:\n '
301
+ " D100: Missing docstring in public module\n "
302
+ )
303
+ assert out == expected
You can’t perform that action at this time.
0 commit comments