Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,3 @@ linters:
rules:
- text: 'shadow: declaration of "err" shadows declaration at'
linters: [govet]
- path: '_test\.go'
linters:
- bodyclose
- dupl
- errcheck
- funlen
- goconst
- gosec
- noctx
- wrapcheck
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# BEGIN: lint-install .
# http://github.com/tinkerbell/lint-install
# http://github.com/codeGROOVE-dev/lint-install

.PHONY: lint
lint: _lint
Expand Down
2 changes: 1 addition & 1 deletion Makefile.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# BEGIN: lint-install {{.Args}}
# http://github.com/tinkerbell/lint-install
# http://github.com/codeGROOVE-dev/lint-install

.PHONY: lint
lint: _lint
Expand Down
141 changes: 120 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,111 @@
[![GoReport Widget]][GoReport Status]
[![stability-stable](https://img.shields.io/badge/stability-stable-green.svg)](https://github.com/emersion/stability-badges#stable)

[GoReport Status]: https://goreportcard.com/report/github.com/tinkerbell/lint-install
[GoReport Widget]: https://goreportcard.com/badge/github.com/tinkerbell/lint-install
[GoReport Status]: https://goreportcard.com/report/github.com/codeGROOVE-dev/lint-install
[GoReport Widget]: https://goreportcard.com/badge/github.com/codeGROOVE-dev/lint-install

Idiomatic linters for opinionated projects.
Automated linter installation and configuration for consistent code quality across teams and environments.

This tool installs well-configured linters to any project, open-source or
otherwise. The linters can be used in a repeatable and consistent way across CI,
local tests, and IDE's.
## Why lint-install?

lint-install adds linter configuration to the root of your project, and Makefile
rules to install a consistently versioned set of linters to be used in any
environment. These Makefile rules can also be upgrading by lint-install, updating
all environments simultaneously.
Maintaining consistent code quality across a team can be challenging. Different developers might use different linters, versions, or configurations, leading to:

- **Inconsistent code reviews** - Style debates instead of logic discussions
- **CI/CD failures** - Code that passes locally but fails in CI due to different linter versions
- **Configuration drift** - Each project reinventing its own linting setup
- **Onboarding friction** - New contributors struggling with tooling setup

lint-install solves these problems by providing:

- **One command setup** - Instantly adds industry-standard linters to any project
- **Version pinning** - Everyone uses the exact same linter versions
- **Consistent configuration** - Opinionated, battle-tested linter rules
- **Easy updates** - Upgrade all linters across your entire team with one command
- **Multi-environment support** - Same linting in local development, CI/CD, and IDEs

## How it works

lint-install adds Makefile rules and linter configurations to your project root. It installs specific versions of well-configured linters that can be used consistently by all contributors, whether they're working locally, in CI, or using an IDE.

Currently supported languages:

- Go
- Shell
- Dockerfile
- YAML
- **Go** - golangci-lint with comprehensive checks
- **Shell** - shellcheck for POSIX compliance and best practices
- **Dockerfile** - hadolint for security and best practices
- **YAML** - yamllint for syntax and style

## Philosophy

- Catch all the bugs!
- Improve readability as much as possible.
- Be idiomatic: only raise issues that the language authors would flag

## Installation

```bash
go install github.com/codeGROOVE-dev/lint-install@latest
```

## Usage

Installation:
### Basic usage

`go get github.com/tinkerbell/lint-install`
Add linters to your project:

Add Makefile rules for a git repository:
```bash
lint-install .
```

This creates:
- Makefile rules for installing and running linters
- Configuration files for each detected language
- A `.gitignore` entry for the linter binaries

Run the linters:

```bash
make lint
```

`$HOME/go/bin/lint-install <repo>`
### Examples

Users can then lint the project using:
**Adding linters to a Go project:**
```bash
cd my-go-project
lint-install .
make lint
```

`make lint`
**Selective language support:**
```bash
# Only add Go and Shell linters, ignore others
lint-install -dockerfile=ignore -yaml=ignore .
```

Other options:
**Preview changes without applying:**
```bash
lint-install -dry-run .
```

**CI/CD integration:**
```yaml
# GitHub Actions example
- name: Install linters
run: make lint-install

- name: Run linters
run: make lint
```

**Updating linter versions:**
```bash
# Re-run lint-install to update to latest versions
lint-install .
git add Makefile .*.version
git commit -m "Update linter versions"
```

### Command-line options

```
-dockerfile string
Expand All @@ -60,3 +123,39 @@ Other options:
-yaml string
Level to lint YAML with: [ignore, warn, error] (default "error")
```

### What gets added to your project

1. **Makefile targets:**
- `make lint` - Run all configured linters
- `make lint-<language>` - Run specific language linter
- `make lint-install` - Install the linter binaries

2. **Configuration files:**
- `.golangci.yml` - Go linting rules
- `.hadolint.yaml` - Dockerfile linting rules
- `.yamllint` - YAML linting rules
- `.*.version` files - Pinned linter versions

3. **Linter binaries:**
- Installed to `./out/linters/` (git-ignored)
- Consistent versions across all environments

## Features

- **Zero configuration** - Sensible defaults that work for most projects
- **Language detection** - Automatically identifies which linters to install
- **Version management** - Pins linter versions for reproducible builds
- **Makefile integration** - Works with existing build systems
- **Incremental adoption** - Control which languages to lint
- **IDE friendly** - Linters work with VSCode, GoLand, and other editors
- **Fast installation** - Downloads pre-built binaries when available
- **Cross-platform** - Works on Linux, macOS, and Windows

## Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

## License

See [LICENSE](LICENSE) for details.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/tinkerbell/lint-install
module github.com/codeGROOVE-dev/lint-install

go 1.22

Expand Down