From 949b49e94fa8994fc38496d55c453f3161b3073a Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sun, 9 Aug 2015 15:55:23 -0500 Subject: [PATCH] Add Code Statistics For An Application as a rails til. --- README.md | 1 + rails/code-statistics-for-an-application.md | 27 +++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 rails/code-statistics-for-an-application.md diff --git a/README.md b/README.md index dd8bf24..a249c3c 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Attribute Getter without the Recursion](rails/attribute-getter-without-the-recursion.md) - [Attribute Was](rails/attribute-was.md) - [Capybara Page Status Code](rails/capybara-page-status-code.md) +- [Code Statistics For An Application](rails/code-statistics-for-an-application.md) - [Conditional Class Selectors in Haml](rails/conditional-class-selectors-in-haml.md) - [Creating Records of Has_One Associations](rails/creating-records-of-has-one-associations.md) - [Ignore Poltergeist JavaScript Errors](rails/ignore-poltergeist-javascript-errors.md) diff --git a/rails/code-statistics-for-an-application.md b/rails/code-statistics-for-an-application.md new file mode 100644 index 0000000..22c79e7 --- /dev/null +++ b/rails/code-statistics-for-an-application.md @@ -0,0 +1,27 @@ +# Code Statistics For An Application + +Rails applications and engines provide `stats`, a rake task for reporting +high level code statistics. Running it on a small project of mine generated +the following report: + +``` +$ rake stats ++----------------------+-------+-------+---------+---------+-----+-------+ +| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | ++----------------------+-------+-------+---------+---------+-----+-------+ +| Controllers | 179 | 143 | 4 | 20 | 5 | 5 | +| Helpers | 18 | 16 | 0 | 2 | 0 | 6 | +| Models | 30 | 22 | 3 | 2 | 0 | 9 | +| Mailers | 0 | 0 | 0 | 0 | 0 | 0 | +| Javascripts | 53 | 35 | 0 | 6 | 0 | 3 | +| Libraries | 0 | 0 | 0 | 0 | 0 | 0 | +| Controller specs | 22 | 16 | 0 | 0 | 0 | 0 | +| Decorator specs | 30 | 22 | 0 | 0 | 0 | 0 | +| Feature specs | 739 | 382 | 0 | 74 | 0 | 3 | +| Model specs | 70 | 55 | 0 | 0 | 0 | 0 | +| Cucumber features | 412 | 293 | 0 | 0 | 0 | 0 | ++----------------------+-------+-------+---------+---------+-----+-------+ +| Total | 1553 | 984 | 7 | 104 | 14 | 7 | ++----------------------+-------+-------+---------+---------+-----+-------+ + Code LOC: 216 Test LOC: 768 Code to Test Ratio: 1:3.6 +```