Skip to content

audi70r/uncle-bob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Uncle-bob

Golang clean architecture linter

uncle bob

Description

A golang linter based on Uncle Bob's clean code concepts.

The linter builds a hierarchical model from the project directory AST and assign a level for every package used by the project (with the exception of a standart golang library). The dependency levels are defined by the imports of a higher order package. If main package is considered level 0, then all of its import will be 1. The subsequent imports of level 1 packages are respectively level 2 etc.

In plain mod, Uncle Bob will not allow same level imports.

In strict mod, Uncle Bob will only allow one level inward import (ex. level 0 can only import level 1 packages, level 1 can only import level 2 etc...)

Can by used in pipelines. If an issue is detected Uncle Bob will exit with status 1.

Linter works with go mod enabled

Usage

Build the project

$ go build

Install the linter on Linux

$ go install

For running uncle bob, go to the project root directory, where the go.mod is located and simply run

$ uncle-bob

uncle bob

Usage of uncle-bob:

To ignore test files

$ uncle-bob -ignore-tests

show detailed information about package imports

$ uncle-bob -package-imports=github.com/audi70r/uncle-bob/checker

do strict checking, allow only one level inward imports

$ uncle-bob -strict

License

Do whatever you want with it, but don't disrespect Uncle Bob!

About

Golang clean architecture linter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages