diff --git a/.debt_ceiling.rb b/.debt_ceiling.rb index 39652df..e5cc4df 100644 --- a/.debt_ceiling.rb +++ b/.debt_ceiling.rb @@ -1,5 +1,5 @@ DebtCeiling.configure do |c| c.whitelist = %w(bin lib) - c.max_debt_per_module = 150 - c.debt_ceiling = 450 + c.max_debt_per_module = 100 + c.debt_ceiling = 500 end diff --git a/README.md b/README.md index dc46ebd..1f049ff 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,18 @@ [![Code Climate](https://codeclimate.com/github/bglusman/debt_ceiling/badges/gpa.svg)](https://codeclimate.com/github/bglusman/debt_ceiling) #DebtCeiling -Main goal is to enforce a technical debt ceiling and tech debt reduction deadlines for your Ruby project programmatically via a configurable combination of static analysis and/or manual assignment/recognition from explicit source code references as part of your application's test suite. Eventually perhaps will aid in visualizing this quantification as a graph or graphs, and breaking down debt into various categories and sources. Currently it highlights the single largest source of debt as a suggestion for reduction, as well out outputting the total quantity, both in test suite integration or by manually running `debt_ceiling` binary. +Main goal is to track and/or enforce a technical debt ceiling and tech debt reduction deadlines for your Ruby project, however you choose to define and quantify technical debt. Uses a configurable combination of static analysis and/or manual assignment/recognition from explicit source code references as part of your application's test suite, or from CLI. ## Compatibility -Travis tests are running on 1.9.3, 2.1.1, 2.2.2, 2.3.0, Rubinius 2.8 and JRuby 1.9 mode. +Travis tests are running on MRI 1.9.3, 2.1.1, 2.2.5, and 2.3.1, JRuby (1.9 mode and JRuby 9120), and Rubinius (3.2.0) ## Current Features +* Compiled todo list, with optional author/date info per todo + * All custom/manual sources of debt are output via `debt_ceiling todo` + * Add a `--details` flag to include author/date info, or set `todo_author_date_info` to true in config to always show. + * Defaults to only showing via explicit todo, but can show during audit output if set `report_todos` to true in config. * configuring points per [RubyCritic](https://github.com/whitesmith/rubycritic) grade per file * configuring multipliers for specific static analysis attributes, including complexity, duplication, method count, reek smells * configuring ideal max lines per file/module, and a per line penalty for each additional line diff --git a/bin/debt_ceiling b/bin/debt_ceiling index 27fbfae..99c974a 100755 --- a/bin/debt_ceiling +++ b/bin/debt_ceiling @@ -1,9 +1,13 @@ #!/usr/bin/env ruby require_relative '../lib/debt_ceiling' +def path_arg(position) + ARGV[position] && !ARGV[position].match('--') ? ARGV[position] : '.' +end + if ARGV[0] == 'dig' - DebtCeiling.dig(ARGV[1] ? ARGV[1] : '.') + DebtCeiling.dig(path_arg(1)) elsif ARGV[0] == 'todo' - DebtCeiling.todo(ARGV[1] ? ARGV[1] : '.') + DebtCeiling.todo(path_arg(1)) else - DebtCeiling.audit(ARGV[0] ? ARGV[0] : '.') + DebtCeiling.audit(path_arg(0)) end diff --git a/lib/debt_ceiling.rb b/lib/debt_ceiling.rb index 65be1e9..057c2bd 100644 --- a/lib/debt_ceiling.rb +++ b/lib/debt_ceiling.rb @@ -39,6 +39,7 @@ module DebtCeiling :debt_types, :archeology_detail, :report_todos, + :todo_author_date_info, :memoize_records_in_repo ] DEFAULT_CALLOUTS = ['TECH DEBT'] @@ -61,6 +62,7 @@ module DebtCeiling config.debt_types = [CustomDebt, StaticAnalysisDebt] config.archeology_detail = :low config.report_todos = true # when running regular debt test, always shows for debt_ceiling todo + config.todo_author_date_info = details? config.memoize_records_in_repo = false # set to true to use git notes to save archaeological dig results } @@ -105,4 +107,8 @@ def config_array CONFIGURATION_OPTIONS.map {|option| public_send(option) } end + def self.details? + [ARGV[0], ARGV[1], ARGV[2]].any? {|arg| arg.to_s.match '--details'} + end + end diff --git a/lib/debt_ceiling/custom_debt.rb b/lib/debt_ceiling/custom_debt.rb index 5d45f64..9d2e5b7 100644 --- a/lib/debt_ceiling/custom_debt.rb +++ b/lib/debt_ceiling/custom_debt.rb @@ -44,8 +44,12 @@ def prepare_report end def add_line(line, index) - author, date = find_author_date(index) - report_text[index] = [line, author, date] + if DebtCeiling.todo_author_date_info + author, date = find_author_date(index) + report_text[index] = [line, author, date] + else + report_text[index] = line + end end def find_author_date(line)