Skip to content

greut/eclint

Repository files navigation

eclint - EditorConfig linter ★

A faster alternative to the JavaScript eclint written in Go.

Tarballs are signed (.minisig) using the following public key:

RWRP3/Z4+t+iZk1QU6zufn6vSDlvd76FLWhGCkt5kE7YqW3mOtSh7FvE

Which can be verified using minisig or signify.

Installation

Usage

$ go install gitlab.com/greut/eclint/cmd/eclint

$ eclint -version

Excluding some files using the EditorConfig matcher

$ eclint -exclude "testdata/**/*"

Features

  • charset
  • end_of_line
  • indent_size
  • indent_style
  • insert_final_newline
  • max_line_length (when using tabs, specify the tab_width or indent_size)
    • by default, UTF-8 charset is assumed and multi-byte characters should be counted as one. However, combining characters won't.
  • trim_trailing_whitespace
  • domain-specific properties
    • line_comment
    • block_comment_start, block_comment, block_comment_end
  • minimal magic bytes detection (currently for PDF)

More

  • when no path is given, it searches for files via git ls-files
  • -exclude to filter out some files
  • unset / alter properties via the eclint_ prefix
  • Docker images (also on Quay.io, GitHub and GitLab registries)
  • colored output (use -color: never to disable and always to skip detection)
  • -summary mode showing only the number of errors per file
  • only the first X errors are shown (use -show_all_errors to disable)
  • binary file detection (however quite basic)
  • -fix to modify files in place rather than showing the errors currently:
    • only basic unix2dos, dos2unix
    • space to tab and tab to space conversion
    • trailing whitespaces

Missing features

  • max_line_length counting UTF-32 characters
  • more tests
  • etc.

Thanks for their contributions

Benchmarks

NB benchmarks matter at feature parity (which is also hard to measure).

The contenders are the following.

The methodology is to run the linter against some big repositories time eclint -show_all_errors.

Repository editorconfig-checker jedmao/eclint greut/eclint
Roslyn 37s 1m5s 4s
SaltStack 7s 1m9s <1s

Profiling

Two options: -cpuprofile <file> and -memprofile <file>, will produce the appropriate pprof files.

Libraries and tools