Analyzing your content by running Vale from the command line

To analyze your content to see how it aligns with the Red Hat supplementary and IBM style guides, you can run Vale from the command line. You can run Vale on individual files or an entire directory.

Vale analyzes the specified content according to the command options and the style preferences that you have specified in your .vale.ini configuration file.

Prerequisites
  • You’ve installed a recent release Vale on your system.

  • You’ve installed a recent release of Asciidoctor on your system.

  • You’ve configured the .vale.ini file, setting both Packages and BasedOnStyles to RedHat.

  • You’ve gotten the latest vale-at-red-hat style by running the vale sync command.

Procedure
  1. Start a terminal session and go to the content folder containing the files that you want to analyze.

  2. Enter the vale linter command by using the following syntax:

    $ vale <target_file_name> --<option> > <output_file_name>

    Where:

    • <target_file_name> is the name of the content file that you want to analyze. Or use the * wildcard to analyze all files in the current folder.

    • <option> is an option you can use to tailor the alerts or linter output. For more information, see Example use cases for running the Vale command.

    • <output_file_name> is an option that you can append to the command to pipe the output to a specific file instead of at the command line.

Verification

Review the list of suggestions, warnings, and errors that Vale outputs to the command line. See Understanding Vale output.

Example use cases for running the Vale command
  • To verify the style compliance of a file in the current folder called example.adoc, enter:

    $ vale example.adoc
  • To verify the style compliance of all files in the current folder and turn off text wrapping in the command-line output, enter:

    $ vale *.* --no-wrap

    If you are expecting a large quantity of output in the report, use the --no-wrap option to make the results easier to read from the command line.

  • To verify the style compliance of a file named example.adoc and remove suggestions from the output to retrieve warnings and errors, enter:

    $ vale example.adoc --minAlertLevel=warning
  • To verify the style compliance of a file named example.adoc and report errors only, enter:

    $ vale example.adoc --minAlertLevel=error
  • To verify the style compliance of a file named example.adoc and output errors only into a file in JSON format, enter:

    $ vale example.adoc --minAlertLevel=error --output="JSON" | tee ~/test.json
  • To verify the style compliance of a file named example.adoc and output errors only into a file in JSON format, enter:

  • To get help including a list of valid options for running Vale, enter:

    $ vale --help
Additional resources

Using Vale in the IDE.