arm-ttk
arm-ttk documentation
- Visit Official Web Site
- See How to configure arm-ttk rules
- If custom
.arm-ttk.psd1
config file isn't 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_COMMAND_REMOVE_ARGUMENTS | User custom arguments to remove from command line before calling the linter 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- 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_UNSECURED_ENV_VARIABLES | List of env variables explicitly not filtered before calling ARM_ARM_TTK and its pre/post commands | 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 |
ARM_ARM_TTK_CLI_EXECUTABLE | Override CLI executable | ['arm-ttk'] |
IDE Integration
Use arm-ttk in your favorite IDE to catch errors before MegaLinter !
IDE | Extension Name | Install | |
---|---|---|---|
Visual Studio Code | ARMTTKExtension |
MegaLinter Flavors
This linter is available in the following flavors
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default MegaLinter Flavor | 124 | ||
dotnet | Optimized for C, C++, C# or VB based projects | 62 | ||
dotnetweb | Optimized for C, C++, C# or VB based projects with JS/TS | 71 |
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 (
file
CLI lint mode)
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
cmdlet Import-Module at command pipeline position 1
Supply values for the following parameters:
Name[0]:
Import-Module: Cannot process command because of one or more missing mandatory parameters: Name.
Test-AzTemplate:
Line |
2 | $TAZ_V = (Test-AzTemplate -help);
| ~~~~~~~~~~~~~~~
| The term 'Test-AzTemplate' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Installation on mega-linter Docker image
- Dockerfile commands :
# Parent descriptor install
RUN curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/powershell-7.4.2-linux-musl-x64.tar.gz -o /tmp/powershell.tar.gz \
&& mkdir -p /opt/microsoft/powershell/7 \
&& tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7 \
&& chmod +x /opt/microsoft/powershell/7/pwsh \
&& ln -s /opt/microsoft/powershell/7/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