tally/prefer-telemetry-opt-out¶
Stages using telemetry-enabled tools should set the vendor-documented opt-out environment variables.
| Property | Value |
|---|---|
| Severity | Info |
| Category | Privacy |
| Default | Enabled |
| Auto-fix | Yes (--fix --fix-unsafe) |
Description¶
Detects build stages that clearly use tools with an official telemetry opt-out and suggests adding a grouped telemetry block near the top of the stage.
The rule is intentionally conservative:
- It emits at most one violation per stage
- It only targets tools with a vendor-documented environment-variable opt-out
- It suppresses child stages when the required opt-outs are already inherited from a parent stage
- It only inserts the opt-outs that are still missing for that specific stage
- The fix groups the missing opt-outs into one
ENVinstruction with a short tally comment
Supported tools¶
The v1 rule targets these opt-outs:
DO_NOT_TRACK=1for BunAZURE_CORE_COLLECT_TELEMETRY=0for Azure CLIWRANGLER_SEND_METRICS=falsefor WranglerHF_HUB_DISABLE_TELEMETRY=1for the Hugging Face Python ecosystemYARN_ENABLE_TELEMETRY=0for Yarn BerryNEXT_TELEMETRY_DISABLED=1for Next.jsNUXT_TELEMETRY_DISABLED=1for NuxtGATSBY_TELEMETRY_DISABLED=1for GatsbyASTRO_TELEMETRY_DISABLED=1for AstroTURBO_TELEMETRY_DISABLED=1for TurborepoDOTNET_CLI_TELEMETRY_OPTOUT=1for .NET CLI / SDKPOWERSHELL_TELEMETRY_OPTOUT=1for PowerShellVCPKG_DISABLE_METRICS=1for vcpkgHOMEBREW_NO_ANALYTICS=1for Homebrew
Detection signals¶
The rule prefers strong, stage-local evidence in this order:
- direct command execution in
RUN,CMD,ENTRYPOINT, orSHELL - explicit CLI installation in the same stage
- observable manifests or config files that clearly name the tool
Examples:
RUN bun installRUN npx wrangler deployRUN python -m huggingface_hub scan-cacheRUN next buildCOPY package.json ./package.jsonplusRUN npm run buildwhenpackage.jsondeclaresnextCOPY requirements.txt ./requirements.txtplusRUN pip install -r requirements.txtwhen the file mentionstransformers
Manifest-based detection depends on files being observable to the linter, which means either:
- they are created in the Dockerfile (for example via
COPY <<EOFheredoc), or - they come from the build context and linting runs with
--context
Auto-fix¶
The fix inserts a small telemetry block after FROM and any immediately following stage-local ARG
instructions:
Before¶
After¶
FROM node:22
# [tally] settings to opt out from telemetry
ENV DO_NOT_TRACK=1 NEXT_TELEMETRY_DISABLED=1
RUN bun install && next build
Suppression¶
The rule does not trigger when:
- the stage already sets the required opt-out to the documented value
- the stage inherits the required opt-out from a parent stage
- the stage only shows unsupported or ambiguous signals such as:
- plain
yarn installwithout Berry-specific evidence - generic
npmorpnpmusage without a targeted tool - generic Python usage without Hugging Face packages
- Node-only
@huggingface/hubusage - AWS CLI usage
Related rules¶
tally/prefer-curl-config— stage-level environment/config insertion before toolingRUNstepstally/prefer-package-cache-mounts— stage-local package-manager cache improvementstally/powershell/prefer-shell-instruction— rewrites repeated PowerShell wrappers to aSHELLinstruction