Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8fc170ff0 | ||
|
|
c4a3e15ff0 | ||
|
|
db57127971 | ||
|
|
c8e516be2f | ||
|
|
1c0dd48ccd | ||
|
|
f4edb85a04 | ||
|
|
d99bb9fec3 | ||
|
|
3c4013fda1 | ||
|
|
1a961bd4b0 | ||
|
|
7a8cfeed6d |
@@ -8,4 +8,4 @@
|
|||||||
description: This hook runs yamllint.
|
description: This hook runs yamllint.
|
||||||
entry: yamllint
|
entry: yamllint
|
||||||
language: python
|
language: python
|
||||||
files: \.(yaml|yml)$
|
types: [file, yaml]
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
language: python
|
language: python
|
||||||
python:
|
python:
|
||||||
|
- 2.6
|
||||||
- 2.7
|
- 2.7
|
||||||
- 3.3
|
- 3.3
|
||||||
- 3.4
|
- 3.4
|
||||||
@@ -9,9 +10,10 @@ python:
|
|||||||
- nightly
|
- nightly
|
||||||
install:
|
install:
|
||||||
- pip install pyyaml flake8 flake8-import-order coveralls
|
- pip install pyyaml flake8 flake8-import-order coveralls
|
||||||
|
- if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install unittest2; fi
|
||||||
- pip install .
|
- pip install .
|
||||||
script:
|
script:
|
||||||
- flake8 .
|
- if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then flake8 .; fi
|
||||||
- yamllint --strict $(git ls-files '*.yaml' '*.yml')
|
- yamllint --strict $(git ls-files '*.yaml' '*.yml')
|
||||||
- coverage run --source=yamllint setup.py test
|
- coverage run --source=yamllint setup.py test
|
||||||
after_success:
|
after_success:
|
||||||
|
|||||||
22
CHANGELOG.rst
Normal file
22
CHANGELOG.rst
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
Changelog
|
||||||
|
=========
|
||||||
|
|
||||||
|
1.8.2 (2017-10-10)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Be clearer about the `ignore` conf type
|
||||||
|
- Update pre-commit hook file
|
||||||
|
- Add documentation for pre-commit
|
||||||
|
|
||||||
|
1.8.1 (2017-07-04)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Require pathspec >= 0.5.3
|
||||||
|
- Support Python 2.6
|
||||||
|
- Add a changelog
|
||||||
|
|
||||||
|
1.8.0 (2017-06-28)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Refactor argparse with mutually_exclusive_group
|
||||||
|
- Add support to ignore paths in configuration
|
||||||
13
docs/conf.py
13
docs/conf.py
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath('..')) # noqa
|
sys.path.insert(0, os.path.abspath('..')) # noqa
|
||||||
|
|
||||||
@@ -40,3 +41,15 @@ htmlhelp_basename = 'yamllintdoc'
|
|||||||
man_pages = [
|
man_pages = [
|
||||||
('index', 'yamllint', '', [u'Adrien Vergé'], 1)
|
('index', 'yamllint', '', [u'Adrien Vergé'], 1)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# -- Build with sphinx automodule without needing to install third-party libs
|
||||||
|
|
||||||
|
|
||||||
|
class Mock(MagicMock):
|
||||||
|
@classmethod
|
||||||
|
def __getattr__(cls, name):
|
||||||
|
return MagicMock()
|
||||||
|
|
||||||
|
|
||||||
|
MOCK_MODULES = ['pathspec', 'yaml']
|
||||||
|
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
|
||||||
|
|||||||
@@ -26,3 +26,4 @@ Table of contents
|
|||||||
disable_with_comments
|
disable_with_comments
|
||||||
development
|
development
|
||||||
text_editors
|
text_editors
|
||||||
|
integration
|
||||||
|
|||||||
17
docs/integration.rst
Normal file
17
docs/integration.rst
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
Integration with other software
|
||||||
|
===============================
|
||||||
|
|
||||||
|
Integration with pre-commit
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
You can integrate yamllint in `pre-commit <http://pre-commit.com/>`_ tool.
|
||||||
|
Here is an example, to add in your .pre-commit-config.yaml
|
||||||
|
|
||||||
|
.. code:: yaml
|
||||||
|
|
||||||
|
---
|
||||||
|
# Update the sha variable with the release version that you want, from the yamllint repo
|
||||||
|
- repo: https://github.com/adrienverge/yamllint.git
|
||||||
|
sha: v1.8.1
|
||||||
|
hooks:
|
||||||
|
- id: yamllint
|
||||||
5
setup.py
5
setup.py
@@ -46,7 +46,6 @@ setup(
|
|||||||
entry_points={'console_scripts': ['yamllint=yamllint.cli:run']},
|
entry_points={'console_scripts': ['yamllint=yamllint.cli:run']},
|
||||||
package_data={'yamllint': ['conf/*.yaml'],
|
package_data={'yamllint': ['conf/*.yaml'],
|
||||||
'tests': ['yaml-1.2-spec-examples/*']},
|
'tests': ['yaml-1.2-spec-examples/*']},
|
||||||
install_requires=['pathspec', 'pyyaml'],
|
install_requires=['pathspec >=0.5.3', 'pyyaml'],
|
||||||
tests_require=['nose'],
|
test_suite='tests',
|
||||||
test_suite='nose.collector',
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,7 +16,12 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import sys
|
||||||
|
try:
|
||||||
|
assert sys.version_info >= (2, 7)
|
||||||
import unittest
|
import unittest
|
||||||
|
except:
|
||||||
|
import unittest2 as unittest
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|||||||
@@ -23,14 +23,19 @@ import locale
|
|||||||
import os
|
import os
|
||||||
import pty
|
import pty
|
||||||
import shutil
|
import shutil
|
||||||
import unittest
|
|
||||||
import sys
|
import sys
|
||||||
|
try:
|
||||||
|
assert sys.version_info >= (2, 7)
|
||||||
|
import unittest
|
||||||
|
except:
|
||||||
|
import unittest2 as unittest
|
||||||
|
|
||||||
from yamllint import cli
|
from yamllint import cli
|
||||||
|
|
||||||
from tests.common import build_temp_workspace
|
from tests.common import build_temp_workspace
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(sys.version_info < (2, 7), 'Python 2.6 not supported')
|
||||||
class CommandLineTestCase(unittest.TestCase):
|
class CommandLineTestCase(unittest.TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ except ImportError:
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
try:
|
||||||
|
assert sys.version_info >= (2, 7)
|
||||||
import unittest
|
import unittest
|
||||||
|
except:
|
||||||
|
import unittest2 as unittest
|
||||||
|
|
||||||
from yamllint import cli
|
from yamllint import cli
|
||||||
from yamllint import config
|
from yamllint import config
|
||||||
@@ -334,6 +338,7 @@ class IgnorePathConfigTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
shutil.rmtree(cls.wd)
|
shutil.rmtree(cls.wd)
|
||||||
|
|
||||||
|
@unittest.skipIf(sys.version_info < (2, 7), 'Python 2.6 not supported')
|
||||||
def test_run_with_ignored_path(self):
|
def test_run_with_ignored_path(self):
|
||||||
sys.stdout = StringIO()
|
sys.stdout = StringIO()
|
||||||
with self.assertRaises(SystemExit):
|
with self.assertRaises(SystemExit):
|
||||||
|
|||||||
@@ -15,8 +15,12 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import io
|
import io
|
||||||
|
import sys
|
||||||
|
try:
|
||||||
|
assert sys.version_info >= (2, 7)
|
||||||
import unittest
|
import unittest
|
||||||
|
except:
|
||||||
|
import unittest2 as unittest
|
||||||
|
|
||||||
from yamllint.config import YamlLintConfig
|
from yamllint.config import YamlLintConfig
|
||||||
from yamllint import linter
|
from yamllint import linter
|
||||||
|
|||||||
@@ -18,9 +18,15 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import sys
|
||||||
|
try:
|
||||||
|
assert sys.version_info >= (2, 7)
|
||||||
import unittest
|
import unittest
|
||||||
|
except:
|
||||||
|
import unittest2 as unittest
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(sys.version_info < (2, 7), 'Python 2.6 not supported')
|
||||||
class ModuleTestCase(unittest.TestCase):
|
class ModuleTestCase(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.wd = tempfile.mkdtemp(prefix='yamllint-tests-')
|
self.wd = tempfile.mkdtemp(prefix='yamllint-tests-')
|
||||||
|
|||||||
@@ -14,7 +14,12 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
try:
|
||||||
|
assert sys.version_info >= (2, 7)
|
||||||
import unittest
|
import unittest
|
||||||
|
except:
|
||||||
|
import unittest2 as unittest
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ indentation, etc."""
|
|||||||
|
|
||||||
|
|
||||||
APP_NAME = 'yamllint'
|
APP_NAME = 'yamllint'
|
||||||
APP_VERSION = '1.8.0'
|
APP_VERSION = '1.8.2'
|
||||||
APP_DESCRIPTION = __doc__
|
APP_DESCRIPTION = __doc__
|
||||||
|
|
||||||
__author__ = u'Adrien Vergé'
|
__author__ = u'Adrien Vergé'
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class YamlLintConfig(object):
|
|||||||
if 'ignore' in conf:
|
if 'ignore' in conf:
|
||||||
if type(conf['ignore']) != str:
|
if type(conf['ignore']) != str:
|
||||||
raise YamlLintConfigError(
|
raise YamlLintConfigError(
|
||||||
'invalid config: ignore should be a list of patterns')
|
'invalid config: ignore should contain file patterns')
|
||||||
self.ignore = pathspec.PathSpec.from_lines(
|
self.ignore = pathspec.PathSpec.from_lines(
|
||||||
'gitwildmatch', conf['ignore'].splitlines())
|
'gitwildmatch', conf['ignore'].splitlines())
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ def validate_rule_conf(rule, conf):
|
|||||||
type(conf['ignore']) != pathspec.pathspec.PathSpec):
|
type(conf['ignore']) != pathspec.pathspec.PathSpec):
|
||||||
if type(conf['ignore']) != str:
|
if type(conf['ignore']) != str:
|
||||||
raise YamlLintConfigError(
|
raise YamlLintConfigError(
|
||||||
'invalid config: ignore should be a list of patterns')
|
'invalid config: ignore should contain file patterns')
|
||||||
conf['ignore'] = pathspec.PathSpec.from_lines(
|
conf['ignore'] = pathspec.PathSpec.from_lines(
|
||||||
'gitwildmatch', conf['ignore'].splitlines())
|
'gitwildmatch', conf['ignore'].splitlines())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user