How to use the gitlint.get_config function in gitlint

To help you get started, we’ve selected a few gitlint 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 sk- / git-lint / test / e2etest / test_e2e.py View on Github external
def add_linter_checks(cls):
        """Add a test for each defined linter and extension."""
        for extension, linter_list in gitlint.get_config(None).items():
            for linter in linter_list:
                cls.add_linter_check(linter.args[0], extension)
github sk- / git-lint / test / unittest / test_gitlint.py View on Github external
def test_get_config_not_in_a_repo(self):
        # When not in a repo should return the default config.
        self.git_repository_root.return_value = None
        parsed_config = gitlint.get_config(None)
        self.assertEquals(self.git_lint_config, parsed_config)
github sk- / git-lint / test / unittest / test_gitlint.py View on Github external
def test_get_config_from_default(self):
        with mock.patch('os.path.exists', return_value=False):
            parsed_config = gitlint.get_config(self.root)
            self.assertEquals(self.git_lint_config, parsed_config)
github sk- / git-lint / test / unittest / test_gitlint.py View on Github external
git_config = os.path.join(self.root, '.gitlint.yaml')
        config = """python:
  extensions:
  - .py
  command: python
  arguments:
  - "-R"
  - "-v"
  filter: ".*"
  installation: "Really?"
"""
        with mock.patch('os.path.exists', return_value=True), \
            mock.patch('gitlint.open',
                       mock.mock_open(read_data=config),
                       create=True) as mock_open:
            parsed_config = gitlint.get_config(self.root)
            mock_open.assert_called_once_with(git_config)
            self.assertEqual(['.py'], list(parsed_config.keys()))
            self.assertEqual(1, len(parsed_config['.py']))
github sk- / git-lint / test / unittest / test_gitlint.py View on Github external
def test_get_config_empty(self):
        # When config file is empty return an empty dictionary.
        with mock.patch('os.path.exists', return_value=True), \
            mock.patch('gitlint.open',
                       mock.mock_open(read_data=''),
                       create=True) as mock_open:
            parsed_config = gitlint.get_config(self.root)
            self.assertEqual({}, parsed_config)
github sk- / git-lint / test / unittest / test_gitlint.py View on Github external
def setUpClass(cls):
        cls._stderr = sys.stderr
        sys.stderr = sys.stdout
        cls.git_lint_config = gitlint.get_config(None)