-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add placeholders * add new placeholder comments * Refactor class TestClientMethodsHaveTracingDecorators Refactored class to use test file by the same name * Refactor class TestClientsDoNotUseStaticMethods Added test file by same name * Refactor class TestClientHasApprovedMethodNamePrefix Refactor to use file by same name * Refactor class TestClientConstructorTakesCorrectParameters Add file by same name * Refactor class TestClientMethodsUseKwargsWithMultipleParameters Added test file by same name * Refactor class TestClientMethodsHaveTypeAnnotations Added test file by same name * Refactor class TestClientHasKwargsInPoliciesForCreateConfigurationMethod Added test file by same name * Refactor class TestClientUsesCorrectNamingConventions Added test file by same name * Refactor class TestClientMethodsHaveKwargsParameter Added test file by same name * Refactor class TestAsyncClientCorrectNaming Added test file by same name * Refactor class TestSpecifyParameterNamesInCall Added test file by same name * Refactor class class TestClientListMethodsUseCorePaging Added test file by same name * Refactor class TestClientLROMethodsUseCorePolling Added test file by same name * Refactor class TestClientLROMethodsUseCorrectNaming Added test file by same name * Refactor class TestClientConstructorDoesNotHaveConnectionStringParam Added test file of same name * Refactor class TestClientMethodNamesDoNotUseDoubleUnderscorePrefix Added test file of same name * Refactor class TestCheckDocstringAdmonitionNewline Added test class by same name * Refactor class TestCheckEnum Added test file of same name * Refactor class TestCheckAPIVersion Added test file of same name * Refactor class TestCheckNonCoreNetworkImport Added test file by same name * Refactor class TestCheckNonAbstractTransportImport Added test file by same name * Refactor class TestRaiseWithTraceback Added test file by same name * Refactor class TestTypePropertyNameLength Added test file of same name * Refactor class TestDeleteOperationReturnType Added test file by same name * Refactor class TestDocstringParameters Added test file * Refactor class TestDoNotImportLegacySix Added file by same name * Refactor class TestCheckNoLegacyAzureCoreHttpResponseImport Added test file by same name * Refactor class TestCheckNoTypingUnderTypeChecking Added test file of same name * Refactor class TestPackageNameDoesNotUseUnderscoreOrPeriod Added test file by same name * Refactor class TestServiceClientUsesNameWithClientSuffix Added test file by same name * Refactor class TestCheckNamingMismatchGeneratedCode Added test file by same name * Refactor class TestCheckDoNotUseLegacyTyping Added test file by same name * Update test_pylint_custom_plugins.py * Refactor class TestDoNotLogErrorsEndUpRaising Added test file by same name * Refactor class TestDoNotImportAsyncio Added test file by same name. Fixed any merge issues. --------- Co-authored-by: Joshua Bishop <[email protected]>
- Loading branch information
1 parent
54d6470
commit d7456f0
Showing
36 changed files
with
3,122 additions
and
2,880 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...xtensions/azure-pylint-guidelines-checker/tests/test_files/async_client_correct_naming.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class _AsyncBaseSomeClient(): # @ | ||
# test_ignores_private_client | ||
def create_configuration(self): | ||
pass | ||
|
||
|
||
# test_ignores_correct_client | ||
class SomeClient(): # @ | ||
def create_configuration(self): # @ | ||
pass | ||
|
||
|
||
# test_ignores_async_base_named_client | ||
class AsyncSomeClientBase(): # @ | ||
def get_thing(self, **kwargs): | ||
pass | ||
|
||
|
||
# test_finds_incorrectly_named_client | ||
class AsyncSomeClient(): # @ | ||
def get_thing(self, **kwargs): | ||
pass | ||
|
||
|
||
# test_ignores_non_client | ||
class SomethingElse(): # @ | ||
def create_configuration(self): # @ | ||
pass |
19 changes: 19 additions & 0 deletions
19
...s/pylint-extensions/azure-pylint-guidelines-checker/tests/test_files/check_API_version.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# test_api_version_violation | ||
class SomeClient(object): | ||
""" | ||
:param str something: something | ||
""" | ||
|
||
def __init__(self, something, **kwargs): | ||
pass | ||
|
||
|
||
# test_api_version_acceptable | ||
class Some1Client(): # @ | ||
""" | ||
:param str something: something | ||
:keyword str api_version: api_version | ||
""" | ||
|
||
def __init__(self, something, **kwargs): | ||
pass |
16 changes: 16 additions & 0 deletions
16
...nsions/azure-pylint-guidelines-checker/tests/test_files/check_do_not_use_legacy_typing.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# test_disallowed_typing | ||
def function(x): # @ | ||
# type: (str) -> str | ||
pass | ||
|
||
|
||
# test_allowed_typing | ||
def function(x: str) -> str: # @ | ||
pass | ||
|
||
|
||
# test_arbitrary_comments | ||
def function(x): # @ | ||
# This is a comment | ||
pass | ||
|
131 changes: 131 additions & 0 deletions
131
...ns/azure-pylint-guidelines-checker/tests/test_files/check_docstring_admonition_newline.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# test_ignores_correct_admonition_statement_in_function | ||
def function_foo(x, y, z): | ||
"""docstring | ||
.. admonition:: Example: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
pass | ||
|
||
|
||
# test_ignores_correct_admonition_statement_in_function_with_comments | ||
def function_foo1(x, y, z): | ||
"""docstring | ||
.. admonition:: Example: | ||
This is Example content. | ||
Should support multi-line. | ||
Can also include file: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
|
||
|
||
# test_bad_admonition_statement_in_function | ||
def function_foo2(x, y, z): | ||
"""docstring | ||
.. admonition:: Example: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
|
||
|
||
# test_bad_admonition_statement_in_function_with_comments | ||
def function_foo3(x, y, z): | ||
"""docstring | ||
.. admonition:: Example: | ||
This is Example content. | ||
Should support multi-line. | ||
Can also include file: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
|
||
|
||
# test_ignores_correct_admonition_statement_in_function_async | ||
async def function_foo4(x, y, z): | ||
"""docstring | ||
.. admonition:: Example: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
|
||
|
||
# test_ignores_correct_admonition_statement_in_function_with_comments_async | ||
async def function_foo5(x, y, z): | ||
"""docstring | ||
.. admonition:: Example: | ||
This is Example content. | ||
Should support multi-line. | ||
Can also include file: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
|
||
|
||
# test_bad_admonition_statement_in_function_async | ||
async def function_foo6(x, y, z): | ||
"""docstring | ||
.. admonition:: Example: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
|
||
|
||
# test_bad_admonition_statement_in_function_with_comments_async | ||
async def function_foo7(x, y, z): | ||
"""docstring | ||
.. admonition:: Example: | ||
This is Example content. | ||
Should support multi-line. | ||
Can also include file: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
|
||
|
||
# test_ignores_correct_admonition_statement_in_class | ||
class SomeClient(object): | ||
"""docstring | ||
.. admonition:: Example: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
|
||
def __init__(self): | ||
pass | ||
|
||
|
||
# test_ignores_correct_admonition_statement_in_class_with_comments | ||
class Some1Client(): # @ | ||
"""docstring | ||
.. admonition:: Example: | ||
This is Example content. | ||
Should support multi-line. | ||
Can also include file: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
|
||
def __init__(self): | ||
pass | ||
|
||
|
||
# test_bad_admonition_statement_in_class | ||
class Some2Client(): # @ | ||
"""docstring | ||
.. admonition:: Example: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
|
||
def __init__(self): | ||
pass | ||
|
||
|
||
# test_bad_admonition_statement_in_class_with_comments | ||
class Some3Client(): # @ | ||
"""docstring | ||
.. admonition:: Example: | ||
This is Example content. | ||
Should support multi-line. | ||
Can also include file: | ||
.. literalinclude:: ../samples/sample_detect_language.py | ||
""" | ||
|
||
def __init__(self): | ||
pass |
28 changes: 28 additions & 0 deletions
28
tools/pylint-extensions/azure-pylint-guidelines-checker/tests/test_files/check_enum.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from enum import Enum | ||
from six import with_metaclass | ||
from azure.core import CaseInsensitiveEnumMeta | ||
|
||
|
||
# test_ignore_normal_class | ||
class SomeClient(object): | ||
my_list = [] | ||
|
||
|
||
# test_enum_capitalized_violation_python_two | ||
class MyBadEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): | ||
One = "one" | ||
|
||
|
||
# test_enum_capitalized_violation_python_three | ||
class MyBadEnum2(str, Enum, metaclass=CaseInsensitiveEnumMeta): | ||
One = "one" | ||
|
||
|
||
# test_inheriting_case_insensitive_violation | ||
class MyGoodEnum(str, Enum): | ||
ONE = "one" | ||
|
||
|
||
# test_acceptable_python_three | ||
class MyGoodEnum2(str, Enum, metaclass=CaseInsensitiveEnumMeta): | ||
ONE = "one" |
17 changes: 17 additions & 0 deletions
17
.../azure-pylint-guidelines-checker/tests/test_files/check_naming_mismatch_generated_code.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# test_import_naming_mismatch_violation | ||
import Something | ||
import Something2 as SomethingTwo | ||
|
||
__all__ = ( | ||
"Something", | ||
"SomethingTwo", | ||
) | ||
|
||
# test_import_from_naming_mismatch_violation | ||
from Something2 import SomethingToo as SomethingTwo | ||
|
||
# test_naming_mismatch_acceptable | ||
__all__ = ( | ||
"Something", | ||
"Something2", | ||
) |
33 changes: 33 additions & 0 deletions
33
...s/azure-pylint-guidelines-checker/tests/test_files/client_LRO_methods_use_core_polling.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from azure.core.polling import LROPoller | ||
from azure.core.tracing.decorator import distributed_trace | ||
|
||
|
||
# test_ignores_private_methods | ||
class SomeClient(): # @ | ||
def _begin_thing(self): # @ | ||
pass | ||
|
||
|
||
# test_ignores_non_client_methods | ||
class SomethingElse(): # @ | ||
def begin_things(self): # @ | ||
pass | ||
|
||
|
||
# test_ignores_methods_return_LROPoller | ||
class Some1Client(): # @ | ||
def begin_thing(self): # @ | ||
return LROPoller() | ||
|
||
@distributed_trace | ||
def begin_thing2(self): # @ | ||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) | ||
|
||
|
||
# test_finds_method_returning_something_else | ||
class Some2Client(): # @ | ||
def begin_thing(self): # @ | ||
return list() | ||
|
||
def begin_thing2(self): # @ | ||
return {} |
34 changes: 34 additions & 0 deletions
34
...azure-pylint-guidelines-checker/tests/test_files/client_LRO_methods_use_correct_naming.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from azure.core.polling import LROPoller | ||
from azure.core.tracing.decorator import distributed_trace | ||
|
||
|
||
class SomeClient(): # @ | ||
def _do_thing(self): | ||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # @ | ||
|
||
|
||
# test_ignores_non_client_methods | ||
class SomethingElse(): # @ | ||
def begin_things(self): | ||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # @ | ||
|
||
|
||
# test_ignores_methods_return_LROPoller_and_correctly_named | ||
class Some1Client(): # @ | ||
def begin_thing(self): | ||
return LROPoller() # @ | ||
|
||
@distributed_trace | ||
def begin_thing2(self): | ||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # @ | ||
|
||
|
||
# test_finds_incorrectly_named_method_returning_LROPoller | ||
class Some2Client(): # @ | ||
def poller_thing(self): # @ | ||
return LROPoller() # @ | ||
|
||
@distributed_trace | ||
def start_thing2(self): # @ | ||
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # @ | ||
|
Oops, something went wrong.