Package: azure-pylint-guidelines-checker
Linting the GuidelinesThe code presented in this repository is a lift-and-shift of codeoriginally written by @kristapraticoRunning guidelines checks in Azure/azure-sdk-for-python repositoryIn order to lint for the guidelines, you must make sure you are enabling thepylint-guidelines-checkerin your pylint invocation. Using the rcfile at theroot of the repowill ensure that the plugin is properly activatedIt is recommended you run pylint at the library package level to be consistent with how the CI runs pylint.Check that you are running pylint version >=2.14.5 and astroid version >=2.12.0.Install the pylint checker from the azure-sdk development feed.pipinstall--index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"pylint-guidelines-checkerRun pylint at the root of the repo and it will automatically find the pylintrc:C:\azure-sdk-for-python>pylintsdk/storage/azure-storage-blob/azureAdd the --rcfile command line argument with a relative path to the pylintrc from your current directory:C:\azure-sdk-for-python\sdk\storage>pylint--rcfile="../../pylintrc"azure-storage-blobSet the environment variable PYLINTRC to the absolute path of the pylintrc file:setPYLINTRC=C:\azure-sdk-for-python\pylintrcRun pylint:C:\azure-sdk-for-python\sdk\storage>pylintazure-storage-blobRun pylint at the package level using tox and it will find the pylintrc file:pipinstalltoxtox-monorepo
C:\azure-sdk-for-python\sdk\storage\azure-storage-blob>tox-elint-c../../../eng/tox/tox.iniIf you use the pylint extension for VS code or Pycharm itshouldfind the pylintrc automatically.How to disable a pylint error# pylint:disable=connection-string-should-not-be-constructor-paramThe pylint custom checkers for SDK guidelines fall into messages range C4717 - C4738.
You will know you came across a custom checker if it contains a link to the guidelines.In the case of a false positive, use the disable command to remove the pylint error.Rules ListPylint checker nameHow to fix thisHow to disable this ruleLink to python guidelineclient-method-should-not-use-static-methodUse module level functions instead.# pylint:disable=client-method-should-not-use-static-methodlinkmissing-client-constructor-parameter-credentialAdd a credential parameter to the client constructor. Do not use plural form "credentials".# pylint:disable=missing-client-constructor-parameter-credentiallinkmissing-client-constructor-parameter-kwargsAdd a **kwargs parameter to the client constructor.# pylint:disable=missing-client-constructor-parameter-kwargslinkclient-method-has-more-than-5-positional-argumentsUse keyword arguments to reduce number of positional arguments.# pylint:disable=client-method-has-more-than-5-positional-argumentslinkclient-method-missing-type-annotationsCheck that param/return type comments are present or that param/return type annotations are present. Check that you did not mix type comments with type annotations.# pylint:disable=client-method-missing-type-annotationslinkclient-incorrect-naming-conventionCheck that you use... snake_case for variable, function, and method names. Pascal case for types. ALL CAPS for constants.# pylint:disable=client-incorrect-naming-conventionlinkclient-method-missing-kwargsCheck that any methods that make network calls have a **kwargs parameter.# pylint:disable=client-method-missing-kwargslinkconfig-missing-kwargs-in-policyCheck that the policies in your configuration function contain a **kwargs parameter.# pylint:disable=config-missing-kwargs-in-policylinkasync-client-bad-nameRemove "Async" from your service client's name.# pylint:disable=async-client-bad-namelinkfile-needs-copyright-headerAdd a copyright header to the top of your file.# pylint:disable=file-needs-copyright-headerlinkclient-method-name-no-double-underscoreDon't use method names prefixed with "__".# pylint:disable=client-method-name-no-double-underscorelinkspecify-parameter-names-in-callSpecify the parameter names when calling methods with more than 2 required positional parameters. e.g. self.get_foo(one, two, three=three, four=four, five=five)# pylint:disable=specify-parameter-names-in-calllinkconnection-string-should-not-be-constructor-paramRemove connection string parameter from client constructor. Create a method that creates the client using a connection string.# pylint:disable=connection-string-should-not-be-constructor-paramlinkpackage-name-incorrectChange your distribution package name to only include dashes, e.g. azure-storage-file-share# pylint:disable=package-name-incorrectlinkclient-suffix-neededService client types should use a "Client" suffix, e.g. BlobClient.# pylint:disable=client-suffix-neededlinkdocstring-admonition-needs-newlineAdd a blank newline above the .. literalinclude statement.# pylint:disable=docstring-admonition-needs-newlineNo guideline, just helps our docs get built correctly for microsoft docs.naming-mismatchDo not alias models imported from the generated code.# pylint:disable=naming-mismatchlinkclient-accepts-api-version-keywordEnsure that the client constructor accepts a keyword-only api_version argument.# pylint:disable=client-accepts-api-version-keywordlinkenum-must-be-uppercaseThe enum name must be all uppercase.# pylint:disable=enum-must-be-uppercaselinkenum-must-inherit-case-insensitive-enum-metaThe enum should inherit from CaseInsensitiveEnumMeta.# pylint:disable=enum-must-inherit-case-insensitive-enum-metalinknetworking-import-outside-azure-core-transportThis import is only allowed in azure.core.pipeline.transport.# pylint:disable=networking-import-outside-azure-core-transportlinknon-abstract-transport-importOnly import abstract transports. Let core or end-user decide which transport to use.# pylint:disable=non-abstract-transport-importlinkno-raise-with-tracebackCheck that raise_with_traceback from azure-core is replaced with python 3 'raise from' syntax.# pylint:disable=no-raise-with-tracebacklinkname-too-longCheck that the length of class names, function names, and variable names are under 40 characters.# pylint:disable=name-too-longlinkdelete-operation-wrong-return-typeCheck that delete* or begin_delete* methods return None or LROPoller[None].# pylint:disable=delete-operation-wrong-return-typelinkclient-method-missing-tracing-decoratorpylint:disable=client-method-missing-tracing-decoratorCheck that sync client methods that make network calls have the sync distributed tracing decorator.linkclient-method-missing-tracing-decorator-asyncpylint:disable=client-method-missing-tracing-decorator-asyncCheck that async client methods that make network calls have the async distributed tracing decorator.link