Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vmchale/polyglot
Tool to count lines of source code.
https://github.com/vmchale/polyglot
Last synced: 1 day ago
JSON representation
Tool to count lines of source code.
- Host: GitHub
- URL: https://github.com/vmchale/polyglot
- Owner: vmchale
- License: bsd-3-clause
- Created: 2017-11-27T10:28:06.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-01-31T23:08:37.000Z (10 months ago)
- Last Synced: 2024-07-31T21:51:49.742Z (3 months ago)
- Language: ATS
- Homepage:
- Size: 10.8 MB
- Stars: 246
- Watchers: 8
- Forks: 6
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-modernization - ployglot
README
# polyglot
[![Build Status](https://travis-ci.org/vmchale/polyglot.svg?branch=master)](https://travis-ci.org/vmchale/polyglot)
`poly` is a command-line tool that determines project contents.
The goal is to able to point it to any directory and get an accurate,
complete, and informative summary of its contents.It also has the secondary goal of advancing the state-of-the art for ATS, by
writing practical, distributable software and supporting tooling.## Pitch
Reasons to use polyglot:
* Accurate: won't confuse Coq and Verilog
* Fast: polyglot is faster than all other tools
* Pretty: magenta outputReasons not to use polyglot:
* Written in ATS
* Best on Linux
* No regex-based exclusions
* Doesn't read `.gitignore` &c.
* Doesn't count block comments
* Multiline string
[bug](https://github.com/Aaronepower/tokei/blob/master/COMPARISON.md#Accuracy).### Benchmarks
On the Rust repo:
Tool
Language
Time
polyglot
ATS
134.6 ms
loc
Rust
139.6 ms
scc
Go
225.4 ms
tokei
Rust
262.6 ms
gocloc
Go
923.9 ms
cloc
Perl
5.610 s
enry
Go
6.926 s
linguist
Ruby
20.16 s
For more extensive benchmarks, see my [blog post](http://blog.vmchale.com/article/polyglot-comparisons)
with some additional data.### Heuristics
Polyglot distinguishes itself from `tokei`, `gocloc`, and `loc` by being able to disambiguate file names.
Thus, `poly` will not confuse Happy for Yacc (for instance).## Installation
### From a Script
The easiest way to install is to use the installation script, like so:
```bash
curl -sSl https://raw.githubusercontent.com/vmchale/polyglot/master/bash/install.sh | sh -s
```You can optionally install [compleat](https://github.com/mbrubeck/compleat) for
shell completions as well.### Vim Plugin
There is a [vim plugin](https://github.com/vmchale/polyglot-vim) available which
can count lines of code in a project.### Documentation
You can view manpages for `poly` with
```
man poly
```## Building for Hacking
You can install [ats-pkg](http://hackage.haskell.org/package/ats-pkg)
with```bash
curl -sSl https://raw.githubusercontent.com/vmchale/atspkg/master/bash/install.sh | sh -s
```And then build `poly` with
```bash
git clone [email protected]:vmchale/polyglot.git
cd polyglot
atspkg build --pkg-args './gc.dhall'
```This will put a binary at `target/poly`.
If you are on Mac, replace the last line with
```bash
atspkg build --pkg-args './mac.dhall'
```### Testing
To run the test suite
```bash
atspkg test --pkg-args './gc.dhall'
```## Languages
For languages already supported, see
[LANGUAGES.md](https://github.com/vmchale/polyglot/blob/master/LANGUAGES.md)## Contents
```
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------
ATS 17 3794 3626 41 127
C 1 24 22 0 2
C Header 1 43 35 0 8
Dash 5 144 110 8 26
Dhall 5 93 83 0 10
Markdown 6 938 813 0 125
TOML 1 3 3 0 0
YAML 1 58 52 0 6
-------------------------------------------------------------------------------
Total 37 5097 4744 49 304
-------------------------------------------------------------------------------
```