Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -890,17 +890,17 @@ def visit_return(self, node):
paging_class = False

try:
if "def by_page" in next(node.value.infer()).as_string():
if any(v for v in node.value.infer() if "def by_page" in v.as_string()):
paging_class = True
except (astroid.exceptions.InferenceError, AttributeError): # astroid can't always infer the return
except (astroid.exceptions.InferenceError, AttributeError, TypeError): # astroid can't always infer the return
logger.debug("Pylint custom checker failed to check if client list method uses core paging.")
pass
return

if not paging_class:
self.add_message(
msgid="client-list-methods-use-paging", node=node.parent, confidence=None
)
except AttributeError:
except (AttributeError, TypeError):
logger.debug("Pylint custom checker failed to check if client list method uses core paging.")
pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="pylint-guidelines-checker",
version="0.0.6",
version="0.0.7",
url='https://github.com/Azure/azure-sdk-for-python',
license='MIT License',
description="A pylint plugin which enforces azure sdk guidelines.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1944,21 +1944,21 @@ def list_thing2(self): #@
def test_finds_method_returning_something_else_async(self):
class_node, function_node_a, function_node_b = astroid.extract_node("""
from azure.core.polling import LROPoller
from typing import list

class SomeClient(): #@
async def list_thing(self, **kwargs): #@
return list()
async def list_thing2(self, **kwargs): #@
from azure.core.polling import LROPoller
return LROPoller()
""")

with self.assertAddsMessages(
pylint.testutils.MessageTest(
msg_id="client-list-methods-use-paging", line=5, node=function_node_a, col_offset=4, end_line=5, end_col_offset=24
msg_id="client-list-methods-use-paging", line=6, node=function_node_a, col_offset=4, end_line=6, end_col_offset=24
),
pylint.testutils.MessageTest(
msg_id="client-list-methods-use-paging", line=7, node=function_node_b, col_offset=4, end_line=7, end_col_offset=25
msg_id="client-list-methods-use-paging", line=8, node=function_node_b, col_offset=4, end_line=8, end_col_offset=25
),
):
self.checker.visit_return(function_node_a.body[0])
Expand Down Expand Up @@ -2592,7 +2592,7 @@ async def function_foo(x, y, z):
This is Example content.
Should support multi-line.
Can also include file:

.. literalinclude:: ../samples/sample_detect_language.py
'''
"""
Expand Down