Skip to content

Commit

Permalink
documentation updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Lehmann committed Sep 3, 2018
1 parent a046b61 commit 578faeb
Showing 1 changed file with 45 additions and 37 deletions.
82 changes: 45 additions & 37 deletions docs/spline_loc.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# The spline-loc tool
The spline-loc tool
===================

## Purpose
Purpose
-------

Helping to verify that the ratio between code and comments
is at a level you can accept.


## The usage
The usage
---------

You can specify a path with `--path` (parameter is repeatable).

Expand All @@ -16,26 +19,28 @@ Bash, Python, Java, Javascript, Typescript, Groovy and C++ are supported.

If one file has been found that is below given threshold the tool ends with exit code 1 (default).

```bash
$ spline-loc --path=spline
2018-08-11 11:04:34,790 - spline.tools.loc.application - Running with Python 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]
2018-08-11 11:04:34,798 - spline.tools.loc.application - Running on platform Linux-4.9.0-6-amd64-x86_64-with-debian-9.4
2018-08-11 11:04:34,799 - spline.tools.loc.application - Current cpu count is 4
|-----|---|---|--------------------|------|
|Ratio|Loc|Com|File |Type |
|-----|---|---|--------------------|------|
|0.35 |162|57 |application.py |Python|
|0.34 |77 |26 |tools/event.py |Python|
|0.38 |89 |34 |tools/version.py |Python|
|0.26 |213|56 |components/tasks.py |Python|
|0.36 |80 |29 |components/config.py|Python|
|-----|---|---|--------------------|------|
```
::

$ spline-loc --path=spline
2018-08-11 11:04:34,790 - spline.tools.loc.application - Running with Python 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]
2018-08-11 11:04:34,798 - spline.tools.loc.application - Running on platform Linux-4.9.0-6-amd64-x86_64-with-debian-9.4
2018-08-11 11:04:34,799 - spline.tools.loc.application - Current cpu count is 4
|-----|---|---|--------------------|------|
|Ratio|Loc|Com|File |Type |
|-----|---|---|--------------------|------|
|0.35 |162|57 |application.py |Python|
|0.34 |77 |26 |tools/event.py |Python|
|0.38 |89 |34 |tools/version.py |Python|
|0.26 |213|56 |components/tasks.py |Python|
|0.36 |80 |29 |components/config.py|Python|
|-----|---|---|--------------------|------|


You can use the option `--show-all` (or `-s`) to show all files.


## About loc, com and ratio
About loc, com and ratio
------------------------

- **LOC** - lines of code without comments; empty lines included.
- **COM** - lines of comments; empty comment lines includes.
Expand All @@ -51,32 +56,35 @@ You can use the option `--show-all` (or `-s`) to show all files.
Basially I was interested in code that has not enough comments which
focuses on ratios below 1.0. That's the idea.

## About comments
About comments
--------------

- I do not check about empty lines.
- I do not check for sense ... if somebody writes 'bla bla bla' a code review should reject.
- I do not check tags against parameters because a) there are to many different styles and b)
it would required to parse each language to know which parameters a function or method has.

## Using average ratio only for valuation
Using average ratio only for valuation
--------------------------------------

The option `--average` does still report all files that have not enough documentation but
the **spline-loc** tool (now) fails only when the average of all your ratios is smaller
than your defined threshold:

```bash
$ spline-loc --path=spline --average
2018-08-14 05:44:03,157 - spline.tools.loc.application - Running with Python 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]
2018-08-14 05:44:03,221 - spline.tools.loc.application - Running on platform Linux-4.9.0-6-amd64-x86_64-with-debian-9.4
2018-08-14 05:44:03,221 - spline.tools.loc.application - Current cpu count is 4
|-----|---|---|------------------------|------|
|Ratio|Loc|Com|File |Type |
|-----|---|---|------------------------|------|
|0.35 |162|57 |application.py |Python|
|0.34 |77 |26 |tools/event.py |Python|
|0.38 |89 |34 |tools/version.py |Python|
|0.26 |213|56 |components/tasks.py |Python|
|0.36 |80 |29 |components/config.py |Python|
|-----|---|---|------------------------|------|
2018-08-14 05:44:03,240 - spline.tools.loc.application - average ratio is 0.72 for 34 files
```
::

$ spline-loc --path=spline --average
2018-08-14 05:44:03,157 - spline.tools.loc.application - Running with Python 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]
2018-08-14 05:44:03,221 - spline.tools.loc.application - Running on platform Linux-4.9.0-6-amd64-x86_64-with-debian-9.4
2018-08-14 05:44:03,221 - spline.tools.loc.application - Current cpu count is 4
|-----|---|---|------------------------|------|
|Ratio|Loc|Com|File |Type |
|-----|---|---|------------------------|------|
|0.35 |162|57 |application.py |Python|
|0.34 |77 |26 |tools/event.py |Python|
|0.38 |89 |34 |tools/version.py |Python|
|0.26 |213|56 |components/tasks.py |Python|
|0.36 |80 |29 |components/config.py |Python|
|-----|---|---|------------------------|------|
2018-08-14 05:44:03,240 - spline.tools.loc.application - average ratio is 0.72 for 34 files

0 comments on commit 578faeb

Please sign in to comment.