Exemplo n.º 1
0
 def handler(self):
     notice = sns()
     hnd = CheckRun('zen of python', 'this', '1', '2', '3')
     subject, message = check_run_event()
     notice['Records'][0]['Sns']['Subject'] = subject
     notice['Records'][0]['Sns']['Message'] = message
     hnd.event = notice
     hnd.hook = json.loads(message)
     hnd._session = requests.Session()
     return hnd
Exemplo n.º 2
0
    def test_as_handler(self, handler):
        hdl = CheckRun.as_handler('zen of python', 'this', '1', '2', '3')
        assert callable(hdl)
        assert hdl.__name__ == 'CheckRun'

        with pytest.raises(ValueError):
            hdl(handler.event, {})
Exemplo n.º 3
0
 def handler(self):
     return CheckRun("black", "black", "--check", "--diff", "tests")
Exemplo n.º 4
0
"""Lambda function that executes pyflakes, a static file linter."""
from lintipy import CheckRun


handle = CheckRun.as_handler('pyflakes', 'pyflakes', '.')
Exemplo n.º 5
0
 def test_init(self):
     hnd = CheckRun('zen of python', 'this', '1', '2', '3')
     assert hnd.label == 'zen of python'
     assert hnd.cmd == 'this'
     assert hnd.cmd_args == ('1', '2', '3')
Exemplo n.º 6
0
def handle(*args, **kwargs):
    """Handle that is invoked by AWS lambda."""
    CheckRun(
        '{{cookiecutter.linter}}',
        '{{cookiecutter.command}}', '{{cookiecutter.directory}}'
    )(*args, **kwargs)
Exemplo n.º 7
0
"""Lambda function that executes isort, a static file linter."""
from lintipy import CheckRun

handle = CheckRun.as_handler('isort', 'isort', '--check-only', '--diff', '.')
Exemplo n.º 8
0
"""Lambda function that executes bandit, a static file linter."""
from lintipy import CheckRun


handle = CheckRun.as_handler(
    'bandit',
    'bandit.cli.main', '-r', '.'
)
Exemplo n.º 9
0
"""Lambda function that executes pydocstyle, a static file linter."""

from lintipy import CheckRun

handle = CheckRun.as_handler('pydocstyle', 'pydocstyle', '.')
Exemplo n.º 10
0
"""Lambda function that executes flake8, a static file linter."""
from lintipy import CheckRun

handle = CheckRun.as_handler('flake8', 'flake8', '--jobs', '1', '.')
Exemplo n.º 11
0
"""Lambda function that executes pycodestyle, a static file linter."""
from lintipy import CheckRun


handle = CheckRun.as_handler('pycodestyle', 'pycodestyle', '.', )