lll

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2019 License: MIT Imports: 11 Imported by: 41

README

Build Status Coverage Godoc license Go Report Card

lll

Line length linter, used to enforce line length in files. Support for only checking go files.

Installation

$ go get github.com/walle/lll/...

Usage

usage: lll [--maxlength MAXLENGTH] [--tabwidth TABWIDTH] [--goonly] [--skiplist SKIPLIST] [--vendor] [--files] [--exclude EXCLUDE] [INPUT [INPUT ...]]

positional arguments:
  input

options:
  --maxlength MAXLENGTH, -l MAXLENGTH
                         max line length to check for [default: 80]
  --tabwidth TABWIDTH, -w TABWIDTH
                         tab width in spaces [default: 1]
  --goonly, -g           only check .go files
  --skiplist SKIPLIST, -s SKIPLIST
                         list of dirs to skip [default: [.git vendor]]
  --vendor               check files in vendor directory
  --files                read file names from stdin one at each line
  --exclude EXCLUDE, -e EXCLUDE
                         exclude lines that matches this regex
  --help, -h             display this help and exit

Example usage to check only go files for lines more than 100 characters. Excluding lines that contain the words TODO or FIXME. lll -l 100 -g -e "TODO|FIXME" path/to/myproject.

You can also define the flags using environment variables, eg. MAXLENGTH=100 GOONLY=true lll path/to/my/project.

Testing

Use the go test tool.

$ go test -cover

Contributing

All contributions are welcome! See CONTRIBUTING for more info.

License

The code is under the MIT license. See LICENSE for more information.

Documentation

Overview

Package lll provides validation functions regarding line length

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Process

func Process(r io.Reader, w io.Writer, path string, maxLength, tabWidth int,
	exclude *regexp.Regexp) error

Process checks all lines in the reader and writes an error if the line length is greater than MaxLength.

func ProcessFile

func ProcessFile(w io.Writer, path string, maxLength, tabWidth int,
	exclude *regexp.Regexp) error

ProcessFile checks all lines in the file and writes an error if the line length is greater than MaxLength.

func ShouldSkip

func ShouldSkip(path string, isDir bool, skipList []string,
	goOnly bool, skipTests bool) (bool, error)

ShouldSkip checks the input and determines if the path should be skipped. Use the SkipList to quickly skip paths. All directories are skipped, only files are processed. If GoOnly is supplied check that the file is a go file. Otherwise check so the file is a "text file".

Types

This section is empty.

Directories

Path Synopsis
cmd
lll

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL