arm-ttk
arm-ttk documentation
- Visit Official Web Site
- See How to configure arm-ttk rules
- If custom
.arm-ttk.psd1
config file is not found, .arm-ttk.psd1 will be used
- If custom
Configuration in MegaLinter
- Enable arm-ttk by adding
ARM_ARM_TTK
in ENABLE_LINTERS variable - Disable arm-ttk by adding
ARM_ARM_TTK
in DISABLE_LINTERS variable
Variable | Description | Default value |
---|---|---|
ARM_ARM_TTK_ARGUMENTS | User custom arguments to add in linter CLI call Ex: -s --foo "bar" |
|
ARM_ARM_TTK_FILTER_REGEX_INCLUDE | Custom regex including filter Ex: (src\|lib) |
Include every file |
ARM_ARM_TTK_FILTER_REGEX_EXCLUDE | Custom regex excluding filter Ex: (test\|examples) |
Exclude no file |
ARM_ARM_TTK_CLI_LINT_MODE | Override default CLI lint mode - file : Calls the linter for each file- list_of_files : Call the linter with the list of files as argument- project : Call the linter from the root of the project |
file |
ARM_ARM_TTK_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".py", ""] |
[".json"] |
ARM_ARM_TTK_FILE_NAMES_REGEX | File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files Ex: ["Dockerfile(-.+)?", "Jenkinsfile"] |
Include every file |
ARM_ARM_TTK_PRE_COMMANDS | List of bash commands to run before the linter | None |
ARM_ARM_TTK_POST_COMMANDS | List of bash commands to run after the linter | None |
ARM_ARM_TTK_CONFIG_FILE | arm-ttk configuration file nameUse LINTER_DEFAULT to let the linter find it |
.arm-ttk.psd1 |
ARM_ARM_TTK_RULES_PATH | Path where to find linter configuration file | Workspace folder, then MegaLinter default rules |
ARM_ARM_TTK_DISABLE_ERRORS | Run linter but consider errors as warnings | false |
ARM_ARM_TTK_DISABLE_ERRORS_IF_LESS_THAN | Maximum number of errors allowed | 0 |
IDE Integration
Use arm-ttk in your favorite IDE to catch errors before MegaLinter !
IDE | Extension Name | Install | |
---|---|---|---|
Visual Studio Code | ARMTTKExtension |
MegaLinter Flavours
This linter is available in the following flavours
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default MegaLinter Flavor | 101 | ||
dotnet | Optimized for C, C++, C# or VB based projects | 50 |
Behind the scenes
How are identified applicable files
- File extensions:
.json
- Detected file content (regex):
schema\.management\.azure\.com
How the linting is performed
- arm-ttk is called one time by identified file
Example calls
pwsh -NoProfile -NoLogo -Command "
Import-Module /usr/bin/arm-ttk;
Test-AzTemplate -TemplatePath myfile.json;
if (${Error}.Count) {exit 1}"
"
"pwsh -NoProfile -NoLogo -Command "
Import-Module /usr/bin/arm-ttk;
${config} = $(Import-PowerShellDataFile -Path ".arm-ttk.psd1");
Test-AzTemplate @config -TemplatePath myfile.json;
if (${Error}.Count) {exit 1}
"
Help content
[91mTest-AzTemplate:
[96mLine |
[96m 2 | [0m $TAZ_V = (Test-AzTemplate [96m-help[0m);
[96m | [91m ~~~~~
[91m[96m | [91mA parameter cannot be found that matches parameter name 'help'.[0m
Installation on mega-linter Docker image
- Dockerfile commands :
# Parent descriptor install
ARG PWSH_VERSION='latest'
ARG PWSH_DIRECTORY='/opt/microsoft/powershell'
RUN mkdir -p ${PWSH_DIRECTORY} \
&& curl --retry 5 --retry-delay 5 -s https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \
| grep browser_download_url \
| grep linux-alpine-x64 \
| cut -d '"' -f 4 \
| xargs -n 1 wget -O - \
| tar -xzC ${PWSH_DIRECTORY} \
&& ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh
# Linter install
ARG ARM_TTK_NAME='master.zip'
ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip'
ARG ARM_TTK_DIRECTORY='/opt/microsoft'
ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1"
RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \
&& unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \
&& rm "${ARM_TTK_NAME}" \
&& ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \
&& chmod a+x /usr/bin/arm-ttk