From 1601c8c53a0ed5e4411f0326ee1fc03bdb6cddc7 Mon Sep 17 00:00:00 2001 From: Serge Smertin Date: Fri, 15 Mar 2024 18:31:42 +0100 Subject: [PATCH] Improved autodoc --- README.md | 10 ++++++++++ scripts/docs.py | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/README.md b/README.md index c8f598d..1fa24fa 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Checks for common mistakes and issues in Python code specifically in Databricks * [`spark` checker](#spark-checker) * [`E9700`: `spark-outside-function`](#e9700-spark-outside-function) * [`E9701`: `no-spark-argument-in-function`](#e9701-no-spark-argument-in-function) + * [Testing in isolation](#testing-in-isolation) * [Project Support](#project-support) @@ -178,6 +179,15 @@ Function XXX is missing a 'spark' argument. Function refers to a global spark va [[back to top](#databricks-labs-pylint-plugin)] +## Testing in isolation +To test this plugin in isolation, you can use the following command: + +```bash +pylint --load-plugins=databricks.labs.pylint.all --disable=all --enable=unsupported-runtime,missing-data-security-mode,internal-api,pat-token-leaked,dbutils-notebook-run,dbutils-credentials,dbutils-fs-mount,dbutils-fs-ls,dbutils-fs-head,dbutils-fs-cp,incompatible-with-uc,legacy-cli,notebooks-percent-run,notebooks-too-many-cells,spark-outside-function,no-spark-argument-in-function . +``` + +[[back to top](#databricks-labs-pylint-plugin)] + # Project Support diff --git a/scripts/docs.py b/scripts/docs.py index 892d02a..4ca788b 100644 --- a/scripts/docs.py +++ b/scripts/docs.py @@ -12,6 +12,7 @@ def do_something(): out = ["\n"] + symbols = [] linter = PyLinter() for checker in [ AirflowChecker(linter), @@ -26,6 +27,13 @@ def do_something(): out.append(f"### `{msg_def.msgid}`: `{msg_def.symbol}`\n") out.append(f"{msg_def.msg.replace('%s', 'XXX')}. {msg_def.description}") out.append("\n[[back to top](#databricks-labs-pylint-plugin)]\n") + symbols.append(msg_def.symbol) + out.append("## Testing in isolation") + out.append("To test this plugin in isolation, you can use the following command:\n") + out.append("```bash") + out.append(f"pylint --load-plugins=databricks.labs.pylint.all --disable=all --enable={','.join(symbols)} .") + out.append("```") + out.append("\n[[back to top](#databricks-labs-pylint-plugin)]\n") out.append("") checker_docs = "\n".join(out) readme_file = Path(__file__).parent.parent.joinpath("README.md")