Skip to main content

argocd-source-lint

Tests License: MIT Python 3.11+ Ruff

Lints ArgoCD Applications for mistakes ArgoCD doesn't report, from the Git checkout alone: no cluster, kubeconfig or network access.

Table output of argocd-source-lint on a small repository: two errors for an orphan file and a missing path, two warnings for a CNPG cluster without ignoreDifferences, and one error for a file deployed twice to the same place

Some of these mistakes ArgoCD never reports, such as a manifest in an Application's folder that is never applied, or a misspelled sync option or hook value that it ignores. Others, such as a $values file that doesn't exist, only show up once the change is merged and synced. This tool reports both on the pull request.

Why it exists, and what it found on a production repo: docs/why-this-exists.md.

Quick start

It needs Python 3.11 or later and git on PATH. From the root of the Git repository that holds your Applications:

pipx install argocd-source-lint   # or: pip install argocd-source-lint
argocd-source-lint .

orphan-source, the check for files no Application deploys, only looks at the folders you list. Add them in a .argocd-lint.yaml at the root of the repository:

scan_roots:
  - manifests/

A source counts as this repository when its repoURL matches the checkout's origin remote. If your Applications use another URL, such as an SSH host alias, list it under repo_urls (see Configuration); otherwise every source is treated as another repository, and the output says so.

The exit code is 1 when a blocking problem is found (see Exit codes). examples/full-coverage has one broken Application per rule; run it from an HTTPS clone of this repository, since its Applications point at that URL.

Rules

Rule Default severity Detects
orphan-source error A YAML file under scan_roots that no Application source covers
broken-values-ref error A Helm valueFiles entry, including $ref, that points to a file that doesn't exist
missing-ignore-diff warning A known operator resource (CNPG, cert-manager, Strimzi...) under selfHeal: true without the ignoreDifferences its generated objects need
phantom-target error A source path that doesn't exist at its targetRevision
unresolvable-generator info An ApplicationSet generator that can't be resolved from the local checkout alone
double-coverage error The same resource deployed by two Applications to the same cluster and namespace
revision-mismatch info A source whose targetRevision points to another commit than the checked-out one
project-scope-violation error An Application source or destination outside the sourceRepos or destinations allowed by its AppProject
hpa-selfheal-conflict warning An HPA and ArgoCD selfHeal both managing spec.replicas without the required ignore configuration
sync-validation-disabled info The Validate=false sync option, which allows an invalid manifest to be applied
duplicate-application-name error Two or more Applications using the same namespace and name
malformed-ignore-diff-pointer warning An ignoreDifferences.jsonPointers entry that doesn't start with / as required by RFC 6901
malformed-ignore-diff-jq-expression warning An ignoreDifferences.jqPathExpressions entry written as a JSON pointer or a path without its leading .
unknown-sync-option warning An unknown or incorrectly cased ArgoCD sync option
unknown-resource-hook warning An unknown ArgoCD hook or hook deletion policy value
malformed-sync-wave warning A sync-wave annotation whose value isn't a valid integer
floating-target-revision warning A targetRevision written as a version range instead of an exact pin

docs/rules.md explains each rule, what ArgoCD does in that case, and how to fix it.

A revision that isn't in the checkout at all can't be checked. phantom-target and broken-values-ref report it as unverifiable instead of guessing.

Limitations

  • Helm charts and Kustomize overlays are not rendered. A resource a chart template produces never exists as a file, so no rule sees it. orphan-source does follow the local files a kustomization.yaml references; remote ones are skipped.
  • A source in another Git repository can't be inspected. It is reported as info.
  • The list, git, matrix and merge ApplicationSet generators are resolved locally, and the Applications they produce go through every rule. clusters, scmProvider, pullRequest and plugin generators, goTemplate: true, templatePatch and selector give unresolvable-generator instead, and the files those Applications may deploy are reported by orphan-source as info.
  • Manifests are read as YAML 1.2, while Kubernetes reads them as YAML 1.1: enabled: yes is a string here but the boolean true for Kubernetes, so a list generator element written that way passes here and is rejected by ArgoCD. Params files and elementsYaml are read as YAML 1.1, like ArgoCD, except that an explicit tag such as !!str yes is ignored there and the value read as true.
  • A YAML file whose [/{ nest more than 250 levels deep is skipped with a notice. If it mentions Argo CD resources, every orphan-source finding becomes info, since it may hold the Application that deploys them.
  • The repository is read as one GitOps tree. A template repository with one tree per cluster gets duplicate-application-name for names repeated across trees, unless the trees are listed in argocd_instances.
  • Nothing that depends on the live cluster is checked.
  • Known false positives, to be fixed: sourceHydrator sources, Kustomize options set in the Application itself (components, patches, namePrefix, nameSuffix, namespace), an AppProject that lists destinations both by server and by name, group: '*' in ignoreDifferences, and spec.sources: []. The unknown-resource-hook message also says such a resource is applied as a plain one, when ArgoCD never applies it.

Using it on an existing repository

The first run on an established repository may report findings you don't want to fix right away, such as a manifest left over from a removed component. Record them as a baseline:

argocd-source-lint . --write-baseline

This writes .argocd-lint-baseline.yaml. Commit it: later runs report only new findings. The file is plain YAML, and running --write-baseline again replaces it with the current findings.

To accept a finding for one Application instead, annotate it with the rule and a reason:

metadata:
  annotations:
    argocd-source-lint/ignore-phantom-target: "path is created by a Job at sync time"

Usage

argocd-source-lint [PATH] [OPTIONS]
Option Effect
--format, -f table (default), json, sarif, gitlab-codequality, junit, or github for pull request annotations in GitHub Actions
--output, -o Write the report to a file instead of stdout
--show-info List info findings in the table instead of counting them per rule
--fail-on-empty Exit with 1 when no ArgoCD Application is found
--write-baseline Accept every current finding into .argocd-lint-baseline.yaml
--only RULE, --skip RULE Run only these rules, or all but these. Repeatable
--target-branch BRANCH Branch a pull request goes into; Applications tracking it are checked against the checkout
--list-rules Print every rule with its default severity
--version Print the version

info findings never block CI, so the table only counts them, one line per rule. A source in another repository is counted once, although several rules each report it. JSON, SARIF, JUnit and GitLab reports always include every finding.

When no ArgoCD Application is found, or scan_roots is not set, the output says what was not checked instead of "No issues detected" (on stderr for the formats other than table).

Exit codes

Code Meaning
0 No blocking finding
1 At least one blocking finding, or no Application found with --fail-on-empty
2 The tool could not run: path not found, git missing, an invalid .argocd-lint.yaml, an unknown rule in --only/--skip, or --write-baseline combined with either

An error always blocks. An unverifiable finding blocks too by default, so an incomplete checkout doesn't look like a clean run; unverifiable_blocks_ci: false in .argocd-lint.yaml makes it non-blocking.

CI/CD integration

The linter needs the commits your Applications target. A revision is looked up as written, then as origin/<revision>, so a branch that only exists as a remote-tracking branch, as in the detached checkout of a pull request, is found. A revision missing from the clone comes out as unverifiable.

In a pull request, Applications that track the branch the change goes into are checked against the change itself. The branch is read from GITHUB_BASE_REF (GitHub) or CI_MERGE_REQUEST_TARGET_BRANCH_NAME (GitLab merge request pipelines); elsewhere, pass --target-branch main.

Each tag of the GitHub Action and the GitLab component installs its own release of the tool, so @v1.5.0 always runs 1.5.0. On GitHub, @v1 follows the latest 1.x release.

GitHub Actions

jobs:
  lint:
    runs-on: ubuntu-latest

    permissions:
      security-events: write
      actions: read
      contents: read

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - uses: gillesl-dev/argocd-source-lint@v1.5.0

fetch-depth: 0 fetches every branch and tag, so Applications pinned to another branch or a tag can be checked; actions/checkout fetches a single commit by default. The SARIF report is uploaded to code scanning, which needs security-events: write (actions: read and contents: read only on private repositories). On pull requests from forks and from Dependabot, whose token is read-only, a failed upload doesn't fail the job.

Input Default Effect
path . Root of the Git repository, not a subfolder of it
fail-on-error true false reports without failing the job, for a progressive rollout. A tool error (exit code 2) still fails it
fail-on-empty true Fail when no Application is found, which usually means a wrong path
upload-sarif true false where code scanning isn't available, such as a private repository without GitHub Code Security
category Code scanning category of the report. Needed when the Action runs more than once in a workflow run, such as once per path
args Extra options, for example --skip orphan-source. Split on spaces, so an option value can't contain one. --format and --output are set by the Action
python-version 3.11 Python used to run the tool, in its own virtual environment

The sarif-file output gives the path of the SARIF report. With fail-on-error: false, a missing Application doesn't fail the job either; only a tool error does.

GitLab CI

A GitLab component has to be hosted on the same GitLab instance as the projects using it. Copy templates/lint.yml into a project on your instance, with a README.md at its root, then include it by tag, branch or commit SHA. It doesn't need to be published in the CI/CD Catalog.

include:
  - component: $CI_SERVER_FQDN/<your-gitlab-group>/argocd-source-lint/lint@v1.5.0

GitLab runs merge request pipelines only when the project's own .gitlab-ci.yml asks for them; rules inside an included component don't count. Without them the job runs in branch pipelines, where CI_MERGE_REQUEST_TARGET_BRANCH_NAME isn't set, so Applications tracking the target branch are checked against that branch instead of the change. Add, for example:

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

or pass --target-branch through the args input.

The job publishes a Code Quality report and prints the table.

Input Default Effect
scope . Root of the Git repository, not a subfolder of it
fail_on_error true As fail-on-error above
fail_on_empty true As fail-on-empty above
args Extra options, split on spaces. Quote a * so the shell doesn't expand it
stage test Stage of the job
job_name argocd-source-lint Name of the job, distinct for each include of the component
image python:3.11-slim Image the job runs in. It needs Python 3.11 or later, and git or apt-get. Without Internet access, use a mirrored image and set PIP_INDEX_URL to your PyPI mirror

A GitLab job clones the ref being tested, shallow by default (GIT_DEPTH is 20 on new projects). Applications tracking the merge request's target branch need nothing more. One pinned to another branch or a tag comes out as unverifiable until that ref is in the clone.

pre-commit

The hook needs Python 3.11 or later as pre-commit's default Python.

repos:
  - repo: https://github.com/gillesl-dev/argocd-source-lint
    rev: v1.5.0
    hooks:
      - id: argocd-source-lint

Configuration

.argocd-lint.yaml at the root of the repository. Every key is optional; .argocd-lint.example.yaml shows them all.

Key Default Effect
scan_roots none Folders where every YAML file should belong to an Application. Without it, orphan-source checks nothing, and the output says so
exclude_paths none Glob patterns of repository paths orphan-source ignores, such as manifests/legacy/**
rules the severities above Severity per rule ID: error, warning or info. An unknown rule ID exits with code 2
unverifiable_blocks_ci true Whether an unverifiable finding gives exit code 1
repo_urls none Other URLs ArgoCD uses for this repository than the checkout's origin remote, such as an SSH host alias or a mirror
new_git_file_globbing false true when the ApplicationSet controller runs with --enable-new-git-file-globbing, which changes how git files generator patterns match
argocd_instances none Folders that each hold the Applications of a separate ArgoCD instance. Names and destinations are compared only within one instance
argocd_version none Your ArgoCD version, such as "3.2.0". unknown-sync-option and unknown-resource-hook then also report values that version doesn't know yet, such as the Application-level Prune sync option before 3.4.0
known_operators none More operator signatures for missing-ignore-diff, added to the built-in ones (see docs/rules.md)

Compared to other tools

None of the tools below documents a rule for orphan sources, missing ignoreDifferences, phantom targets, or double coverage (checked against their documentation in November 2026). argocd-lint has rules close to floating-target-revision, project-scope-violation and duplicate-application-name; the last one compares names only, not namespace and name.

Needs a cluster or a running ArgoCD Primary purpose
argocd-source-lint No Static analysis of the Git checkout (see Rules)
argocd-diff-preview Starts a throwaway cluster with ArgoCD (needs Docker), or uses an existing ArgoCD Shows the rendered manifest diff on a pull request
kubechecks Yes Schema/policy checks (kubepug, kubeconform, conftest) plus a live-state diff comment on a pull request
argocd-lint No, except its optional server dry run Best-practice rules for Application, ApplicationSet and AppProject, extensible with Rego
drydock No Renders, tests and diffs ArgoCD Applications offline, with diagnostics for rendering, health checks and AppProjects
glint No Renders Helm and Kustomize, then applies your own CEL policies to ArgoCD Applications, Flux HelmReleases and plain resources
conftest / kubeconform No Generic OPA policy checks and schema validation, not aware of ArgoCD's semantics. The CRDs catalog has schemas for ArgoCD's resources

Development

uv sync --extra dev
uv run argocd-source-lint .
uv run pytest

For implementation details, see DESIGN.md. To add a rule or an operator signature, see CONTRIBUTING.md.

This project is developed with AI coding assistants (Claude Code). The rules follow ArgoCD's source code, which the comments cite wherever the behavior isn't obvious, and the test suite (500+ tests) runs on Linux and Windows. Known limitations and false positives are listed under Limitations.

License

MIT. See LICENSE.

Metadata

Release files for argocd-source-lint 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for argocd-source-lint 1.5.0
File Size Uploaded Provenance Actions
argocd_source_lint-1.5.0.tar.gz 202.6 kB Without provenance Details for argocd_source_lint-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for argocd-source-lint 1.5.0
File Interpreter ABI Platform Actions
argocd_source_lint-1.5.0-py3-none-any.whl Python 3 none any Details for argocd_source_lint-1.5.0-py3-none-any.whl

Total release size: 294.9 kB

Release files / argocd_source_lint-1.5.0.tar.gz

Download URL argocd_source_lint-1.5.0.tar.gz
Size 202.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1d7e5ce48c42089fe833d23ef19747fc3188539ce41f279a892e5c50db6578f0
BLAKE2b-256 checksum
How to use checksums
88f41d57851e4e935964f75024851b7d524a7d8688e8b790c36839783aa7c745
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / argocd_source_lint-1.5.0-py3-none-any.whl

Download URL argocd_source_lint-1.5.0-py3-none-any.whl
Size 92.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b47d9d1aa99ece374742a010f10a35f153f994d7a6fdaff42496f7357eafc4db
BLAKE2b-256 checksum
How to use checksums
a6e2a58164dcddf514492adbb4683f09eccdb6843ad6e2881add202269041198
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for argocd-source-lint 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page