diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 105fccd..119917f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,33 @@ Changelog ========= +1.20.0 (2019-12-26) +------------------- + +- Add --no-warnings option to suppress warning messages +- Use 'syntax' as rule name upon syntax errors + +1.19.0 (2019-11-19) +------------------- + +- Allow disabling all checks for a file with ``# yamllint disable-file`` + +1.18.0 (2019-10-15) +------------------- + +- Lint ``.yamllint`` config file by default +- Also read config from ``.yamllint.yml`` and ``.yamllint.yaml`` +- Improve documentation for ``yaml-files`` +- Update documentation for ``pre-commit`` +- Explicitly disable ``empty-values`` and ``octal-values`` rules + +1.17.0 (2019-08-12) +------------------- + +- Simplify installation instructions in the README +- Add OpenBSD installation instructions +- Make YAML file extensions configurable + 1.16.0 (2019-06-07) ------------------- diff --git a/README.rst b/README.rst index 7f59956..0bebb78 100644 --- a/README.rst +++ b/README.rst @@ -38,38 +38,16 @@ Screenshot Installation ^^^^^^^^^^^^ -On Fedora / CentOS (note: `EPEL `_ is -required on CentOS): - -.. code:: bash - - sudo dnf install yamllint - -On Debian 8+ / Ubuntu 16.04+: - -.. code:: bash - - sudo apt-get install yamllint - -On FreeBSD: - -.. code:: sh - - pkg install py27-yamllint - pkg install py36-yamllint - -On Mac OS 10.11+: - -.. code:: bash - - brew install yamllint - -Alternatively using pip, the Python package manager: +Using pip, the Python package manager: .. code:: bash pip install --user yamllint +yamllint is also packaged for all major operating systems, see installation +examples (``dnf``, ``apt-get``...) `in the documentation +`_. + Usage ^^^^^ diff --git a/docs/configuration.rst b/docs/configuration.rst index 817a16d..0322ad3 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -14,7 +14,8 @@ To use a custom configuration file, use the ``-c`` option: If ``-c`` is not provided, yamllint will look for a configuration file in the following locations (by order of preference): -- ``.yamllint`` in the current working directory +- ``.yamllint``, ``.yamllint.yaml`` or ``.yamllint.yml`` in the current working + directory - ``$XDG_CONFIG_HOME/yamllint/config`` - ``~/.config/yamllint/config`` @@ -115,6 +116,25 @@ return code will be: * ``1`` if one or more errors occur * ``2`` if no errors occur, but one or more warnings occur +If the script is invoked with the ``--no-warnings`` option, it won't output +warning level problems, only error level ones. + +YAML files extensions +--------------------- + +To configure what yamllint should consider as YAML files, set ``yaml-files`` +configuration option. The default is: + +.. code-block:: yaml + + yaml-files: + - '*.yaml' + - '*.yml' + - '.yamllint' + +The same rules as for ignoring paths apply (``.gitignore``-style path pattern, +see below). + Ignoring paths -------------- diff --git a/docs/disable_with_comments.rst b/docs/disable_with_comments.rst index d50a372..40219f2 100644 --- a/docs/disable_with_comments.rst +++ b/docs/disable_with_comments.rst @@ -73,3 +73,31 @@ It is possible, although not recommend, to disabled **all** rules: If you need to disable multiple rules, it is allowed to chain rules like this: ``# yamllint disable rule:hyphens rule:commas rule:indentation``. + +Disabling all checks for a file +------------------------------- + +To prevent yamllint from reporting problems for a specific file, add the +directive comment ``# yamllint disable-file`` as the first line of the file. +For instance: + +.. code-block:: yaml + + # yamllint disable-file + # The following mapping contains the same key twice, but I know what I'm doing: + key: value 1 + key: value 2 + + - This line is waaaaaaaaaay too long but yamllint will not report anything about it. + This line will be checked by yamllint. + +or: + +.. code-block:: jinja + + # yamllint disable-file + # This file is not valid YAML because it is a Jinja template + {% if extra_info %} + key1: value1 + {% endif %} + key2: value2 diff --git a/docs/integration.rst b/docs/integration.rst index da67d7f..3457556 100644 --- a/docs/integration.rst +++ b/docs/integration.rst @@ -10,8 +10,10 @@ 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 + # Update the rev variable with the release version that you want, from the yamllint repo + # You can pass your custom .yamllint with args attribute. - repo: https://github.com/adrienverge/yamllint.git - sha: v1.8.1 + rev: v1.17.0 hooks: - id: yamllint + args: [-c=/path/to/.yamllint] diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 427a9f3..9cf5f17 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -4,7 +4,8 @@ Quickstart Installing yamllint ------------------- -On Fedora / CentOS: +On Fedora / CentOS (note: `EPEL `_ is +required on CentOS): .. code:: bash @@ -22,6 +23,18 @@ On Mac OS 10.11+: brew install yamllint +On FreeBSD: + +.. code:: sh + + pkg install py36-yamllint + +On OpenBSD: + +.. code:: sh + + doas pkg_add py3-yamllint + Alternatively using pip, the Python package manager: .. code:: bash diff --git a/tests/rules/test_octal_values.py b/tests/rules/test_octal_values.py index 7e82d4e..f2d9a2b 100644 --- a/tests/rules/test_octal_values.py +++ b/tests/rules/test_octal_values.py @@ -28,7 +28,9 @@ class OctalValuesTestCase(RuleTestCase): self.check('user-city: 0o10', conf) def test_implicit_octal_values(self): - conf = ('octal-values: {forbid-implicit-octal: true}\n' + conf = ('octal-values:\n' + ' forbid-implicit-octal: true\n' + ' forbid-explicit-octal: false\n' 'new-line-at-end-of-file: disable\n' 'document-start: disable\n') self.check('user-city: 010', conf, problem=(1, 15)) @@ -50,7 +52,9 @@ class OctalValuesTestCase(RuleTestCase): ' - 0e3\n', conf) def test_explicit_octal_values(self): - conf = ('octal-values: {forbid-explicit-octal: true}\n' + conf = ('octal-values:\n' + ' forbid-implicit-octal: false\n' + ' forbid-explicit-octal: true\n' 'new-line-at-end-of-file: disable\n' 'document-start: disable\n') self.check('user-city: 0o10', conf, problem=(1, 16)) diff --git a/tests/test_cli.py b/tests/test_cli.py index b5ef82a..4244dc8 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -29,6 +29,7 @@ import unittest from tests.common import build_temp_workspace from yamllint import cli +from yamllint import config class CommandLineTestCase(unittest.TestCase): @@ -73,8 +74,9 @@ class CommandLineTestCase(unittest.TestCase): shutil.rmtree(cls.wd) def test_find_files_recursively(self): + conf = config.YamlLintConfig('extends: default') self.assertEqual( - sorted(cli.find_files_recursively([self.wd])), + sorted(cli.find_files_recursively([self.wd], conf)), [os.path.join(self.wd, 'a.yaml'), os.path.join(self.wd, 'empty.yml'), os.path.join(self.wd, 's/s/s/s/s/s/s/s/s/s/s/s/s/s/s/file.yaml'), @@ -85,14 +87,14 @@ class CommandLineTestCase(unittest.TestCase): items = [os.path.join(self.wd, 'sub/ok.yaml'), os.path.join(self.wd, 'empty-dir')] self.assertEqual( - sorted(cli.find_files_recursively(items)), + sorted(cli.find_files_recursively(items, conf)), [os.path.join(self.wd, 'sub/ok.yaml')], ) items = [os.path.join(self.wd, 'empty.yml'), os.path.join(self.wd, 's')] self.assertEqual( - sorted(cli.find_files_recursively(items)), + sorted(cli.find_files_recursively(items, conf)), [os.path.join(self.wd, 'empty.yml'), os.path.join(self.wd, 's/s/s/s/s/s/s/s/s/s/s/s/s/s/s/file.yaml')], ) @@ -100,11 +102,77 @@ class CommandLineTestCase(unittest.TestCase): items = [os.path.join(self.wd, 'sub'), os.path.join(self.wd, '/etc/another/file')] self.assertEqual( - sorted(cli.find_files_recursively(items)), + sorted(cli.find_files_recursively(items, conf)), [os.path.join(self.wd, '/etc/another/file'), os.path.join(self.wd, 'sub/ok.yaml')], ) + conf = config.YamlLintConfig('extends: default\n' + 'yaml-files:\n' + ' - \'*.yaml\' \n') + self.assertEqual( + sorted(cli.find_files_recursively([self.wd], conf)), + [os.path.join(self.wd, 'a.yaml'), + os.path.join(self.wd, 's/s/s/s/s/s/s/s/s/s/s/s/s/s/s/file.yaml'), + os.path.join(self.wd, 'sub/ok.yaml'), + os.path.join(self.wd, 'warn.yaml')] + ) + + conf = config.YamlLintConfig('extends: default\n' + 'yaml-files:\n' + ' - \'*.yml\'\n') + self.assertEqual( + sorted(cli.find_files_recursively([self.wd], conf)), + [os.path.join(self.wd, 'empty.yml')] + ) + + conf = config.YamlLintConfig('extends: default\n' + 'yaml-files:\n' + ' - \'*.json\'\n') + self.assertEqual( + sorted(cli.find_files_recursively([self.wd], conf)), + [os.path.join(self.wd, 'no-yaml.json')] + ) + + conf = config.YamlLintConfig('extends: default\n' + 'yaml-files:\n' + ' - \'*\'\n') + self.assertEqual( + sorted(cli.find_files_recursively([self.wd], conf)), + [os.path.join(self.wd, 'a.yaml'), + os.path.join(self.wd, 'empty.yml'), + os.path.join(self.wd, 'no-yaml.json'), + os.path.join(self.wd, 'non-ascii/utf-8'), + os.path.join(self.wd, 's/s/s/s/s/s/s/s/s/s/s/s/s/s/s/file.yaml'), + os.path.join(self.wd, 'sub/ok.yaml'), + os.path.join(self.wd, 'warn.yaml')] + ) + + conf = config.YamlLintConfig('extends: default\n' + 'yaml-files:\n' + ' - \'*.yaml\'\n' + ' - \'*\'\n' + ' - \'**\'\n') + self.assertEqual( + sorted(cli.find_files_recursively([self.wd], conf)), + [os.path.join(self.wd, 'a.yaml'), + os.path.join(self.wd, 'empty.yml'), + os.path.join(self.wd, 'no-yaml.json'), + os.path.join(self.wd, 'non-ascii/utf-8'), + os.path.join(self.wd, 's/s/s/s/s/s/s/s/s/s/s/s/s/s/s/file.yaml'), + os.path.join(self.wd, 'sub/ok.yaml'), + os.path.join(self.wd, 'warn.yaml')] + ) + + conf = config.YamlLintConfig('extends: default\n' + 'yaml-files:\n' + ' - \'s/**\'\n' + ' - \'**/utf-8\'\n') + self.assertEqual( + sorted(cli.find_files_recursively([self.wd], conf)), + [os.path.join(self.wd, 'non-ascii/utf-8')] + ) + def test_run_with_bad_arguments(self): sys.stdout, sys.stderr = StringIO(), StringIO() with self.assertRaises(SystemExit) as ctx: @@ -462,5 +530,40 @@ class CommandLineTestCase(unittest.TestCase): out, err = sys.stdout.getvalue(), sys.stderr.getvalue() self.assertEqual(out, ( 'stdin:2:10: [error] syntax error: ' - 'mapping values are not allowed here\n')) + 'mapping values are not allowed here (syntax)\n')) self.assertEqual(err, '') + + def test_run_no_warnings(self): + file = os.path.join(self.wd, 'a.yaml') + + sys.stdout, sys.stderr = StringIO(), StringIO() + with self.assertRaises(SystemExit) as ctx: + cli.run((file, '--no-warnings', '-f', 'auto')) + + self.assertEqual(ctx.exception.code, 1) + + out, err = sys.stdout.getvalue(), sys.stderr.getvalue() + self.assertEqual(out, ( + '%s\n' + ' 2:4 error trailing spaces (trailing-spaces)\n' + ' 3:4 error no new line character at the end of file ' + '(new-line-at-end-of-file)\n' + '\n' % file)) + self.assertEqual(err, '') + + file = os.path.join(self.wd, 'warn.yaml') + + sys.stdout, sys.stderr = StringIO(), StringIO() + with self.assertRaises(SystemExit) as ctx: + cli.run((file, '--no-warnings', '-f', 'auto')) + + self.assertEqual(ctx.exception.code, 0) + + def test_run_no_warnings_and_strict(self): + file = os.path.join(self.wd, 'warn.yaml') + + sys.stdout, sys.stderr = StringIO(), StringIO() + with self.assertRaises(SystemExit) as ctx: + cli.run((file, '--no-warnings', '-s')) + + self.assertEqual(ctx.exception.code, 2) diff --git a/tests/test_config.py b/tests/test_config.py index d676382..b48546c 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -448,11 +448,13 @@ class IgnorePathConfigTestCase(unittest.TestCase): out = sys.stdout.getvalue() out = '\n'.join(sorted(out.splitlines())) + docstart = '[warning] missing document start "---" (document-start)' keydup = '[error] duplication of key "key" in mapping (key-duplicates)' trailing = '[error] trailing spaces (trailing-spaces)' hyphen = '[error] too many spaces after hyphen (hyphens)' self.assertEqual(out, '\n'.join(( + './.yamllint:1:1: ' + docstart, './bin/file.lint-me-anyway.yaml:3:3: ' + keydup, './bin/file.lint-me-anyway.yaml:4:17: ' + trailing, './bin/file.lint-me-anyway.yaml:5:5: ' + hyphen, diff --git a/tests/test_yamllint_directives.py b/tests/test_yamllint_directives.py index 8c6e865..17bb69e 100644 --- a/tests/test_yamllint_directives.py +++ b/tests/test_yamllint_directives.py @@ -302,3 +302,104 @@ class YamllintDirectivesTestCase(RuleTestCase): ' c: [x]\n', conf, problem=(6, 2, 'comments-indentation')) + + def test_disable_file_directive(self): + conf = ('comments: {min-spaces-from-content: 2}\n' + 'comments-indentation: {}\n') + self.check('# yamllint disable-file\n' + '---\n' + '- a: 1 # comment too close\n' + ' b:\n' + ' # wrong indentation\n' + ' c: [x]\n', + conf) + self.check('# yamllint disable-file\n' + '---\n' + '- a: 1 # comment too close\n' + ' b:\n' + ' # wrong indentation\n' + ' c: [x]\n', + conf) + self.check('#yamllint disable-file\n' + '---\n' + '- a: 1 # comment too close\n' + ' b:\n' + ' # wrong indentation\n' + ' c: [x]\n', + conf) + self.check('#yamllint disable-file \n' + '---\n' + '- a: 1 # comment too close\n' + ' b:\n' + ' # wrong indentation\n' + ' c: [x]\n', + conf) + self.check('---\n' + '# yamllint disable-file\n' + '- a: 1 # comment too close\n' + ' b:\n' + ' # wrong indentation\n' + ' c: [x]\n', + conf, + problem1=(3, 8, 'comments'), + problem2=(5, 2, 'comments-indentation')) + self.check('# yamllint disable-file: rules cannot be specified\n' + '---\n' + '- a: 1 # comment too close\n' + ' b:\n' + ' # wrong indentation\n' + ' c: [x]\n', + conf, + problem1=(3, 8, 'comments'), + problem2=(5, 2, 'comments-indentation')) + self.check('AAAA yamllint disable-file\n' + '---\n' + '- a: 1 # comment too close\n' + ' b:\n' + ' # wrong indentation\n' + ' c: [x]\n', + conf, + problem1=(1, 1, 'document-start'), + problem2=(3, 8, 'comments'), + problem3=(5, 2, 'comments-indentation')) + + def test_disable_file_directive_not_at_first_position(self): + self.check('# yamllint disable-file\n' + '---\n' + '- bad : colon and spaces \n', + self.conf) + self.check('---\n' + '# yamllint disable-file\n' + '- bad : colon and spaces \n', + self.conf, + problem1=(3, 7, 'colons'), + problem2=(3, 26, 'trailing-spaces')) + + def test_disable_file_directive_with_syntax_error(self): + self.check('# This file is not valid YAML (it is a Jinja template)\n' + '{% if extra_info %}\n' + 'key1: value1\n' + '{% endif %}\n' + 'key2: value2\n', + self.conf, + problem=(2, 2, 'syntax')) + self.check('# yamllint disable-file\n' + '# This file is not valid YAML (it is a Jinja template)\n' + '{% if extra_info %}\n' + 'key1: value1\n' + '{% endif %}\n' + 'key2: value2\n', + self.conf) + + def test_disable_file_directive_with_dos_lines(self): + self.check('# yamllint disable-file\r\n' + '---\r\n' + '- bad : colon and spaces \r\n', + self.conf) + self.check('# yamllint disable-file\r\n' + '# This file is not valid YAML (it is a Jinja template)\r\n' + '{% if extra_info %}\r\n' + 'key1: value1\r\n' + '{% endif %}\r\n' + 'key2: value2\r\n', + self.conf) diff --git a/yamllint/__init__.py b/yamllint/__init__.py index 932054e..676c80f 100644 --- a/yamllint/__init__.py +++ b/yamllint/__init__.py @@ -22,7 +22,7 @@ indentation, etc.""" APP_NAME = 'yamllint' -APP_VERSION = '1.16.0' +APP_VERSION = '1.20.0' APP_DESCRIPTION = __doc__ __author__ = u'Adrien Vergé' diff --git a/yamllint/cli.py b/yamllint/cli.py index 9975b4e..26bdb1f 100644 --- a/yamllint/cli.py +++ b/yamllint/cli.py @@ -27,13 +27,14 @@ from yamllint.config import YamlLintConfig, YamlLintConfigError from yamllint.linter import PROBLEM_LEVELS -def find_files_recursively(items): +def find_files_recursively(items, conf): for item in items: if os.path.isdir(item): for root, dirnames, filenames in os.walk(item): - for filename in [f for f in filenames - if f.endswith(('.yml', '.yaml'))]: - yield os.path.join(root, filename) + for f in filenames: + filepath = os.path.join(root, f) + if conf.is_yaml_file(filepath): + yield filepath else: yield item @@ -83,11 +84,14 @@ class Format(object): return line -def show_problems(problems, file, args_format): +def show_problems(problems, file, args_format, no_warn): max_level = 0 first = True for problem in problems: + max_level = max(max_level, PROBLEM_LEVELS[problem.level]) + if no_warn and (problem.level != 'error'): + continue if args_format == 'parsable': print(Format.parsable(problem, file)) elif args_format == 'colored' or \ @@ -101,7 +105,6 @@ def show_problems(problems, file, args_format): print(file) first = False print(Format.standard(problem, file)) - max_level = max(max_level, PROBLEM_LEVELS[problem.level]) if not first and args_format != 'parsable': print('') @@ -132,6 +135,9 @@ def run(argv=None): action='store_true', help='return non-zero exit code on warnings ' 'as well as errors') + parser.add_argument('--no-warnings', + action='store_true', + help='output only error level problems') parser.add_argument('-v', '--version', action='version', version='{} {}'.format(APP_NAME, APP_VERSION)) @@ -153,6 +159,10 @@ def run(argv=None): conf = YamlLintConfig(file=args.config_file) elif os.path.isfile('.yamllint'): conf = YamlLintConfig(file='.yamllint') + elif os.path.isfile('.yamllint.yaml'): + conf = YamlLintConfig(file='.yamllint.yaml') + elif os.path.isfile('.yamllint.yml'): + conf = YamlLintConfig(file='.yamllint.yml') elif os.path.isfile(user_global_config): conf = YamlLintConfig(file=user_global_config) else: @@ -163,7 +173,7 @@ def run(argv=None): max_level = 0 - for file in find_files_recursively(args.files): + for file in find_files_recursively(args.files, conf): filepath = file[2:] if file.startswith('./') else file try: with open(file) as f: @@ -171,7 +181,8 @@ def run(argv=None): except EnvironmentError as e: print(e, file=sys.stderr) sys.exit(-1) - prob_level = show_problems(problems, file, args_format=args.format) + prob_level = show_problems(problems, file, args_format=args.format, + no_warn=args.no_warnings) max_level = max(max_level, prob_level) # read yaml from stdin @@ -181,7 +192,8 @@ def run(argv=None): except EnvironmentError as e: print(e, file=sys.stderr) sys.exit(-1) - prob_level = show_problems(problems, 'stdin', args_format=args.format) + prob_level = show_problems(problems, 'stdin', args_format=args.format, + no_warn=args.no_warnings) max_level = max(max_level, prob_level) if max_level == PROBLEM_LEVELS['error']: diff --git a/yamllint/conf/default.yaml b/yamllint/conf/default.yaml index da9701e..0720ded 100644 --- a/yamllint/conf/default.yaml +++ b/yamllint/conf/default.yaml @@ -1,5 +1,10 @@ --- +yaml-files: + - '*.yaml' + - '*.yml' + - '.yamllint' + rules: braces: enable brackets: enable @@ -13,7 +18,7 @@ rules: document-start: level: warning empty-lines: enable - empty-values: enable + empty-values: disable hyphens: enable indentation: enable key-duplicates: enable @@ -21,7 +26,7 @@ rules: line-length: enable new-line-at-end-of-file: enable new-lines: enable - octal-values: enable + octal-values: disable quoted-strings: disable trailing-spaces: enable truthy: diff --git a/yamllint/config.py b/yamllint/config.py index 2cafe8a..0837799 100644 --- a/yamllint/config.py +++ b/yamllint/config.py @@ -32,6 +32,9 @@ class YamlLintConfig(object): self.ignore = None + self.yaml_files = pathspec.PathSpec.from_lines( + 'gitwildmatch', ['*.yaml', '*.yml', '.yamllint']) + if file is not None: with open(file) as f: content = f.read() @@ -42,6 +45,9 @@ class YamlLintConfig(object): def is_file_ignored(self, filepath): return self.ignore and self.ignore.match_file(filepath) + def is_yaml_file(self, filepath): + return self.yaml_files.match_file(filepath) + def enabled_rules(self, filepath): return [yamllint.rules.get(id) for id, val in self.rules.items() if val is not False and ( @@ -96,6 +102,15 @@ class YamlLintConfig(object): self.ignore = pathspec.PathSpec.from_lines( 'gitwildmatch', conf['ignore'].splitlines()) + if 'yaml-files' in conf: + if not (isinstance(conf['yaml-files'], list) + and all(isinstance(i, str) for i in conf['yaml-files'])): + raise YamlLintConfigError( + 'invalid config: yaml-files ' + 'should be a list of file patterns') + self.yaml_files = pathspec.PathSpec.from_lines('gitwildmatch', + conf['yaml-files']) + def validate(self): for id in self.rules: try: diff --git a/yamllint/linter.py b/yamllint/linter.py index ab46dca..c687f14 100644 --- a/yamllint/linter.py +++ b/yamllint/linter.py @@ -180,7 +180,7 @@ def get_syntax_error(buffer): except yaml.error.MarkedYAMLError as e: problem = LintProblem(e.problem_mark.line + 1, e.problem_mark.column + 1, - 'syntax error: ' + e.problem) + 'syntax error: ' + e.problem + ' (syntax)') problem.level = 'error' return problem @@ -189,6 +189,10 @@ def _run(buffer, conf, filepath): assert hasattr(buffer, '__getitem__'), \ '_run() argument must be a buffer, not a stream' + first_line = next(parser.line_generator(buffer)).content + if re.match(r'^#\s*yamllint disable-file\s*$', first_line): + return + # If the document contains a syntax error, save it and yield it at the # right line syntax_error = get_syntax_error(buffer) diff --git a/yamllint/rules/empty_values.py b/yamllint/rules/empty_values.py index 14bd0e0..bb4982b 100644 --- a/yamllint/rules/empty_values.py +++ b/yamllint/rules/empty_values.py @@ -75,8 +75,8 @@ ID = 'empty-values' TYPE = 'token' CONF = {'forbid-in-block-mappings': bool, 'forbid-in-flow-mappings': bool} -DEFAULT = {'forbid-in-block-mappings': False, - 'forbid-in-flow-mappings': False} +DEFAULT = {'forbid-in-block-mappings': True, + 'forbid-in-flow-mappings': True} def check(conf, token, prev, next, nextnext, context): diff --git a/yamllint/rules/octal_values.py b/yamllint/rules/octal_values.py index 40de39a..f6e80ce 100644 --- a/yamllint/rules/octal_values.py +++ b/yamllint/rules/octal_values.py @@ -66,8 +66,8 @@ ID = 'octal-values' TYPE = 'token' CONF = {'forbid-implicit-octal': bool, 'forbid-explicit-octal': bool} -DEFAULT = {'forbid-implicit-octal': False, - 'forbid-explicit-octal': False} +DEFAULT = {'forbid-implicit-octal': True, + 'forbid-explicit-octal': True} def check(conf, token, prev, next, nextnext, context): diff --git a/yamllint/rules/truthy.py b/yamllint/rules/truthy.py index 3cf058b..7dd778f 100644 --- a/yamllint/rules/truthy.py +++ b/yamllint/rules/truthy.py @@ -101,7 +101,7 @@ from yamllint.linter import LintProblem TRUTHY = ['YES', 'Yes', 'yes', 'NO', 'No', 'no', - 'TRUE', 'True', 'true', + 'TRUE', 'True', 'true', 'FALSE', 'False', 'false', 'ON', 'On', 'on', 'OFF', 'Off', 'off']