Skip to content

arm-ttk

GitHub stars GitHub release (latest SemVer) GitHub last commit GitHub commit activity GitHub contributors

arm-ttk documentation

arm-ttk - GitHub

Configuration in MegaLinter

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
- 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 files
Ex: [".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 Install in VSCode

MegaLinter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default MegaLinter Flavor 117 Docker Image Size (tag) Docker Pulls
dotnet Optimized for C, C++, C# or VB based projects 63 Docker Image Size (tag) Docker Pulls
dotnetweb Optimized for C, C++, C# or VB based projects with JS/TS 72 Docker Image Size (tag) Docker Pulls

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
ARG PWSH_VERSION='latest'
ARG PWSH_DIRECTORY='/opt/microsoft/powershell'
RUN mkdir -p ${PWSH_DIRECTORY} \
    && curl --retry 5 --retry-delay 5 -s \
       -H "Accept: application/vnd.github+json" \
       -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
       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