linter
A tool that reads code or configuration without running it and flags likely mistakes and style problems.
In more detail
Linting is cheap and fast, and catches a different class of error from tests that actually run the code. Rules can enforce style, forbid risky patterns or check project-specific conventions.
Examples
ansible-lint is the linter for Ansible content.shellcheck script.shCheckov lints Terraform against numbered security checksDesign systems add lint rules that forbid layer inversions, raw colour values in components or missing accessibility attributes.axe-core is sometimes called an accessibility linter because it reports rule violations the same way.python3 incident/lint_postmortem.py incident/postmortem.mdLint is one of the standard monorepo tasks next to build and test, cached like any other task.go vet ./...ruff check . lints a Python project.ESLint is the usual JavaScript linter; its hooks rules point at real React bugs such as conditional hook calls or missing dependencies.In this course: Linters such as Ruff or Flake8 for Python catch known classes of mistake quickly and consistently, so reviewers do not have to. Tune away rules that only produce noise.Related terms
- ansible-lint — The community linter for Ansible playbooks, roles and collections, which checks them against rules of good practice.
- Molecule — A testing framework for Ansible roles that creates a disposable test machine, applies the role, checks the result and destroys the machine.
- ShellCheck — A linter for shell scripts that reports quoting mistakes, portability problems and common bugs, each with a numbered code.
- continuous integration — Automatically building and testing every change as soon as it is pushed, so problems are caught early.
- Checkov — An open-source scanner that checks infrastructure-as-code files, such as Terraform, against numbered security checks without deploying anything.
- static application security testing — Analysing source code without running it to find insecure patterns, such as SQL built from user input.
- layer inversion — A mistake where a lower layer depends on a higher one, such as a colour token that refers to a button component.
- axe-core — An open-source accessibility testing engine by Deque that checks rendered HTML against rules mapped to WCAG success criteria.
- quality gate — A check, or set of checks, that a change must pass before it can move on, such as being merged or promoted to the next pipeline stage.
- postmortem — A written review after an incident that explains impact, timeline, contributing conditions and the follow-up actions that will change the system.
- Roslyn analyzer — A plug-in to the C# compiler that inspects code while you edit and build, and reports diagnostics about likely bugs, unsafe patterns or style.
- code formatter — A tool that rewrites source code into a consistent layout, such as indentation and spacing, without changing what it does.
- ESLint — A tool that reads JavaScript and TypeScript code and reports likely bugs and style problems before the code runs.
- pipeline — An automated sequence of steps, such as build, test, scan and publish, that runs on every change.
- Ruff — A very fast Python linter and formatter: ruff check finds likely mistakes and ruff format lays out code in the Black style.
- static type checking — Checking that values are used consistently with their declared types by analysing code without running it.
- eslint-plugin-react-hooks — The official ESLint plugin that checks React code for Rules of Hooks violations and incomplete dependency arrays.
- any (type) — The TypeScript type that switches off type checking for a value, so anything can be done with it without errors.
- wrapper object — An object created by new String, new Number or new Boolean that wraps a primitive value, and should not be used as a type.
Taught in
- Connections And Privilege Escalation — Ansible Configuration Management at Scale
- Modules And Idempotency — Ansible Configuration Management at Scale
- Testing With Molecule — Ansible Configuration Management at Scale
- Debugging: set -x, bash -n And Reading The Error — Bash Scripting & Command Line Automation
- ShellCheck — Bash Scripting & Command Line Automation
- Style That Prevents Bugs — Bash Scripting & Command Line Automation
- POSIX sh Versus Bash — Bash Scripting & Command Line Automation
- eval, And What To Use Instead — Bash Scripting & Command Line Automation
- find And xargs — Bash Scripting & Command Line Automation
- Workflows, Jobs, Steps, and Actions — Continuous Integration & Continuous Delivery Pipelines
- Static IaC Scanning: Linting Terraform with Checkov — Cloud Security & DevSecOps Engineering
- Enforcing OPA Guardrails on Terraform Plan Payloads — Cloud Security & DevSecOps Engineering
- Design Systems Architecture: Foundations, Layers & Taxonomy — Design Systems & Component Engineering
- Automated Accessibility Testing: axe-core & Testing Library — Design Systems & Component Engineering
- Continuous Integration — DevOps & Site Reliability Engineering
- Writing A Postmortem: The SRE Appendix — DevOps & Site Reliability Engineering
- Code Quality: .editorconfig and Roslyn Analyzers — Modern .NET Core, C# & Enterprise Microservices
- Monorepo Architecture: Workspaces & Turborepo — Production Full-Stack Engineering
- Installing the Go Toolchain — Concurrent Systems Programming with Go
- Package The Service As A Helm Chart — Kubernetes: Production-Grade Container Orchestration
- Formatting, Linting And Style — Hands-on Python: Complete Video Course & Book
- The React Compiler: Automated Memoization Under The Hood — React 19 & Modern Component Architecture
- Code Review As A Quality Gate — Automated Testing, TDD & Quality Engineering
- What To Automate Away — Automated Testing, TDD & Quality Engineering
- Primitive Types: String, Number, Boolean, Bigint And Symbol — Production TypeScript
- ansible-navigator: The Settings File The Exam Reads — RHCE in Ansible (EX294): Automate Red Hat Systems
- Git And VS Code: Clone, Commit, Push, And The Dev Container — RHCE in Ansible (EX294): Automate Red Hat Systems
References
- Ansible Lint documentation
- ShellCheck
- OWASP: source code analysis tools
- ESLint: core concepts
- Overview of .NET source code analysis
- Command vet
- Ruff documentation
- PEP 8: style guide for Python code
- Flake8 documentation
- typescript-eslint documentation
- ESLint documentation