# Crawlex

`Crawlex` allows you to crawl into your elixir files inside your application,
calculate comment-to-code ratio of each file, and aggregate those ratios to find the average ratio or percentage.

## Installation

To install `Crawlex`, put the following dependency inside your `mix.exs` file

defp deps do
    {:crawlex, "~> 0.1.0", only: :dev, runtime: false},

This will gives you some `mix tasks` that you could use to calculate comment-to-code ratio of your application or project files.

## How to Use

To calculate Comment-to-Code ratio (CCR) of your elixir project your could run:

mix crawlex

This will print CCR , total lines, and total comments of each file under your application `/lib` folder
and calculate the average of you application's CCR at the bottom of the report.

To find CCR of a specific directory you could specify the directory path as follows:

mix crawlex path/to/your/directory

To find CCR of a single (elixir) file you could specify the file path instead:

mix crawlex path/to/your/elixir/file.ex

## Calculating CCR

`Crawlex` will not count empty lines in a file hence empty lines will not contribute to total lines of code nor CCR.

When you generate a CCR report using Crawlex, it will gives a CCR category according to following simple rule:
  * Average CCR is 0 - 5%   : `HORRIBLE`
  * Average CCR is 5 - 10%  : `POOR`
  * Average CCR is 10 - 15% : `AVERAGE`
  * Average CCR is 15 - 25% : `GOOD`
  * Average CCR is > 25%    : `EXCELLENT`

In a CCR report generated by `Crawlex`, any files that falls under category `AVERAGE`, `GOOD`, or `EXCELLENT` will be colored green. Otherwise, red.