Home

Awesome

wsl - Whitespace Linter

forthebadge forthebadge

GitHub Actions Coverage Status

wsl is a linter that enforces a very non scientific vision of how to make code more readable by enforcing empty lines at the right places.

This linter is aggressive and a lot of projects I've tested it on have failed miserably. For this linter to be useful at all I want to be open to new ideas, configurations and discussions! Also note that some of the warnings might be bugs or unintentional false positives so I would love an issue to fix, discuss, change or make something configurable!

Installation

# Latest release
go install github.com/bombsimon/wsl/v4/cmd/wsl@latest

# Main branch
go install github.com/bombsimon/wsl/v4/cmd/wsl@master

Usage

Note: This linter provides a fixer that can fix most issues with the --fix flag. However, currently golangci-lint does not support suggested fixes so the --fix flag in golangci-lint will not work.

wsl uses the analysis package meaning it will operate on package level with the default analysis flags and way of working.

wsl --help
wsl [flags] </path/to/package/...>

wsl --allow-cuddle-declarations --fix ./...

wsl is also integrated in golangci-lint

golangci-lint run --no-config --disable-all --enable wsl

Issues and configuration

The linter suppers a few ways to configure it to satisfy more than one kind of code style. These settings could be set either with flags or with YAML configuration if used via golangci-lint.

The supported configuration can be found in the documentation.

Below are the available checklist for any hit from wsl. If you do not see any, feel free to raise an issue.

Note: this linter doesn't take in consideration the issues that will be fixed with go fmt -s so ensure that the code is properly formatted before use.