コード例 #1
0
    def __init__(self,
                 origin,
                 contents,
                 message: str = '',
                 affected_code: (tuple, list) = (),
                 severity: int = RESULT_SEVERITY.NORMAL,
                 additional_info: str = '',
                 debug_msg='',
                 diffs: (dict, None) = None,
                 confidence: int = 100,
                 aspect: (aspectbase, None) = None,
                 message_arguments: dict = {},
                 applied_actions: dict = {}):
        """
        Creates a new HiddenResult. The contents can be accessed with
        obj.contents later.

        :param origin:
            The originating bear.
        :param contents:
            Any object to send additional data (arbitrary python objects)
            besides a message to the dependent bear. The data has to
            be picklable.
        :param affected_code:
            A tuple of ``SourceRange`` objects pointing to related positions in
            the source code.
        :param severity:
            Severity of this result.
        :param additional_info:
            A long description holding additional information about the issue
            and/or how to fix it. You can use this like a manual entry for a
            category of issues.
        :param debug_msg:
            A message which may help the user find out why this result was
            yielded.
        :param diffs:
            A dictionary with filename as key and ``Diff`` object
            associated with it as value.
        :param confidence:
            A number between 0 and 100 describing the likelihood of this result
            being a real issue.
        :param aspect:
            An aspectclass instance which this result is associated to.
            Note that this should be a leaf of the aspect tree!
            (If you have a node, spend some time figuring out which of
            the leafs exactly your result belongs to.)
        :param message_arguments:
            Arguments to be provided to the base message.
        :param applied_actions:
            A dictionary that contains the result, file_dict, file_diff_dict and
            the section for an action.
        """
        Result.__init__(self, origin, message, affected_code, severity,
                        additional_info, debug_msg, diffs, confidence, aspect,
                        message_arguments, applied_actions)

        self.contents = contents
コード例 #2
0
    def __init__(self, origin, affected_code, link: str,
                 link_context: LINK_CONTEXT):

        Result.__init__(self, origin,
                        'Found %s with context: %s' % (link, link_context),
                        affected_code)

        self.contents = [affected_code[0].start.line, link, link_context]
        self.link = link
        self.link_context = link_context
コード例 #3
0
    def __init__(self, origin, deadScopes, pyflakes_messages):

        Result.__init__(self, origin, message='')

        self.module_scope = self.get_scopes(ModuleScope, deadScopes)[0]
        self.class_scopes = self.get_scopes(ClassScope, deadScopes)
        self.function_scopes = self.get_scopes(FunctionScope, deadScopes)
        self.generator_scopes = self.get_scopes(GeneratorScope, deadScopes)
        self.doctest_scopes = self.get_scopes(DoctestScope, deadScopes)
        self.pyflakes_messages = pyflakes_messages
コード例 #4
0
ファイル: URLBear.py プロジェクト: Anmolbansal1/coala-bears
    def __init__(self, origin, affected_code,
                 link: str,
                 link_context: LINK_CONTEXT):

        Result.__init__(self, origin,
                        'Found %s with context: %s' % (link, link_context),
                        affected_code)

        self.contents = [affected_code[0].start.line, link, link_context]
        self.link = link
        self.link_context = link_context
コード例 #5
0
ファイル: HiddenResult.py プロジェクト: vikasd145/coala
    def __init__(self, origin, contents):
        """
        Creates a new HiddenResult. The contents can be accessed with
        obj.contents later.

        :param origin:   The originating bear.
        :param contents: Any object that is picklable since it will be
                         transferred across processes.
        """
        Result.__init__(self, origin, '')

        self.contents = contents
コード例 #6
0
ファイル: HiddenResult.py プロジェクト: RohanVB/coala
    def __init__(self, origin, contents):
        """
        Creates a new HiddenResult. The contents can be accessed with
        obj.contents later.

        :param origin:   The originating bear.
        :param contents: Any object that is picklable since it will be
                         transferred across processes.
        """
        Result.__init__(self, origin, '')

        self.contents = contents
コード例 #7
0
    def __init__(self, origin, affected_code, link: str,
                 http_status_code: (int, None), link_context: LINK_CONTEXT):

        Result.__init__(self, origin,
                        '%s responds with HTTP %s' % (link, http_status_code),
                        affected_code)

        self.contents = [
            affected_code[0].start.line, link, http_status_code, link_context
        ]
        self.link = link
        self.http_status_code = http_status_code
        self.link_context = link_context
コード例 #8
0
ファイル: URLBear.py プロジェクト: srisankethu/coala-bears
    def __init__(self, origin, affected_code,
                 link: str,
                 http_status_code: (int, None),
                 link_context: LINK_CONTEXT):

        Result.__init__(self, origin,
                        '%s responds with HTTP %s' % (link, http_status_code),
                        affected_code)

        self.contents = [affected_code[0].start.line, link, http_status_code,
                         link_context]
        self.link = link
        self.http_status_code = http_status_code
        self.link_context = link_context
コード例 #9
0
    def __init__(self, origin, deadScopes, pyflakes_messages):
        """
        Initialize the results object.

        :param origin:            The origin of invocation
        :param deadScopes:        Deadscopes returned by pyflakes
        :param pyflakes_messages: A list of warnings detected by pyflakes
        """
        Result.__init__(self, origin, message='')

        self.module_scope = self.get_scopes(ModuleScope, deadScopes)[0]
        self.class_scopes = self.get_scopes(ClassScope, deadScopes)
        self.function_scopes = self.get_scopes(FunctionScope, deadScopes)
        self.generator_scopes = self.get_scopes(GeneratorScope, deadScopes)
        self.doctest_scopes = self.get_scopes(DoctestScope, deadScopes)
        self.pyflakes_messages = pyflakes_messages
コード例 #10
0
ファイル: PatchResult.py プロジェクト: B-Rich/coala
    def __init__(self,
                 origin,
                 message,
                 diffs,
                 file=None,
                 line_nr=None,
                 severity=RESULT_SEVERITY.NORMAL):
        if not isinstance(diffs, dict):
            raise TypeError("diffs needs to be a dict.")
        Result.__init__(self,
                        origin=origin,
                        message=message,
                        file=file,
                        severity=severity,
                        line_nr=line_nr)

        self.diffs = diffs
コード例 #11
0
ファイル: URLHeadBear.py プロジェクト: tbabej/coala-bears
    def __init__(self, origin, affected_code, link: str,
                 head_response: (requests.models.Response, Exception),
                 link_context: LINK_CONTEXT):

        http_status_code = (head_response.status_code if isinstance(
            head_response, requests.models.Response) else None)
        Result.__init__(self, origin,
                        '%s responds with HTTP %s' % (link, http_status_code),
                        affected_code)

        self.contents = [
            affected_code[0].start.line, link, http_status_code, link_context
        ]
        self.link = link
        self.http_status_code = http_status_code
        self.link_context = link_context
        self.head_response = head_response
コード例 #12
0
    def __init__(self, origin, affected_code,
                 link: str,
                 head_response: (requests.models.Response, Exception),
                 link_context: LINK_CONTEXT):

        http_status_code = (head_response.status_code if
                            isinstance(head_response,
                                       requests.models.Response)
                            else None)
        Result.__init__(self, origin,
                        '%s responds with HTTP %s' % (link, http_status_code),
                        affected_code)

        self.contents = [affected_code[0].start.line, link, http_status_code,
                         link_context]
        self.link = link
        self.http_status_code = http_status_code
        self.link_context = link_context
        self.head_response = head_response
コード例 #13
0
ファイル: PatchResult.py プロジェクト: andreimacavei/coala
    def __init__(self, origin, message, diffs, file=None, line_nr=None, severity=RESULT_SEVERITY.NORMAL):
        if not isinstance(diffs, dict):
            raise TypeError("diffs needs to be a dict.")
        Result.__init__(self, origin=origin, message=message, file=file, severity=severity, line_nr=line_nr)

        self.diffs = diffs
コード例 #14
0
ファイル: HiddenResult.py プロジェクト: Anmolbansal1/coala
    def __init__(self,
                 origin,
                 contents,
                 message: str = '',
                 affected_code: (tuple, list) = (),
                 severity: int = RESULT_SEVERITY.NORMAL,
                 additional_info: str = '',
                 debug_msg='',
                 diffs: (dict, None) = None,
                 confidence: int = 100,
                 aspect: (aspectbase, None) = None,
                 message_arguments: dict = {},
                 applied_actions: dict = {}):
        """
        Creates a new HiddenResult. The contents can be accessed with
        obj.contents later.

        :param origin:
            The originating bear.
        :param contents:
            Any object to send additional data (arbitrary python objects)
            besides a message to the dependent bear. The data has to
            be picklable.
        :param affected_code:
            A tuple of ``SourceRange`` objects pointing to related positions in
            the source code.
        :param severity:
            Severity of this result.
        :param additional_info:
            A long description holding additional information about the issue
            and/or how to fix it. You can use this like a manual entry for a
            category of issues.
        :param debug_msg:
            A message which may help the user find out why this result was
            yielded.
        :param diffs:
            A dictionary with filename as key and ``Diff`` object
            associated with it as value.
        :param confidence:
            A number between 0 and 100 describing the likelihood of this result
            being a real issue.
        :param aspect:
            An aspectclass instance which this result is associated to.
            Note that this should be a leaf of the aspect tree!
            (If you have a node, spend some time figuring out which of
            the leafs exactly your result belongs to.)
        :param message_arguments:
            Arguments to be provided to the base message.
        :param applied_actions:
            A dictionary that contains the result, file_dict, file_diff_dict and
            the section for an action.
        """
        Result.__init__(self,
                        origin,
                        message,
                        affected_code,
                        severity,
                        additional_info,
                        debug_msg,
                        diffs,
                        confidence,
                        aspect,
                        message_arguments,
                        applied_actions)

        self.contents = contents