5939c90 pylint: Teach Pylint how to handle request.context

1 file Authored by slev 4 years ago, Committed by abiagion 4 years ago,
    pylint: Teach Pylint how to handle request.context
    
    With Astroid change [0] a inference for builtin containers
    was improved. This means that all the elements of such containers
    will be inferred if they are not Python constants (previously
    ignored).
    
    This change introduces several issues, one of them is a volatile
    error exposed at multi-job Pylinting, but could be guaranteed
    produced at single-job mode as:
    
    ```
    PYTHONPATH=. /usr/bin/python3 -m pylint --rcfile=./pylintrc \
        --load-plugins pylint_plugins ipaserver/plugins/dns.py ipalib/request.py
    
    ipalib/request.py:76: [E1101(no-member), destroy_context] Instance of 'bool' has no 'disconnect' member)
    
    -----------------------------------
    Your code has been rated at 9.97/10
    ```
    
    Or even adding 'context.some_attr = True' into ipalib/request.py.
    It's should be treated as no one member of `context`'s attrs is a
    `Connection` instance and has `destroy_context` member.
    
    To tell Pylint that there are such members the corresponding
    transformation is added.
    
    [0] https://github.com/PyCQA/astroid/commit/79d5a3a7
    
    Related: https://pagure.io/freeipa/issue/8116
    Signed-off-by: Stanislav Levin <slev@altlinux.org>
    Reviewed-By: Christian Heimes <cheimes@redhat.com>
    
        
file modified
+12 -0