gitlab.com/greut/eclint@v0.5.2-0.20240402114752-14681fe6e0bf/README.md (about)

     1  # eclint - EditorConfig linter ★
     2  
     3  A faster alternative to the [JavaScript _eclint_](https://github.com/jedmao/eclint) written in Go.
     4  
     5  Tarballs are signed (`.minisig`) using the following public key:
     6  
     7      RWRP3/Z4+t+iZk1QU6zufn6vSDlvd76FLWhGCkt5kE7YqW3mOtSh7FvE
     8  
     9  Which can be verified using [minisig](https://jedisct1.github.io/minisign/) or [signify](https://github.com/aperezdc/signify).
    10  
    11  ## Installation
    12  
    13  - [Archlinux](https://aur.archlinux.org/packages/eclint/)
    14  - [Docker](https://hub.docker.com/r/greut/eclint) ([Quay.io](https://quay.io/repository/greut/eclint))
    15  - [GitHub action](https://github.com/greut/eclint-action/)
    16  - [Manual installs](https://gitlab.com/greut/eclint/-/releases)
    17  
    18  ## Usage
    19  
    20  ```
    21  $ go install gitlab.com/greut/eclint/cmd/eclint
    22  
    23  $ eclint -version
    24  ```
    25  
    26  Excluding some files using the EditorConfig matcher
    27  
    28  ```
    29  $ eclint -exclude "testdata/**/*"
    30  ```
    31  
    32  ## Features
    33  
    34  - `charset`
    35  - `end_of_line`
    36  - `indent_size`
    37  - `indent_style`
    38  - `insert_final_newline`
    39  - `max_line_length` (when using tabs, specify the `tab_width` or `indent_size`)
    40      - by default, UTF-8 charset is assumed and multi-byte characters should be
    41      counted as one. However, combining characters won't.
    42  - `trim_trailing_whitespace`
    43  - [domain-specific properties][dsl]
    44      - `line_comment`
    45      - `block_comment_start`, `block_comment`, `block_comment_end`
    46  - minimal magic bytes detection (currently for PDF)
    47  
    48  ### More
    49  
    50  - when no path is given, it searches for files via `git ls-files`
    51  - `-exclude` to filter out some files
    52  - unset / alter properties via the `eclint_` prefix
    53  - [Docker images](https://hub.docker.com/r/greut/eclint) (also on Quay.io, GitHub and GitLab registries)
    54  - colored output (use `-color`: `never` to disable and `always` to skip detection)
    55  - `-summary` mode showing only the number of errors per file
    56  - only the first X errors are shown (use `-show_all_errors` to disable)
    57  - binary file detection (however quite basic)
    58  - `-fix` to modify files in place rather than showing the errors currently:
    59      - only basic `unix2dos`, `dos2unix`
    60      - space to tab and tab to space conversion
    61      - trailing whitespaces
    62  
    63  ## Missing features
    64  
    65  - `max_line_length` counting UTF-32 characters
    66  - more tests
    67  - etc.
    68  
    69  ## Thanks for their contributions
    70  
    71  - [Viktor Szépe](https://github.com/szepeviktor)
    72  - [Takuya Fukuju](https://github.com/chalkygames123)
    73  - [Nicolas Mohr](https://gitlab.com/nicmr)
    74  - [Zadkiel Aharonian](https://gitlab.com/zadkiel_aharonian_c4)
    75  
    76  ## Benchmarks
    77  
    78  **NB** benchmarks matter at feature parity (which is also hard to measure).
    79  
    80  The contenders are the following.
    81  
    82  - [editorconfig-checker](https://github.com/editorconfig-checker/editorconfig-checker), also in Go.
    83  - [eclint](https://github.com/jedmao/eclint), in Node.
    84  
    85  The methodology is to run the linter against some big repositories `time eclint -show_all_errors`.
    86  
    87  | Repository    | `editorconfig-checker` | `jedmao/eclint` | `greut/eclint` |
    88  |---------------|------------------------|-----------------|----------------|
    89  | [Roslyn][]    | 37s                    | 1m5s            | **4s**         |
    90  | [SaltStack][] | 7s                     | 1m9s            | **<1s**        |
    91  
    92  [Roslyn]: https://github.com/dotnet/roslyn
    93  [SaltStack]: https://github.com/saltstack/salt
    94  
    95  ### Profiling
    96  
    97  Two options: `-cpuprofile <file>` and `-memprofile <file>`, will produce the appropriate _pprof_ files.
    98  
    99  ## Libraries and tools
   100  
   101  - [aurora](https://github.com/logrusorgru/aurora), colored output
   102  - [chardet](https://github.com/gogs/chardet), charset detection
   103  - [editorconfig-core-go](https://github.com/editorconfig/editorconfig-core-go), `.editorconfig` parsing
   104  - [go-colorable](https://github.com/mattn/go-colorable), colored output on Windows (too soon)
   105  - [go-mod-outdated](https://github.com/psampaz/go-mod-outdated)
   106  - [golangci-lint](https://github.com/golangci/golangci-lint), Go linters
   107  - [goreleaser](https://goreleaser.com/)
   108  - [klogr](https://github.com/kubernetes/klog/tree/master/klogr)
   109  - [nancy](https://github.com/sonatype-nexus-community/nancy)
   110  
   111  [dsl]: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#ideas-for-domain-specific-properties