lingo
Lingo helps you define and enforce project-specific Go lingo.
Description
Lingo is a tool for fully-automated static code analysis of Go code. It is designed
to be integrated in continuous delivery pipelines and act as a single source of truth
for a project's code style.
Installation
To install the latest version of lingo execute:
go get -u github.com/s2gatev/lingo
Configuration
The static analysis checks performed by lingo are defined in a configuration file
that needs to be provided upon execution. The following example defines five
static analysis checks that are executed against all .go
files except those
under vendor/
and those with names ending in _test
:
matchers:
-
type: 'glob'
config:
pattern: '**/*.go'
-
type: 'not'
config:
type: 'glob'
config:
pattern: '**/vendor/**/*'
-
type: 'not'
config:
type: 'glob'
config:
pattern: '**/*_test.go'
checkers:
local_return:
multi_word_ident_name:
exported_ident_doc:
test_package:
consistent_receiver_names:
Here is a list of the available checkers.
Check
To check all files rooted at the current directory for lingo violations execute:
lingo check ./...
Guide
To read a guide with all the lingo rules applicable for the project execute:
lingo guide
Contributing
- Fork the project
- Clone your fork (
git clone https://github.com/username/lingo && cd lingo
)
- Create a feature branch (
git checkout -b new-feature
)
- Make changes and add them (
git add .
)
- Make sure tests are passing and coverage is good (
go test ./... -race -cover
)
- Make sure code style is matching the lingo of the project (
lingo ./...
)
- Commit your changes (
git commit -m 'Add some feature'
)
- Push the branch (
git push origin new-feature
)
- Create a new pull request
Credits
Lingo draws huge inspiration from RuboCop and
other Go tools such as dep, cobra
and golint.
Copyright
Copyright (c) 2017 Stanislav Gatev. See LICENSE for
further details.