Check notebook syntax in pre-commit hooks
I just realised we're effectively skipping the notebooks AST check because nbQA excludes cells with syntax errors by default.
I've made a deliberate bad commit here to ensure that the check can pick it up now. I'll cut that out before merging.
Merge request reports
Activity
Filter activity
Yes, it fails:
nbqa-check-ast...........................................................Failed - hook id: nbqa-check-ast - exit code: 1 notebooks/LPDMini/LPD_Mini_Correct.ipynb: failed parsing with CPython 3.11.10: Traceback (most recent call last): File "/root/.cache/pre-commit/repokgn9cdot/py_env-python3/lib/python3.11/site-packages/pre_commit_hooks/check_ast.py", line 21, in main ast.parse(f.read(), filename=filename) File "/usr/local/lib/python3.11/ast.py", line 50, in parse return compile(source, filename, mode, flags, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "notebooks/LPDMini/LPD_Mini_Correct.ipynb", line 3 in_folder = "/gpfs/exfel/exp/FXE/202321/p004576/raw/ # the folder to read data from, required ^ SyntaxError: unterminated string literal (detected at line 3)
mentioned in commit 8576143a
changed milestone to %3.15.5
Please register or sign in to reply