Git Product home page Git Product logo

decorder's Introduction

Decorder

A declaration order linter for golang. In case of this tool declarations are type, const, var and func.

Rules

This linter applies multiple rules where each can be disabled via cli parameter.

rule description cli-options
declaration order Enforces the order of global declarations (e.g. all global constants are always defined before variables). You can also define a subset of declarations if you don't want to enforce the order of all of them. * disable check: -disable-dec-order-check
* custom order: -dec-order var,const,func,type
declaration number Enforces that the statements const, var and type are only used once per file. You have to use parenthesis to declare e.g multiple global types inside a file. disable check: -disable-dec-num-check
init func first Enforces the init func to be the first function in file. disable check: -disable-init-func-first-check

You may find the implementation of the rules inside analyzer.go.

Installation

go install gitlab.com/bosi/decorder/cmd/decorder

Usage

# with default options
decorder ./...

# custom declaration order
decorder -dec-order var,const,func,type ./...

# disable declaration order check
decorder -disable-dec-order-check ./...

# disable check for multiple declarations statements
decorder -disable-dec-num-check ./...

# disable check that init func is always first function
decorder -disable-init-func-first-check ./...

decorder's People

Contributors

bosix avatar renovate-bot avatar jabielecki avatar

Watchers

Shijie Sheng 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.