How to use the autohooks.settings.Mode.from_string function in autohooks

To help you get started, we’ve selected a few autohooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github greenbone / autohooks / tests / test_settings.py View on Github external
def test_get_pipenv_mode_from_string(self):
        self.assertEqual(Mode.from_string('pipenv'), Mode.PIPENV)
        self.assertEqual(Mode.from_string('PIPENV'), Mode.PIPENV)
github greenbone / autohooks / tests / test_settings.py View on Github external
def test_get_poetry_mode_from_string(self):
        self.assertEqual(Mode.from_string('poetry'), Mode.POETRY)
        self.assertEqual(Mode.from_string('POETRY'), Mode.POETRY)
github greenbone / autohooks / tests / test_settings.py View on Github external
def test_get_poetry_mode_from_string(self):
        self.assertEqual(Mode.from_string('poetry'), Mode.POETRY)
        self.assertEqual(Mode.from_string('POETRY'), Mode.POETRY)
github greenbone / autohooks / tests / test_settings.py View on Github external
def test_get_pipenv_mode_from_string(self):
        self.assertEqual(Mode.from_string('pipenv'), Mode.PIPENV)
        self.assertEqual(Mode.from_string('PIPENV'), Mode.PIPENV)
github greenbone / autohooks / tests / test_settings.py View on Github external
def test_get_invalid_mode_from_string(self):
        self.assertEqual(Mode.from_string('foo'), Mode.UNKNOWN)
        self.assertEqual(Mode.from_string(None), Mode.UNDEFINED)
        self.assertEqual(Mode.from_string(''), Mode.UNDEFINED)
github greenbone / autohooks / tests / test_settings.py View on Github external
def test_get_invalid_mode_from_string(self):
        self.assertEqual(Mode.from_string('foo'), Mode.UNKNOWN)
        self.assertEqual(Mode.from_string(None), Mode.UNDEFINED)
        self.assertEqual(Mode.from_string(''), Mode.UNDEFINED)
github greenbone / autohooks / tests / test_settings.py View on Github external
def test_get_pythonpath_mode_from_string(self):
        self.assertEqual(Mode.from_string('pythonpath'), Mode.PYTHONPATH)
        self.assertEqual(Mode.from_string('PYTHONPATH'), Mode.PYTHONPATH)
github greenbone / autohooks / autohooks / cli / activate.py View on Github external
"installed pre-commit hook."
            )
            term.info(
                "Run 'autohooks check' to validate the current status of "
                "the installed pre-commit hook."
            )
    else:
        if not config.is_autohooks_enabled():
            term.warning(
                'autohooks is not enabled in your {} file. '
                'Run \'autohooks check\' for more '
                'details.'.format(str(pyproject_toml))
            )

        if args.mode:
            mode = Mode.from_string(args.mode)
        else:
            mode = config.get_mode()

        pre_commit_hook.write(mode=mode)

        term.ok(
            'autohooks pre-commit hook installed at {} using {} mode.'.format(
                str(pre_commit_hook), str(mode.get_effective_mode())
            )