ValeConfigurationEffective
The ValeConfigurationEffective class does something.
4 minute read
Definition
Source Code
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
using module ./ValeConfigurationIgnore.psm1
using module ./ValeConfigurationFormatTypeAssociation.psm1
using module ./ValeConfigurationFormatLanguageAssociation.psm1
using module ./ValeConfigurationFormatTransform.psm1
using module ../Enums/ValeAlertLevel.psm1
class ValeConfigurationEffective {
[ValeConfigurationIgnore[]]
$BlockIgnores
[string[]]
$Checks
[ValeConfigurationFormatTypeAssociation[]]
$FormatTypeAssociations
[hashtable]
$AsciidoctorAttributes # A set of key-value pairs for `Asciidoctor` attributes
[ValeConfigurationFormatLanguageAssociation[]]
$FormatLanguageAssociations
[string[]]
$GlobalBaseStyles # Maps to `GBaseStyles`
[hashtable]
$GlobalChecks # Maps to `GChecks`
[string[]]
$IgnoredClasses
[string[]]
$IgnoredScopes
[ValeAlertLevel]
$MinimumAlertLevel # Maps to `MinAlertLevel`
[string[]]
$Vocabularies
[hashtable]
$RuleToLevel
[hashtable]
$SyntaxBaseStyles # Maps to `SBaseStyles`
[hashtable]
$SyntaxChecks # Maps to `SChecks`
[string[]]
$SkippedScopes
[ValeConfigurationFormatTransform[]]
$FormatTransformationStylesheets
[string]
$StylesPath
[ValeConfigurationIgnore[]]
$TokenIgnores
[string]
$WordTemplate
[string]
$RootIniPath
[string]
$DictionaryPath
[string]
$NlpEndpoint
ValeConfigurationEffective() {}
ValeConfigurationEffective([hashtable]$Info) {
$Info.BlockIgnores.GetEnumerator() | ForEach-Object -Process {
$this.BlockIgnores += [ValeConfigurationIgnore]@{
GlobPattern = $_.Key
IgnorePatterns = $_.Value
}
}
$this.Checks = $Info.Checks
$Info.Formats.GetEnumerator() | ForEach-Object -Process {
$this.FormatTypeAssociations += [ValeConfigurationFormatTypeAssociation]@{
ActualFormat = $_.Key
EffectiveFormat = $_.Value
}
}
$this.AsciidoctorAttributes = $Info.Asciidoctor
$Info.FormatToLang.GetEnumerator() | ForEach-Object -Process {
$this.FormatLanguageAssociations += [ValeConfigurationFormatLanguageAssociation]@{
GlobPattern = $_.Key
LanguageID = $_.Value
}
}
$this.GlobalBaseStyles = $Info.GBaseStyles
$this.GlobalChecks = $Info.GChecks
$this.IgnoredClasses = $Info.IgnoredClasses
$this.IgnoredScopes = $Info.IgnoredScopes
$this.MinimumAlertLevel = [ValeAlertLevel]($Info.MinAlertLevel)
$this.Vocabularies = $Info.Vocab
$this.SyntaxBaseStyles = $Info.SBaseStyles
$this.SyntaxChecks = $Info.SChecks
$this.SkippedScopes = $Info.SkippedScopes
$Info.Stylesheets.GetEnumerator() | ForEach-Object -Process {
$this.FormatTransformationStylesheets += [ValeConfigurationFormatTransform]@{
GlobPattern = $_.Key
Path = $_.Value
}
}
$this.StylesPath = $Info.StylesPath
$Info.TokenIgnores.GetEnumerator() | ForEach-Object -Process {
$this.TokenIgnores += [ValeConfigurationIgnore]@{
GlobPattern = $_.Key
IgnorePatterns = $_.Value
}
}
$this.WordTemplate = $Info.WordTemplate
$this.RootIniPath = $Info.RootINI
$this.DictionaryPath = $Info.DictionaryPath
$this.NlpEndpoint = $Info.NLPEndpoint
}
}
An instance of the ValeConfigurationEffective class represents the effective configuration for
Vale as returned by the Get-ValeConfiguration
command.
Examples
1. Reviewing the effective configuration for Vale in a workspace
Get-ValeConfiguration -OutVariable c
$c | Format-List
RootIniPath StylesPath MinimumAlertLevel GlobalBaseStyles Vocabularies
----------- ---------- ----------------- ---------------- ------------
C:\code\pwsh\Documentarian/.vale.ini C:/code/pwsh/Documentarian/.vscode/styles Suggestion {PowerShell-Docs} {Base}
BlockIgnores :
Checks : {PowerShell-Docs.Passive, Vale.Spelling, PowerShell-Docs.Passive, Vale.Spelling…}
FormatTypeAssociations : {ValeConfigurationFormatTypeAssociation}
AsciidoctorAttributes : {}
FormatLanguageAssociations :
GlobalBaseStyles : {PowerShell-Docs}
GlobalChecks : {[PowerShell-Docs.Passive, False], [Vale.Spelling, False]}
IgnoredClasses :
IgnoredScopes :
MinimumAlertLevel : Suggestion
Vocabularies : {Base}
RuleToLevel :
SyntaxBaseStyles : {[*.md, System.Object[]]}
SyntaxChecks : {[*.md, System.Management.Automation.OrderedHashtable]}
SkippedScopes :
FormatTransformationStylesheets :
StylesPath : C:/code/pwsh/Documentarian/.vscode/styles
TokenIgnores :
WordTemplate :
RootIniPath : C:\code\pwsh\Documentarian/.vale.ini
DictionaryPath :
NlpEndpoint :
Constructors
ValeConfigurationEffective()
- Initializes a new instance of the ValeConfigurationEffective class.
ValeConfigurationEffective(System.Management.Automation.OrderedHashtable)
- Initializes a new instance of the ValeConfigurationEffective class from the output of the
vale ls-config
command.
Properties
- AsciidoctorAttributes
- Represents a set of key-value pairs to use when processing AsciiDoc files.
- BlockIgnores
- Represents a set of patterns Vale ignores when processing block-level sections of text that don’t have an associated HTML tag.
- Checks
- Represents the full list of checks for Vale to use when linting prose.
- DictionaryPath
- Represents the path to the folder that contains dictionaries for Vale to use when checking spelling.
- FormatLanguageAssociations
- Represents a set of file formats to use a specified language for when checking spelling.
- FormatTransformationStylesheets
- Represents a set of file pattern associations for Vale to transform with a specific XSLT before linting their prose.
- FormatTypeAssociations
- Represents a set of file formats to treat as a different type when linting their prose.
- GlobalBaseStyles
- Represents the set of Vale styles to apply when linting prose, regardless of the file’s syntax.
- GlobalChecks
- Represents the set of specific checks and their setting for Vale to use when linting prose, regardless of the file’s syntax.
- IgnoredClasses
- Represents a list of classes to identify HTML elements for Vale to ignore when linting prose.
- IgnoredScopes
- Represents a list of inline HTML tags for Vale to ignore when linting prose.
- MinimumAlertLevel
- Represents the minimum severity of the checks for Vale to report failures for when linting prose.
- NlpEndpoint
- Represents the URL to an natural language processing (NLP) service for Vale to use when linting prose.
- RootIniPath
- Represents the file path to the root configuration file for Vale.
- RuleToLevel
- Represents a set of rules for Vale to override with their specified setting.
- SkippedScopes
- Represents a list of block-level HTML tags for Vale to ignore when linting prose.
- StylesPath
- Represents the path to folder that contains the styles for Vale to use when linting prose.
- SyntaxBaseStyles
- Represents a set of file patterns for specific markup syntaxes and base styles for Vale to use with those files when linting their prose.
- SyntaxChecks
- Represents a set of file patterns for specific markup syntaxes and the specific checks for Vale to apply when linting their prose.
- TokenIgnores
- Represents a set of patterns Vale ignores when processing inline text that doesn’t have an associated HTML tag.
- Vocabularies
- Represents the set of custom vocabularies for Vale to use when checking spelling.
- WordTemplate
- Represents the pattern for Vale to use when parsing a file to find individual words.
Last modified March 10, 2023: (GH-71) Document Vale classes (ad1e42a)