GithubHelp home page GithubHelp logo

fndrd1d1 / enforcer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marcmo/enforcer

0.0 1.0 0.0 700 KB

simple source code sanitizer (check and fix anomalies in source code)

License: MIT License

Rust 86.66% C++ 0.32% Ruby 13.01%

enforcer's Introduction

Build Status Appveyor Build status

enforcer

check source code for certain metrics (intended as a pre-commit hook)

Screenshot

Usage

Use -h for short descriptions.

USAGE:
    enforcer [OPTIONS] [-g ENDINGS...] <path>
    enforcer [-g ENDINGS...] [-q | --quiet] [-j <NUM> | --threads=<NUM>] [-a | --color] <path>
    enforcer [-c | --clean] <path>
    enforcer [-l <MAX> | --length=<MAX>] <path>

ARGS:
    <path>...

OPTIONS:
    -l, --length <MAX>     max line length [not checked if empty]
    -j, --threads <NUM>    number of threads [default: 4]
    -c, --clean            clean up trailing whitespaces and convert tabs to spaces
    -a, --color            use ANSI colored output
    -g <ENDINGS>           use these file endings (e.g. ".cpp",".h")
    -h, --help             Prints help information
    -q, --quiet            only count found entries
    -s, --status           show configuration status
    -t, --tabs             leave tabs alone (without that tabs are considered wrong)
    -V, --version          Prints version information

Example config file (name .enforcer)

ignore = [".git", ".repo"]
endings = [".c", ".cpp", ".h"]

Configuration

If you place a .enforcer file with the above content in your project directory, all files ending in .c, .cpp and .h will be checked. (.git and .repo directories will be ignored.) The config file uses the TOML format.

Example Usage

Let's see how we perform on the linux kernel.

linux-4.5 > find . -type f | wc -l
  52882

linux-4.5 > enforcer -v
  Version: 0.5.0
linux-4.5 > time enforcer -t -n
41100 / 41100 [==================================================] 100.00 % 8337.43/s
enforcer-error-count: 3655
checked 41100 files (enforcer_errors!)
  [with ILLEGAL CHARS:1083]
  [with TRAILING SPACES:2572]

real	0m6.340s
user	0m3.755s
sys	0m3.779s

Ok, let's at least remove the trailing whitespaces:

linux-4.5 > time enforcer -t -c
...
checked 41100 files (enforcer_errors!)
  [with ILLEGAL CHARS:1083]
  [with TRAILING SPACES:2572]

real	0m5.255s
user	0m4.207s
sys	0m5.934s

Now check again

linux-4.5 > time enforcer -t -q
41100 / 41100 [==================================================] 100.00 % 18314.68/s
enforcer-error-count: 1083
checked 41100 files (enforcer_errors!)
  [with ILLEGAL CHARS:1083]

real	0m3.621s
user	0m3.758s
sys	0m2.411s

Changelog

[0.14.3] - 07/16/2019

  • fixed raketask

enforcer's People

Contributors

gizmomogwai avatar marcmo avatar

Watchers

 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.