Code Monkey home page Code Monkey logo

wsl's Introduction

WSL - Whitespace Linter

forthebadge forthebadge

Build Status 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.

I think too much code out there is to cuddly and a bit too warm for it's own good, making it harder for other people to read and understand. The linter will warn about newlines in and around blocks, in the beginning of files and other places in the code.

I know 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

By go get (local installation)

You can do that by using:

go get -u github.com/bombsimon/wsl/cmd/...

By golangci-lint (CI automation)

wsl is already integrated with golangci-lint. Please refer to the instructions there.

Usage

How to use depends on how you install wsl.

With local binary

The general command format for wsl is:

$ wsl [flags] <file1> [files...]
$ wsl [flags] </path/to/package/...>

# Examples

$ wsl ./main.go
$ wsl --no-test ./main.go
$ wsl --allow-cuddle-declarations ./main.go
$ wsl --no-test --allow-cuddle-declaration ./main.go
$ wsl --no-test --allow-trailing-comment ./myProject/...

The "..." wildcard is not used like other go commands but instead can only be to a relative or absolute path.

By default, the linter will run on ./... which means all go files in the current path and all subsequent paths, including test files. To disable linting test files, use -n or --no-test.

By golangci-lint (CI automation)

The recommended command is:

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

For more information, please refer to golangci-lint's documentation.

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.

wsl's People

Contributors

aleksi avatar anatolym avatar bergmaier avatar biffen avatar bombsimon avatar fbrinker avatar flw-cn avatar hairyhenderson avatar hollowaykeanho avatar jdipierro avatar matthope avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.