Giter VIP home page Giter VIP logo

polyglot's Introduction

polyglot

Build Status

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.

Screenshot of sample output

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 output

Reasons not to use polyglot:

  • Written in ATS
  • Best on Linux
  • No regex-based exclusions
  • Doesn't count block comments
  • Multiline string bug.

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 with some additional data.

Heuristics

Polyglot distinguishes itself from tokei, gocloc, scc, 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:

curl -sSl https://raw.githubusercontent.com/vmchale/polyglot/master/bash/install.sh | sh -s

You can optionally install compleat for shell completions as well.

Vim Plugin

There is a vim plugin 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 with

curl -sSl https://raw.githubusercontent.com/vmchale/atspkg/master/bash/install.sh | sh -s

And then build poly with

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, you may have to replace the last line with

atspkg build --pkg-args './mac.dhall'

Testing

To run the test suite

atspkg test --pkg-args './gc.dhall'

Languages

For languages already supported, see LANGUAGES.md

Contents

-------------------------------------------------------------------------------
 Language             Files       Lines         Code     Comments       Blanks
-------------------------------------------------------------------------------
 ATS                     16        3679         3520           39          120
 C                        1          24           22            0            2
 C Header                 1          43           35            0            8
 Dash                     5         137          111            0           26
 Dhall                    5          97           87            0           10
 Justfile                 1          25           22            1            2
 Markdown                 7         895          772            0          123
 TOML                     1           3            3            0            0
 YAML                     1          51           45            0            6
-------------------------------------------------------------------------------
 Total                   38        4954         4617           40          297
-------------------------------------------------------------------------------

polyglot's People

Contributors

vmchale avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.