mbarre / yamlfixer

Automates the fixing of problems reported by yamllint by parsing its output

Home Page:https://github.com/opt-nc/yamlfixer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yamlfixer

yamlfixer automates the fixing of problems reported by yamllint by parsing its output.

Prerequisites

In order for it to work, yamlfixer needs that the following utilities are already installed on your system, in a directory present in your $PATH :

  • Python v3.6 or higher
  • yamllint v1.26.3 or higher

Then simply copy the yamlfixer file to a directory present in your $PATH, and ensure it is executable, for example:

cp yamlfixer /usr/local/bin
chmod 0755 /usr/local/bin/yamlfixer

Usage

This software automatically fixes some errors and warnings reported by yamllint.

usage:

$ yamlfixer [--debug] [--verbose] [--backup] *.yml - thisfile.yaml

or:

$ yamlfixer [--help] [--version]

This will launch yamllint on each specified file name (- is stdin), then parse its output and try to fix the reported problems.

If input is read from stdin, the corrected output will be sent to stdout. Other files will be overwritten if needed. Original files, stdin excepted, can be preserved as .orig if the --backup command line option is used.

Diagnostic information is sent to stderr in verbose or debug modes.

This command exits with 0 if all input files either are skipped or successfully pass yamllint strict mode, else -1.

IMPORTANT: Not all problems are fixable by yamlfixer. Due to the way yamllint works, it doesn't currenlty report all faulty lines, yamlfixer might even introduce indentation problems under some circumstances. Use at your own risk, you have been warned...

Licensing information

Copyright (C) 2021 OPT-NC

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Contact

OPT-NC, aka Office des Postes et Télécommunications de Nouvelle-Calédonie, has a corporate website on www.opt.nc

You can contact the author of this software at jerome.alet@opt.nc

About

Automates the fixing of problems reported by yamllint by parsing its output

https://github.com/opt-nc/yamlfixer

License:GNU General Public License v3.0


Languages

Language:Python 100.0%