Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pylint] Feature/pylint plugins merging in new pylint checkers #24065

Merged
merged 25 commits into from
Apr 19, 2022

Conversation

l0lawrence
Copy link
Member

@l0lawrence l0lawrence commented Apr 18, 2022

Merging Pylint Checkers:

  • naming-mismatch: No aliasing allowed in init
  • enum-must-be-uppercase: Enums must be uppercase
  • enum-must-inherit-case-insensitive-enum-meta: Enums need to inherit from CaseInsensitiveEnumMeta
  • client-accepts-api-version-keyword: ServiceClients should accept a keyword-only api_version

And

Fixes for these pylint checkers in some SDKs

This will break pipelines until changes are merged

l0lawrence and others added 11 commits March 17, 2022 15:05
* intro patch for aliasing - needs better way to grab __all__ info

* updated alias message

* line number shows up with alias warning

* working on testing this, slight mod to isinstance

* tests for aliasing

* updated docstring

* removing random import

* adding in a newline

* adding in a newline

* changing naming of error message

* changing package to model in except

* checking for only __all__ assign Node (cat)

* added alias checker to README

* added test file to test disable pylint warning

* add from import test

* removed unused imports

* changing test names for clarity

* added newline

* added link from Izzy

* fixed some issues with the links

* fixed some issues with the links2

* fix for running core on pylint pr

* removed cr

* checking ignore files

* seeing if ignore file will fix core breaks

* fix path in ci

* removed ignore

* removed ignore file

* rerun

* removing core

* made 2 for loops to figure out why search is not catching in core run

* core

* remvoing core

* renaming to naming_mismatch

* fix message name

* fixing naming issues

* naming init

* naming register

* changing name to align with checker name change

* fixed messaging

* fixing pylint error

* found a less invasive way to get to the model name in __all__

* reverting back to originally bc init can have more than 1 assign
* setting remote

* setting up api version checker

* api checker

* running core to see where error pops up

* trying to get tests to run

* python versioning and kwargs will change this

* checking docstring for api version keyword

* added basic test for docstring api_version

* adding in a test file for api version checker

* edit test file

* removing import that got added

* added newline:

* remvoing scripts from pipeline

* added newline:

* added in check for init doc too

* added in a test for init having the doc versus the init

* had to make tests go down to the class level to run test files

* fixing naming schema and docs for api checker - renamed error

* instead of splitting the doc - directly check for the keyword api_version string

* renaming file to match other test files

* switching around the order of keyword and param to see the effect on the checker

* renaming changed file name in test

* added api checker to the readme

* refactoring - if class doc has api_verison, skip looking at the init func

* fixing docstring on bad test

* changing credential type in test docstring

* adding in endpoint as an arg in the init

* addind endpoint as arg in init

* adding endpoint as arg

* updating test file names to follow acceptable and violation format

* updating file names in tests, and updating test function names to follow violation and acceptable trend

* fixing eof newline errors

* trying to get commits into pr

* eof newline

* changing class name to APIVersion instead of api

* init file, also updated APIVersion name

* adding end colon to api_verion str checking

* added in end colon to node.doc check too
* adding in correct links for pylint

* added in better links

* updating links

* updating links

* add in url to tests

* add in url to tests

* fixed disable in README for client-method-should-not-use-static-method

* fixing merge issue in readme with api_checker
* setting upstream

* start of enum checker

* wip enum cehcker

* passing basic test, need to only check enum

* adding tests for enum

* removed print statements

* tests

* added in check that class is Enum related

* adding rule for caseInsensitiveMeta

* had to change how to check for Enum b/c Meta makes it a Call Node

* added in a test for CaseInsensitive

* random import

* added to readme

* changed regsistered name

* fixed checker for uppercase so it references correct line

* fixed test to reflect line change in checker

* removing excess ==

* add new line

* seeing where enum checker will fail

* rerun

* remove alias

* removing alias for ci

* added in consideration for python3 meta syntax

* fixed error assuming metaclass exists

* adding enum class check

* missing an init

* removing the alias from readme

* fix docstring for enum class

* removing core

* enum checker update comments

* editing comments on checker

* refactoring for 2 diff syntaxes:

* added test file for enum

* removed _CaseInsensitiveEnumMeta

* some syntax changing

* fixing comments

* list is superfluous:

* removing the import that was default added for Node

* fixing space in comment, and removing if arg.name - pr comments

* edited test files, to test for both errors being thrown in the same enum class - pr comments

* fixing naming of test methods for readability

* split the enum checker into 2 private functions for the 2 different rules

* making if into elif on 1783 and 1800 to prevent breaking when python2 enum format

* renaming test files -pr comments

* python3 enum inherit class checker now uses _metaclass versus declared_metaclass()

* added in test for python 3 metaclass format

* enum_code now uses helper functions to return a boolean for both pylint guidelines

* adding a test to verify metaclass syntax ensures the MetaClass is the 1st argument arg[0]

* removing unused test files

* renaming test names to follow _violation and _acceptable pattern

* fixing inheritance of enummeta class format

* added in docstrings for the helper functions created

* adding newline at eof

* removing spaces from the eof line for github error

* clarifying enum_class helper function docstring

* fixing docstring edits

* returning booleans versus returning the individual variable

* collapsing inherit helper function to call message directly instead

* adding newline to eof

* updating _check_is_enum_class docstring return, rtype

* adding in import statement for metaclass, and enum to tests

* had to import with_metaclass for py2

* had to also import with_metaclass for python2 tests

* using declared_metaclass() instead of metaclass to get the metaclass for both py2 and py3 syntax

* removing uneeded for loop and now we are directly checking enum within the bases (arguments) of the class node

* collapsing a helper method to simplify logic of checker

* fixing indentation of tests

* adding space in api version error
* Updating CheckNamingMismatchGeneratedCode testing - naming convention and adding guidelines link test

* Updating CheckEnum test suite - added test for readme guideline links

* CheckAPIVersion added test for guidelines link

* FileHasCopyrightHeader added in test files to test for copyright header checker

* created TestPackageNameDoesNotUseUnderscoreOrPeriod

* TestPackageNameDoesNotUseUnderscoreOrPeriod adding guidelines link test

* added in TestServiceClientUsesNameWithClientSuffix test class

* fixed newline issues at end of file

* added guidelines link into NamingMismatchGeneratedCode warning:

* fixed PR comments with helper function for guidelines - import requests
* suppressing ACR pylint

* suppress tables pylint
* suppressing ACR pylint

* suppress tables pylint

* app config suppressions

* app config, pulling changes that merged
* add case insensitive enum meta

* fix import order
* fixing enum checker

* extra space fix :(
@check-enforcer
Copy link

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

What if I am onboarding a new service?

Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment:
/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run python - [service] - ci

@azure-sdk
Copy link
Collaborator

API change check for azure-mixedreality-remoterendering

API changes are not detected in this pull request for azure-mixedreality-remoterendering

@azure-sdk
Copy link
Collaborator

API change check for azure-data-tables

API changes are not detected in this pull request for azure-data-tables

@azure-sdk
Copy link
Collaborator

API change check for azure-ai-formrecognizer

API changes are not detected in this pull request for azure-ai-formrecognizer

@azure-sdk
Copy link
Collaborator

API change check for azure-confidentialledger

API changes are not detected in this pull request for azure-confidentialledger

@azure-sdk
Copy link
Collaborator

API change check for azure-communication-identity

API changes are not detected in this pull request for azure-communication-identity

@azure-sdk
Copy link
Collaborator

API change check for azure-communication-chat

API changes are not detected in this pull request for azure-communication-chat

@azure-sdk
Copy link
Collaborator

API change check for azure-communication-sms

API changes are not detected in this pull request for azure-communication-sms

@azure-sdk
Copy link
Collaborator

API change check for azure-communication-phonenumbers

API changes are not detected in this pull request for azure-communication-phonenumbers

@azure-sdk
Copy link
Collaborator

API change check for azure-communication-networktraversal

API changes are not detected in this pull request for azure-communication-networktraversal

@azure-sdk
Copy link
Collaborator

API change check for azure-eventgrid

API changes are not detected in this pull request for azure-eventgrid

* fixing monitor query pylint issues

* extra line
* fix remoterender

* adding line

* remove line
@azure-sdk
Copy link
Collaborator

API change check for azure-monitor-query

API changes are not detected in this pull request for azure-monitor-query

@l0lawrence l0lawrence merged commit d34e424 into main Apr 19, 2022
@l0lawrence l0lawrence deleted the feature/pylint-plugins branch April 19, 2022 22:35
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-python that referenced this pull request May 24, 2023
[Hub Generated] Publish private branch 'appplatform/release/s221' (Azure#24065)

* [AutoSync] 7e870de75 Merged PR 8134313: Add eurekaServerResource to eurekaServers put and patch params

* Fix spell check.

---------

Co-authored-by: swagger-automation <swagger@microsoft.com>
Co-authored-by: Xiangyang Yu <xiangy@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants