yamlint 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +31 -9
- data/.serena/.gitignore +1 -0
- data/.serena/memories/project_overview.md +25 -0
- data/.serena/memories/style_and_conventions.md +7 -0
- data/.serena/memories/suggested_commands.md +17 -0
- data/.serena/memories/task_completion.md +5 -0
- data/.serena/project.yml +89 -0
- data/CHANGELOG.md +6 -2
- data/Gemfile +9 -7
- data/LICENSE.txt +1 -1
- data/README.md +155 -17
- data/Rakefile +10 -3
- data/docs/Yamlint/Cli.html +403 -0
- data/docs/Yamlint/Config.html +1034 -0
- data/docs/Yamlint/Formatter.html +433 -0
- data/docs/Yamlint/Linter.html +423 -0
- data/docs/Yamlint/Models/LintContext.html +993 -0
- data/docs/Yamlint/Models/Problem.html +951 -0
- data/docs/Yamlint/Models/Token.html +713 -0
- data/docs/Yamlint/Models.html +117 -0
- data/docs/Yamlint/Output/Base.html +290 -0
- data/docs/Yamlint/Output/Colored.html +293 -0
- data/docs/Yamlint/Output/Github.html +260 -0
- data/docs/Yamlint/Output/Parsable.html +258 -0
- data/docs/Yamlint/Output/Standard.html +270 -0
- data/docs/Yamlint/Output.html +208 -0
- data/docs/Yamlint/Parser/Comment.html +795 -0
- data/docs/Yamlint/Parser/CommentExtractor.html +287 -0
- data/docs/Yamlint/Parser/LineParser.html +423 -0
- data/docs/Yamlint/Parser/TokenParser/Handler.html +910 -0
- data/docs/Yamlint/Parser/TokenParser.html +291 -0
- data/docs/Yamlint/Parser.html +117 -0
- data/docs/Yamlint/Presets.html +266 -0
- data/docs/Yamlint/Rules/Anchors/AnchorHandler.html +678 -0
- data/docs/Yamlint/Rules/Anchors.html +314 -0
- data/docs/Yamlint/Rules/Base.html +968 -0
- data/docs/Yamlint/Rules/Braces.html +335 -0
- data/docs/Yamlint/Rules/Brackets.html +335 -0
- data/docs/Yamlint/Rules/Colons.html +313 -0
- data/docs/Yamlint/Rules/Commas.html +313 -0
- data/docs/Yamlint/Rules/CommentRule.html +298 -0
- data/docs/Yamlint/Rules/Comments.html +317 -0
- data/docs/Yamlint/Rules/CommentsIndentation.html +328 -0
- data/docs/Yamlint/Rules/DocumentEnd.html +332 -0
- data/docs/Yamlint/Rules/DocumentStart.html +332 -0
- data/docs/Yamlint/Rules/EmptyLines.html +300 -0
- data/docs/Yamlint/Rules/EmptyValues.html +273 -0
- data/docs/Yamlint/Rules/FloatValues.html +383 -0
- data/docs/Yamlint/Rules/Hyphens.html +337 -0
- data/docs/Yamlint/Rules/Indentation.html +329 -0
- data/docs/Yamlint/Rules/KeyDuplicates/DuplicateKeyHandler.html +716 -0
- data/docs/Yamlint/Rules/KeyDuplicates.html +258 -0
- data/docs/Yamlint/Rules/KeyOrdering/KeyOrderHandler.html +694 -0
- data/docs/Yamlint/Rules/KeyOrdering.html +258 -0
- data/docs/Yamlint/Rules/LineLength.html +251 -0
- data/docs/Yamlint/Rules/LineRule.html +304 -0
- data/docs/Yamlint/Rules/NewLineAtEndOfFile.html +308 -0
- data/docs/Yamlint/Rules/NewLines.html +310 -0
- data/docs/Yamlint/Rules/OctalValues.html +270 -0
- data/docs/Yamlint/Rules/QuotedStrings.html +381 -0
- data/docs/Yamlint/Rules/Registry.html +492 -0
- data/docs/Yamlint/Rules/TokenRule.html +298 -0
- data/docs/Yamlint/Rules/TrailingSpaces.html +321 -0
- data/docs/Yamlint/Rules/Truthy.html +288 -0
- data/docs/Yamlint/Rules.html +190 -0
- data/docs/Yamlint/Runner.html +551 -0
- data/docs/Yamlint.html +135 -0
- data/docs/_index.html +643 -0
- data/docs/class_list.html +54 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +490 -0
- data/docs/file.README.html +276 -0
- data/docs/file_list.html +59 -0
- data/docs/frames.html +22 -0
- data/docs/index.html +276 -0
- data/docs/js/app.js +395 -0
- data/docs/js/full_list.js +244 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1582 -0
- data/docs/top-level-namespace.html +110 -0
- data/exe/yamlint +7 -0
- data/lib/yamlint/cli.rb +162 -0
- data/lib/yamlint/config.rb +113 -0
- data/lib/yamlint/formatter.rb +140 -0
- data/lib/yamlint/linter.rb +130 -0
- data/lib/yamlint/models/lint_context.rb +43 -0
- data/lib/yamlint/models/problem.rb +44 -0
- data/lib/yamlint/models/token.rb +22 -0
- data/lib/yamlint/models.rb +9 -0
- data/lib/yamlint/output/base.rb +15 -0
- data/lib/yamlint/output/colored.rb +54 -0
- data/lib/yamlint/output/github.rb +20 -0
- data/lib/yamlint/output/parsable.rb +19 -0
- data/lib/yamlint/output/standard.rb +25 -0
- data/lib/yamlint/output.rb +26 -0
- data/lib/yamlint/parser/comment_extractor.rb +78 -0
- data/lib/yamlint/parser/line_parser.rb +30 -0
- data/lib/yamlint/parser/token_parser.rb +92 -0
- data/lib/yamlint/parser.rb +10 -0
- data/lib/yamlint/presets/default.rb +35 -0
- data/lib/yamlint/presets/relaxed.rb +34 -0
- data/lib/yamlint/presets.rb +19 -0
- data/lib/yamlint/rules/anchors.rb +133 -0
- data/lib/yamlint/rules/base.rb +102 -0
- data/lib/yamlint/rules/braces.rb +105 -0
- data/lib/yamlint/rules/brackets.rb +105 -0
- data/lib/yamlint/rules/colons.rb +73 -0
- data/lib/yamlint/rules/commas.rb +85 -0
- data/lib/yamlint/rules/comments.rb +77 -0
- data/lib/yamlint/rules/comments_indentation.rb +66 -0
- data/lib/yamlint/rules/document_end.rb +45 -0
- data/lib/yamlint/rules/document_start.rb +45 -0
- data/lib/yamlint/rules/empty_lines.rb +107 -0
- data/lib/yamlint/rules/empty_values.rb +43 -0
- data/lib/yamlint/rules/float_values.rb +67 -0
- data/lib/yamlint/rules/hyphens.rb +42 -0
- data/lib/yamlint/rules/indentation.rb +39 -0
- data/lib/yamlint/rules/key_duplicates.rb +127 -0
- data/lib/yamlint/rules/key_ordering.rb +126 -0
- data/lib/yamlint/rules/line_length.rb +57 -0
- data/lib/yamlint/rules/new_line_at_end_of_file.rb +31 -0
- data/lib/yamlint/rules/new_lines.rb +59 -0
- data/lib/yamlint/rules/octal_values.rb +62 -0
- data/lib/yamlint/rules/quoted_strings.rb +73 -0
- data/lib/yamlint/rules/registry.rb +48 -0
- data/lib/yamlint/rules/trailing_spaces.rb +31 -0
- data/lib/yamlint/rules/truthy.rb +48 -0
- data/lib/yamlint/rules.rb +41 -0
- data/lib/yamlint/runner.rb +80 -0
- data/lib/yamlint/version.rb +1 -1
- data/lib/yamlint.rb +11 -3
- metadata +131 -11
- data/CODE_OF_CONDUCT.md +0 -84
- data/sig/yamlint.rbs +0 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30f54142723326b9a7faf55cbe53f35c515f9f1465ab237bb172594abf1dff83
|
|
4
|
+
data.tar.gz: 8ef8637b0a0d7f92f1782d6be1afc96be22fd5009f0cba0066a835566e75f332
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 265a6207b6254d8f996564887f86d40a66f51a34437e6c7971e7bfedeedd971b93cd1c9297cb753ccecda7fadf10cb9234b1bc9fef78d88a8354bc3c1d852c7f
|
|
7
|
+
data.tar.gz: dc1d831da8b73704d3f3afaae658d8599c140060751d683e6a25168dc265cc7f882f7d2464559b2b04f85240761a8b09dddfc78580e237a11731adc45006ecf2
|
data/.rubocop.yml
CHANGED
|
@@ -1,13 +1,35 @@
|
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-performance
|
|
3
|
+
- rubocop-rake
|
|
4
|
+
- rubocop-rspec
|
|
5
|
+
|
|
1
6
|
AllCops:
|
|
2
|
-
|
|
7
|
+
NewCops: enable
|
|
8
|
+
TargetRubyVersion: 3.1
|
|
9
|
+
|
|
10
|
+
Metrics:
|
|
11
|
+
Enabled: false
|
|
12
|
+
|
|
13
|
+
RSpec/ExampleLength:
|
|
14
|
+
Enabled: false
|
|
15
|
+
|
|
16
|
+
RSpec/ImplicitSubject:
|
|
17
|
+
Enabled: false
|
|
18
|
+
|
|
19
|
+
RSpec/NamedSubject:
|
|
20
|
+
Enabled: false
|
|
21
|
+
|
|
22
|
+
Style/Documentation:
|
|
23
|
+
Enabled: false
|
|
3
24
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
EnforcedStyle: double_quotes
|
|
25
|
+
RSpec/MultipleExpectations:
|
|
26
|
+
Max: 2
|
|
7
27
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
EnforcedStyle: double_quotes
|
|
28
|
+
RSpec/NestedGroups:
|
|
29
|
+
Max: 4
|
|
11
30
|
|
|
12
|
-
|
|
13
|
-
|
|
31
|
+
RSpec/SpecFilePathFormat:
|
|
32
|
+
Exclude:
|
|
33
|
+
- '**/spec/routing/**/*'
|
|
34
|
+
- 'spec/yamlint/parser/comment_extractor_spec.rb'
|
|
35
|
+
- 'spec/yamlint/rules/base_spec.rb'
|
data/.serena/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/cache
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# yamlint project overview
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
- Pure-Ruby YAML linter and formatter, inspired by Python's `adrienverge/yamllint`.
|
|
5
|
+
- Provides CLI linting and auto-fix formatting with yamllint-compatible config intent.
|
|
6
|
+
|
|
7
|
+
## Tech stack
|
|
8
|
+
- Ruby gem (Ruby >= 3.1; `.ruby-version` is 3.4.8).
|
|
9
|
+
- Testing: RSpec.
|
|
10
|
+
- Linting: RuboCop (+ performance/rake/rspec plugins).
|
|
11
|
+
|
|
12
|
+
## Rough structure
|
|
13
|
+
- `lib/yamlint/`: core implementation
|
|
14
|
+
- `cli.rb`, `runner.rb`: CLI entry logic
|
|
15
|
+
- `linter.rb`, `formatter.rb`, `config.rb`
|
|
16
|
+
- `parser/`, `rules/`, `models/`, `output/`, `presets/`
|
|
17
|
+
- `exe/yamlint`: gem executable entrypoint
|
|
18
|
+
- `bin/`: developer scripts (`setup`, `console`, `checker`)
|
|
19
|
+
- `spec/`: RSpec test suite
|
|
20
|
+
- `docs/`: generated documentation
|
|
21
|
+
- `yamlint.gemspec`, `Gemfile`, `Rakefile`: gem/build config
|
|
22
|
+
|
|
23
|
+
## Architecture notes
|
|
24
|
+
Design doc (`ruby_yamllint_design_and_instructions.md`) describes layered architecture:
|
|
25
|
+
CLI -> core (linter/formatter/config) -> rules registry -> parser -> models.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Style and conventions
|
|
2
|
+
|
|
3
|
+
- Ruby codebase with `# frozen_string_literal: true` headers.
|
|
4
|
+
- RuboCop enabled (plugins: performance, rake, rspec); metrics cops disabled; documentation cop disabled.
|
|
5
|
+
- RSpec used for tests; no strict example length/subject cops.
|
|
6
|
+
- Target Ruby version in RuboCop: 3.1; project `.ruby-version` is 3.4.8.
|
|
7
|
+
- Standard Ruby gem layout and naming under `lib/yamlint`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Suggested commands
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
- `bin/setup` (install dependencies)
|
|
5
|
+
|
|
6
|
+
## Tests
|
|
7
|
+
- `bundle exec rake spec`
|
|
8
|
+
- `bundle exec rake` (default runs `spec` and `rubocop`)
|
|
9
|
+
|
|
10
|
+
## Linting
|
|
11
|
+
- `bundle exec rubocop`
|
|
12
|
+
- `bundle exec rake rubocop`
|
|
13
|
+
|
|
14
|
+
## Run CLI / console
|
|
15
|
+
- `bundle exec exe/yamlint ...` (gem executable)
|
|
16
|
+
- `bin/console` (interactive)
|
|
17
|
+
- `bin/checker <files...>` (simple YAML load checker)
|
data/.serena/project.yml
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# list of languages for which language servers are started; choose from:
|
|
2
|
+
# al bash clojure cpp csharp
|
|
3
|
+
# csharp_omnisharp dart elixir elm erlang
|
|
4
|
+
# fortran fsharp go groovy haskell
|
|
5
|
+
# java julia kotlin lua markdown
|
|
6
|
+
# matlab nix pascal perl php
|
|
7
|
+
# powershell python python_jedi r rego
|
|
8
|
+
# ruby ruby_solargraph rust scala swift
|
|
9
|
+
# terraform toml typescript typescript_vts vue
|
|
10
|
+
# yaml zig
|
|
11
|
+
# (This list may be outdated. For the current list, see values of Language enum here:
|
|
12
|
+
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
|
|
13
|
+
# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
|
|
14
|
+
# Note:
|
|
15
|
+
# - For C, use cpp
|
|
16
|
+
# - For JavaScript, use typescript
|
|
17
|
+
# - For Free Pascal/Lazarus, use pascal
|
|
18
|
+
# Special requirements:
|
|
19
|
+
# - csharp: Requires the presence of a .sln file in the project folder.
|
|
20
|
+
# - pascal: Requires Free Pascal Compiler (fpc) and optionally Lazarus.
|
|
21
|
+
# When using multiple languages, the first language server that supports a given file will be used for that file.
|
|
22
|
+
# The first language is the default language and the respective language server will be used as a fallback.
|
|
23
|
+
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
|
|
24
|
+
languages:
|
|
25
|
+
- ruby
|
|
26
|
+
|
|
27
|
+
# the encoding used by text files in the project
|
|
28
|
+
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
|
|
29
|
+
encoding: "utf-8"
|
|
30
|
+
|
|
31
|
+
# whether to use project's .gitignore files to ignore files
|
|
32
|
+
ignore_all_files_in_gitignore: true
|
|
33
|
+
|
|
34
|
+
# list of additional paths to ignore in all projects
|
|
35
|
+
# same syntax as gitignore, so you can use * and **
|
|
36
|
+
ignored_paths: []
|
|
37
|
+
|
|
38
|
+
# whether the project is in read-only mode
|
|
39
|
+
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
|
|
40
|
+
# Added on 2025-04-18
|
|
41
|
+
read_only: false
|
|
42
|
+
|
|
43
|
+
# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
|
|
44
|
+
# Below is the complete list of tools for convenience.
|
|
45
|
+
# To make sure you have the latest list of tools, and to view their descriptions,
|
|
46
|
+
# execute `uv run scripts/print_tool_overview.py`.
|
|
47
|
+
#
|
|
48
|
+
# * `activate_project`: Activates a project by name.
|
|
49
|
+
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
|
|
50
|
+
# * `create_text_file`: Creates/overwrites a file in the project directory.
|
|
51
|
+
# * `delete_lines`: Deletes a range of lines within a file.
|
|
52
|
+
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
|
|
53
|
+
# * `execute_shell_command`: Executes a shell command.
|
|
54
|
+
# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
|
|
55
|
+
# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
|
|
56
|
+
# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
|
|
57
|
+
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
|
|
58
|
+
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
|
|
59
|
+
# * `initial_instructions`: Gets the initial instructions for the current project.
|
|
60
|
+
# Should only be used in settings where the system prompt cannot be set,
|
|
61
|
+
# e.g. in clients you have no control over, like Claude Desktop.
|
|
62
|
+
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
|
|
63
|
+
# * `insert_at_line`: Inserts content at a given line in a file.
|
|
64
|
+
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
|
|
65
|
+
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
|
|
66
|
+
# * `list_memories`: Lists memories in Serena's project-specific memory store.
|
|
67
|
+
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
|
|
68
|
+
# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
|
|
69
|
+
# * `read_file`: Reads a file within the project directory.
|
|
70
|
+
# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
|
|
71
|
+
# * `remove_project`: Removes a project from the Serena configuration.
|
|
72
|
+
# * `replace_lines`: Replaces a range of lines within a file with new content.
|
|
73
|
+
# * `replace_symbol_body`: Replaces the full definition of a symbol.
|
|
74
|
+
# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
|
|
75
|
+
# * `search_for_pattern`: Performs a search for a pattern in the project.
|
|
76
|
+
# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
|
|
77
|
+
# * `switch_modes`: Activates modes by providing a list of their names
|
|
78
|
+
# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
|
|
79
|
+
# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
|
|
80
|
+
# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
|
|
81
|
+
# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
|
|
82
|
+
excluded_tools: []
|
|
83
|
+
|
|
84
|
+
# initial prompt for the project. It will always be given to the LLM upon activating the project
|
|
85
|
+
# (contrary to the memories, which are loaded on demand).
|
|
86
|
+
initial_prompt: ""
|
|
87
|
+
|
|
88
|
+
project_name: "yamlint"
|
|
89
|
+
included_optional_tools: []
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
source
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
# Specify your gem's dependencies in yamlint.gemspec
|
|
6
5
|
gemspec
|
|
7
6
|
|
|
8
|
-
gem
|
|
9
|
-
|
|
10
|
-
gem
|
|
11
|
-
|
|
12
|
-
gem
|
|
7
|
+
gem 'rake'
|
|
8
|
+
gem 'rdoc'
|
|
9
|
+
gem 'rspec'
|
|
10
|
+
gem 'rubocop'
|
|
11
|
+
gem 'rubocop-performance'
|
|
12
|
+
gem 'rubocop-rake'
|
|
13
|
+
gem 'rubocop-rspec'
|
|
14
|
+
gem 'yard'
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,37 +1,175 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">yamlint</h1>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://img.shields.io/badge/ruby-%3E%3D%203.1-ruby.svg" alt="Ruby Version"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"><a href="https://github.com/ydah/yamlint/actions/workflows/test.yml"><img src="https://github.com/ydah/yamlint/actions/workflows/test.yml/badge.svg?branch=main" alt="test"></a><a href="https://badge.fury.io/rb/yamlint"><img src="https://badge.fury.io/rb/yamlint.svg" alt="Gem Version"></a>
|
|
5
|
+
</p>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
A Ruby CLI for linting and formatting YAML files
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="#features">Features</a> •
|
|
13
|
+
<a href="#quickstart">Quickstart</a> •
|
|
14
|
+
<a href="#installation">Installation</a> •
|
|
15
|
+
<a href="#usage">Usage</a> •
|
|
16
|
+
<a href="#configuration">Configuration</a> •
|
|
17
|
+
<a href="#rules">Rules</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- Rule-based linting and auto-formatting
|
|
23
|
+
- Configuration via `.yamllint(.yml/.yaml)` with preset `extends`
|
|
24
|
+
- CI-friendly output formats (standard/parsable/colored/github)
|
|
25
|
+
- YAML file patterns and ignore support
|
|
26
|
+
|
|
27
|
+
## Quickstart
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
gem install yamlint
|
|
31
|
+
|
|
32
|
+
# lint
|
|
33
|
+
yamlint .
|
|
34
|
+
|
|
35
|
+
# format (dry-run)
|
|
36
|
+
yamlint format --dry-run .
|
|
37
|
+
```
|
|
6
38
|
|
|
7
39
|
## Installation
|
|
8
40
|
|
|
9
|
-
|
|
41
|
+
With Bundler:
|
|
10
42
|
|
|
11
|
-
|
|
43
|
+
```bash
|
|
44
|
+
bundle add yamlint
|
|
45
|
+
```
|
|
12
46
|
|
|
13
|
-
|
|
47
|
+
Without Bundler:
|
|
14
48
|
|
|
15
|
-
|
|
49
|
+
```bash
|
|
50
|
+
gem install yamlint
|
|
51
|
+
```
|
|
16
52
|
|
|
17
53
|
## Usage
|
|
18
54
|
|
|
19
|
-
|
|
55
|
+
Basic:
|
|
20
56
|
|
|
21
|
-
|
|
57
|
+
```bash
|
|
58
|
+
yamlint .
|
|
59
|
+
yamlint path/to/file.yml
|
|
60
|
+
```
|
|
22
61
|
|
|
23
|
-
|
|
62
|
+
Formatting:
|
|
24
63
|
|
|
25
|
-
|
|
64
|
+
```bash
|
|
65
|
+
yamlint format .
|
|
66
|
+
yamlint format --dry-run .
|
|
67
|
+
```
|
|
26
68
|
|
|
27
|
-
|
|
69
|
+
CI output:
|
|
28
70
|
|
|
29
|
-
|
|
71
|
+
```bash
|
|
72
|
+
yamlint -f github .
|
|
73
|
+
```
|
|
30
74
|
|
|
31
|
-
|
|
75
|
+
Help:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
yamlint --help
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Configuration
|
|
82
|
+
|
|
83
|
+
Default config file names:
|
|
84
|
+
|
|
85
|
+
- `.yamllint`
|
|
86
|
+
- `.yamllint.yml`
|
|
87
|
+
- `.yamllint.yaml`
|
|
88
|
+
|
|
89
|
+
Configuration options:
|
|
90
|
+
|
|
91
|
+
| Option | Type | Default | Behavior |
|
|
92
|
+
| --- | --- | --- | --- |
|
|
93
|
+
| `extends` | string | none | Inherit a preset (`default` or `relaxed`). Values from the current file override the preset. |
|
|
94
|
+
| `yaml-files` | list of glob strings | `["*.yaml", "*.yml"]` | Glob patterns used when discovering YAML files in directories. |
|
|
95
|
+
| `ignore` | list of strings | `[]` | List of paths to skip. Parsed by the config loader but not currently applied to file discovery. |
|
|
96
|
+
| `rules` | map | `{}` | Per-rule configuration. Set a rule to `disable` or `false` to turn it off, or provide a map of options. |
|
|
97
|
+
|
|
98
|
+
Notes:
|
|
99
|
+
|
|
100
|
+
- Rule option keys accept either `snake_case` or `kebab-case` and are normalized internally.
|
|
101
|
+
- Rule option defaults come from the rule implementation and are merged with your overrides.
|
|
102
|
+
|
|
103
|
+
Example:
|
|
104
|
+
|
|
105
|
+
```yaml
|
|
106
|
+
extends: default
|
|
107
|
+
|
|
108
|
+
yaml-files:
|
|
109
|
+
- "*.yml"
|
|
110
|
+
- "*.yaml"
|
|
32
111
|
|
|
33
|
-
|
|
112
|
+
ignore:
|
|
113
|
+
- vendor
|
|
114
|
+
- node_modules
|
|
34
115
|
|
|
35
|
-
|
|
116
|
+
rules:
|
|
117
|
+
line-length:
|
|
118
|
+
max: 120
|
|
119
|
+
document-start: disable
|
|
120
|
+
truthy:
|
|
121
|
+
allowed-values: ["true", "false"]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Presets
|
|
125
|
+
|
|
126
|
+
Available presets:
|
|
127
|
+
|
|
128
|
+
- `default`
|
|
129
|
+
- `relaxed`
|
|
130
|
+
|
|
131
|
+
```yaml
|
|
132
|
+
extends: relaxed
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Rules
|
|
136
|
+
|
|
137
|
+
Key rules:
|
|
138
|
+
|
|
139
|
+
- anchors, braces, brackets, colons, commas, comments, comments-indentation
|
|
140
|
+
- document-start, document-end, empty-lines, empty-values, float-values
|
|
141
|
+
- hyphens, indentation, key-duplicates, key-ordering, line-length
|
|
142
|
+
- new-lines, new-line-at-end-of-file, octal-values, quoted-strings
|
|
143
|
+
- trailing-spaces, truthy
|
|
144
|
+
|
|
145
|
+
## Output formats
|
|
146
|
+
|
|
147
|
+
Use `-f`/`--format` to select an output format:
|
|
148
|
+
|
|
149
|
+
- `standard`
|
|
150
|
+
- `parsable`
|
|
151
|
+
- `colored`
|
|
152
|
+
- `github`
|
|
153
|
+
|
|
154
|
+
## Development
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
bin/setup
|
|
158
|
+
rake spec
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Install locally:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
bundle exec rake install
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Release:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
bundle exec rake release
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## License
|
|
36
174
|
|
|
37
|
-
|
|
175
|
+
MIT License. See `LICENSE.txt` for details.
|
data/Rakefile
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
4
|
+
require 'rspec/core/rake_task'
|
|
5
|
+
require 'yard'
|
|
6
|
+
require 'yard/rake/yardoc_task'
|
|
5
7
|
|
|
6
8
|
RSpec::Core::RakeTask.new(:spec)
|
|
7
9
|
|
|
8
|
-
require
|
|
10
|
+
require 'rubocop/rake_task'
|
|
9
11
|
|
|
10
12
|
RuboCop::RakeTask.new
|
|
11
13
|
|
|
14
|
+
YARD::Rake::YardocTask.new do |task|
|
|
15
|
+
task.files = ['lib/**/*.rb']
|
|
16
|
+
task.options = ['--output-dir', 'docs']
|
|
17
|
+
end
|
|
18
|
+
|
|
12
19
|
task default: %i[spec rubocop]
|