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

initial import of __virtual__ log check #37

Merged
merged 4 commits into from
Mar 27, 2019

Conversation

mchugh19
Copy link
Contributor

Attempts to address issues:
saltstack/salt#49935
#2
vmware-archive/salt-testing#34

For test:

# -*- coding: utf-8 -*-
'''
some broken lint test
'''

# Import Python libs
from __future__ import absolute_import, unicode_literals, print_function
import logging

log = logging.getLogger(__name__)

__virtualname__ = 'broken'


def __virtual__():
    '''
    Check dependencies - may be useful in future
    '''

    log.error('not allowed')

    log.debug("some text")
    return __virtualname__

Results in:

pylint salt/modules/ --load-plugins=saltpylint.custom --rcfile=.testing.pylintrc  --disable=all --enable=log-in-virtual
  RuntimeWarning
************* Module salt.modules.broken
salt/modules/broken.py:20: [E1401(log-in-virtual), __virtual__] Log statement detected inside __virtual__ function. Remove it.
salt/modules/broken.py:22: [E1401(log-in-virtual), __virtual__] Log statement detected inside __virtual__ function. Remove it.

@gtmanfred @s0undt3ch

saltpylint/virt.py Outdated Show resolved Hide resolved
saltpylint/virt.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants