This repository is the home of the Couchbase Style Guide, translated into Vale format!
To get started with the Vale Style guide, you need to:
To install Vale:
-
Install a package manager:
- On Windows: Chocolatey
- On Mac: Homebrew
- On GNU/Linux: Don't use the Snap package manager. Download the precompiled binary of Vale.
-
Open a terminal application with administrator permissions.
-
Follow the instructions at Vale.sh for your platform.
The package manager does all of the heavy lifting to install Vale. If you receive a prompt to run additional scripts from your terminal, approve it.
This repository contains a .vale.ini
file that contains everything you need to get started. This file contains all of the necessary configuration for Vale to lint your text files.
Make a couple changes to make sure your Vale installation pulls your styles from the correct location:
-
In your file explorer, move the
.vale.ini
from this repository to your$HOME
directory:- On Windows:
C:\Users\<yourusername>
- On Mac:
/Users/<yourusername>
- On Linux: the location of the
$HOME
directory varies based on your specific Linux distribution.
- On Windows:
-
Open the
.vale.ini
file in a text editor. -
Set the
StylesPath
to the location of theValeStyles
folder in this repository. For example,C:\Users\<yourusername>\GitHub\cb-vale-style-guide\ValeStyles
To use Vale with AsciiDoc on Windows, you need to install Ruby before you can install AsciiDoctor.
For all other systems, you can just install the AsciiDoctor package on your computer.
- In a terminal window, run:
choco install ruby
- Then:
gem install asciidoctor
- In a terminal window, run:
brew install asciidoctor
Consult the AsciiDoctor Docs for details based on your specific distribution's package manager.
After you've done all the setup, you're ready to lint some files!
-
Open the file or folder's location on your filesystem in a terminal window.
-
Run
vale <FileName>
orvale <FolderName>
.
Tip: If you want Vale to print to a file that you can review later, add > <outputFileName>.txt
to the end of your Vale command.
Vale generates a report that provides the following information:
- If you ran Vale on a folder, the name of the file where Vale found the following list of issues.
- The line number and character/column number where Vale found an issue.
- The severity of the issue: Suggestion, Warning, or Error.
- The description of why Vale flagged the issue.
- The location of the YAML file that flagged the issue, written as
<FolderName>.<FileName>
.
If you run into issues linting a folder:
- Check your
.vale.ini
to see what file types Vale lints. If you see a [*] above theBasedOnStyles
setting, Vale lints all file types. Enter a file type (.adoc
, for example) to change the scope. - Change the folder to limit the scope of the files you want Vale to lint.
You can also get live feedback from the Vale VSCode extension:
- Click Extensions
- Search for Vale VSCode (by Chris Chinchilla)
- Click Install
- Click the gear and go to Extension Settings
- In Config, input the path to your .vale.ini:
- Mac:
/Users/<yourusername>/.vale.ini
- Windows:
C:\Users\<yourusername>\.vale.ini
- Mac:
- (Optional) Find the path to the Vale.exe and add it in the Path field:
- Mac:
/usr/local/bin/vale
- Windows:
C:\ProgramData\chocolatey\lib\vale\tools\vale.exe
- Mac:
Note The linter only updates when the you save the file. You can go to File and select Auto Save to have VSCode automatically save files as you are typing. Be aware that this setting applies globally, and may have side-effects elsewhere.
To tweak the existing styles, open any .yml
file in a text editor and make your changes.
Vale uses Go-based RegEx. If you need help to write a RegEx pattern, use a site like regex101.com to learn syntax and test your patterns.
If you have a specific term like a page or product name that must be spelled the same and appear the same way everywhere, add it to the Vocab files:
- Go to
ValeStyles\Vocab\Couchbase Docs
. - Do one of the following:
- To add a word or phrase that Vale should never flag as incorrect in any other rule, modify the
accept.txt
file. - To add a word or phrase that Vale should always reject that isn't yet covered by another rule, modify the
reject.txt
file.
- To add a word or phrase that Vale should never flag as incorrect in any other rule, modify the
Keep the following in mind:
- Add only a single word or phrase per line to the
accept.txt
orreject.txt
. - If multiple spellings for your word or phrase are correct, make sure that you add them with RegEx to the
accept.txt
. Otherwise, Vale flags any spellings or capitalization styles that don't exactly match what's present in the file. - If your word or phrase includes punctuation or other characters that are a part of RegEx syntax, make sure you escape them with a backslash (\). Otherwise, Vale breaks.