diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index afc2880c6c..182744d608 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -113,3 +113,12 @@ jobs: - name: Install Jupyterlab run: pip install -e . - uses: pre-commit/action@v2.0.0 + with: + extra_args: --all-files --hook-stage=manual + - name: Help message if pre-commit fail + if: ${{ failure() }} + run: | + echo "or you can run by hand on staged files with" + echo " pre-commit run" + echo "or after-the-fact on already committed files with" + echo " pre-commit run --all-files --hook-stage=manual" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2dde76047..4594f2a726 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ ci: # skip any check that needs internet access - skip: [check-jsonschema, prettier, eslint, integrity] + skip: [prettier, integrity] repos: - repo: https://github.com/pre-commit/pre-commit-hooks @@ -33,6 +33,13 @@ repos: files: \.py$ args: [--profile=black] + - repo: https://github.com/PyCQA/doc8 + rev: 0.11.1 + hooks: + - id: doc8 + args: [--max-line-length=200] + stages: [manual] + - repo: https://github.com/pycqa/flake8 rev: 4.0.1 hooks: @@ -43,6 +50,7 @@ repos: "flake8-logging-format==0.6.0", "flake8-implicit-str-concat==0.2.0", ] + stages: [manual] - repo: https://github.com/sirosen/check-jsonschema rev: 0.14.2 @@ -52,6 +60,7 @@ repos: files: ^\.github/workflows/ types: [yaml] args: ['--schemafile', 'https://json.schemastore.org/github-workflow'] + stages: [manual] - repo: local hooks: @@ -60,11 +69,6 @@ repos: entry: 'npm run prettier:files' language: node types_or: [json, markdown, ts, tsx, javascript, jsx, css] - - id: eslint - name: eslint - entry: 'npm run eslint:files' - language: node - types_or: [ts, tsx, javascript, jsx] - id: integrity name: integrity entry: 'npm run integrity --force' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17f5c8490b..8be5437870 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -137,3 +137,6 @@ You may also use the prettier npm script (e.g. `npm run prettier` or We recommend installing a prettier extension for your code editor and configuring it to format your code with a keyboard shortcut or automatically on save. + +Some of the hooks only run on CI by default, but you can invoke them by +running with the `--hook-stage manual` argument. diff --git a/docs/source/links.txt b/docs/source/links.txt index 0306b047fb..1d4820bf98 100644 --- a/docs/source/links.txt +++ b/docs/source/links.txt @@ -19,10 +19,10 @@ .. Main Jupyter notebook links .. _Notebook Basics: notebook_p2_ -.. _notebook_p2: https://nbviewer.jupyter.org/github/jupyter/notebook/blob/master/docs/source/examples/Notebook/Notebook%20Basics.ipynb +.. _notebook_p2: https://nbviewer.jupyter.org/github/jupyter/notebook/blob/main/docs/source/examples/Notebook/Notebook%20Basics.ipynb .. _Running Code in the Jupyter Notebook: notebook_p1_ -.. _notebook_p1: https://nbviewer.jupyter.org/github/jupyter/notebook/blob/master/docs/source/examples/Notebook/Running%20Code.ipynb +.. _notebook_p1: https://nbviewer.jupyter.org/github/jupyter/notebook/blob/main/docs/source/examples/Notebook/Running%20Code.ipynb .. Other python projects .. _matplotlib: https://matplotlib.org @@ -33,9 +33,9 @@ .. _Markdown: https://daringfireball.net/projects/markdown/syntax .. _Rich Output: notebook_p5_ -.. _notebook_p5: https://nbviewer.jupyter.org/github/ipython/ipython/blob/master/examples/IPython%20Kernel/Rich%20Output.ipynb +.. _notebook_p5: https://nbviewer.jupyter.org/github/ipython/ipython/blob/main/examples/IPython%20Kernel/Rich%20Output.ipynb .. _Plotting with Matplotlib: notebook_p3_ -.. _notebook_p3: https://nbviewer.jupyter.org/github/ipython/ipython/blob/master/examples/IPython%20Kernel/Plotting%20in%20the%20Notebook.ipynb +.. _notebook_p3: https://nbviewer.jupyter.org/github/ipython/ipython/blob/main/examples/IPython%20Kernel/Plotting%20in%20the%20Notebook.ipynb -.. _Working with Markdown Cells: https://nbviewer.jupyter.org/github/jupyter/notebook/blob/master/docs/source/examples/Notebook/Working%20With%20Markdown%20Cells.ipynb +.. _Working with Markdown Cells: https://nbviewer.jupyter.org/github/jupyter/notebook/blob/main/docs/source/examples/Notebook/Working%20With%20Markdown%20Cells.ipynb diff --git a/pyproject.toml b/pyproject.toml index 1f3b9bf532..83b90a2e61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,5 @@ timeout = 300 # timeout_method = "thread" filterwarnings = [ "error", - # Pending release of https://github.com/jupyterlab/jupyterlab_server/pull/259 - "ignore:metadata:DeprecationWarning", "ignore:There is no current event loop:DeprecationWarning", ]