diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index c6c512ecb79..00000000000 --- a/.pylintrc +++ /dev/null @@ -1,52 +0,0 @@ -# vim: set ft=dosini: - -[MAIN] -# Specify a score threshold to be exceeded before program exits with error. -fail-under=9.9 - -# Make sure public methods are documented. -# See Also: https://github.com/PyCQA/pydocstyle/issues/309#issuecomment-1426642147 -# Also fail on unused imports. -fail-on= - missing-function-docstring, - unused-import - -# Ignore pylint complaints about an upstream dependency. -ignored-modules=ConfigSpace.hyperparameters - -# Help inform pylint where to find the project's source code without needing to relyon PYTHONPATH. -#init-hook="from pylint.config import find_pylintrc; import os, sys; sys.path.append(os.path.dirname(find_pylintrc())); from logging import warning; warning(sys.path)" -init-hook="from logging import warning; warning(sys.path)" - -# Load some extra checkers. -load-plugins= - pylint.extensions.bad_builtin, - pylint.extensions.code_style, - pylint.extensions.docparams, - pylint.extensions.docstyle, - pylint.extensions.for_any_all, - pylint.extensions.mccabe, - pylint.extensions.no_self_use, - pylint.extensions.private_import, - pylint.extensions.redefined_loop_name, - pylint.extensions.redefined_variable_type, - pylint.extensions.set_membership, - pylint.extensions.typing - -[FORMAT] -# Maximum number of characters on a single line. -max-line-length=99 - -[MESSAGE CONTROL] -disable= - fixme, - no-else-return, - consider-using-assignment-expr, - deprecated-typing-alias, # disable for now - only deprecated recently - docstring-first-line-empty, - consider-alternative-union-syntax, # disable for now - still supporting python 3.8 - missing-raises-doc - -[STRING] -check-quote-consistency=yes -check-str-concat-over-line-jumps=yes diff --git a/Makefile b/Makefile index 145b641607d..297ba393031 100644 --- a/Makefile +++ b/Makefile @@ -343,7 +343,7 @@ build/pylint.mlos_viz.${CONDA_ENV_NAME}.build-stamp: $(MLOS_VIZ_PYTHON_FILES) PYLINT_COMMON_PREREQS := build/conda-env.${CONDA_ENV_NAME}.build-stamp PYLINT_COMMON_PREREQS += $(FORMAT_PREREQS) -PYLINT_COMMON_PREREQS += .pylintrc +PYLINT_COMMON_PREREQS += pyproject.toml build/pylint.%.${CONDA_ENV_NAME}.build-stamp: $(PYLINT_COMMON_PREREQS) conda run -n ${CONDA_ENV_NAME} pylint -j0 $(filter %.py,$+) diff --git a/pyproject.toml b/pyproject.toml index f70030a576b..4380245f794 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,7 @@ profile = "black" py_version = 311 src_paths = ["mlos_core", "mlos_bench", "mlos_viz"] +# TODO: Consider switching to pydocstringformatter [tool.docformatter] recursive = true black = true @@ -15,4 +16,58 @@ style = "numpy" pre-summary-newline = true close-quotes-on-newline = true -# TODO: move pylintrc and some setup.cfg configs here +# TODO: move some other setup.cfg configs here + +[tool.pylint.main] +# Specify a score threshold to be exceeded before program exits with error. +fail-under = 9.9 + +# Make sure public methods are documented. +# See Also: https://github.com/PyCQA/pydocstyle/issues/309#issuecomment-1426642147 +# Also fail on unused imports. +fail-on = [ + "missing-function-docstring", + "unused-import", +] + +# Ignore pylint complaints about an upstream dependency. +ignored-modules = ["ConfigSpace.hyperparameters"] + +# Help inform pylint where to find the project's source code without needing to relyon PYTHONPATH. +#init-hook="from pylint.config import find_pylintrc; import os, sys; sys.path.append(os.path.dirname(find_pylintrc())); from logging import warning; warning(sys.path)" +init-hook = "from logging import warning; warning(sys.path)" + +# Load some extra checkers. +load-plugins = [ + "pylint.extensions.bad_builtin", + "pylint.extensions.code_style", + "pylint.extensions.docparams", + "pylint.extensions.docstyle", + "pylint.extensions.for_any_all", + "pylint.extensions.mccabe", + "pylint.extensions.no_self_use", + "pylint.extensions.private_import", + "pylint.extensions.redefined_loop_name", + "pylint.extensions.redefined_variable_type", + "pylint.extensions.set_membership", + "pylint.extensions.typing", +] + +[tool.pylint.format] +# Maximum number of characters on a single line. +max-line-length = 99 + +[tool.pylint."messages control"] +disable = [ + "fixme", + "no-else-return", + "consider-using-assignment-expr", + "deprecated-typing-alias", # disable for now - only deprecated recently + "docstring-first-line-empty", + "consider-alternative-union-syntax", # disable for now - still supporting python 3.8 + "missing-raises-doc", +] + +[tool.pylint.string] +check-quote-consistency = true +check-str-concat-over-line-jumps = true