debt_ceiling 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f143bb4a889c52ce57b69ee02ecaa062dde87eb
4
- data.tar.gz: d31f7da0e0e5221bb10dbbb2db7f382cdcc6f603
3
+ metadata.gz: f6633e0f63267821bc8ae8c99dcfe483c2d81d01
4
+ data.tar.gz: d35de5e19c075db347e4aabfa8d2c78faf3aac40
5
5
  SHA512:
6
- metadata.gz: 93f9335622c57589b9d7de6a207074af558b2e111dd2056351e7db133eee7c8dfa40a99627e884ad4b408758720fbd81d1abf15933b185e052a1cc6661b84f90
7
- data.tar.gz: 57423abb6795759193d1e27c064e4ec9bfe83a2b2efe32bddb10ed7dfedeb73aa64449e21d054f892ce887696e1a104241a1bf238fc476c25325c087af2a08b3
6
+ metadata.gz: 16f339daef3a6ea79e3a79bab28e160b7520a899306fe6c83108336eeeb39b41478a9f7130487faf0cd9c935bbf4e2e501319fc7ba2ece3ea58595006121eb36
7
+ data.tar.gz: 211d1887abc5d273a27a3b4a14795c8935fd9adf1ab24224d488830fd2e2f5e2c45e3fe0ea51ec41688526d7a27d1df4245c766d155e6c43a8fb10dabd5cb079
data/.debt_ceiling.rb ADDED
@@ -0,0 +1,5 @@
1
+ DebtCeiling.configure do |c|
2
+ c.whitelist = %w(bin lib)
3
+ c.max_debt_per_module = 150
4
+ c.debt_ceiling = 250
5
+ end
data/.travis.yml CHANGED
@@ -2,6 +2,7 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - jruby-19mode # JRuby in 1.9 mode
5
+ - jruby-9.0.0.0.rc1
5
6
  - 2.1.1
6
7
  - rbx-2.2
7
8
  addons:
data/README.md CHANGED
@@ -11,7 +11,10 @@ Main goal is to enforce a technical debt ceiling and tech debt reduction deadlin
11
11
  Travis tests are running on 1.9.3, 2.1.1, Rubinius 2.2 and JRuby 1.9 mode.
12
12
 
13
13
  Current features include:
14
- * configuring points per [RubyCritic](https://github.com/whitesmith/rubycritic) grade per file line (add FULL_ANALYSIS=true for a lengthier analysis by RubyCritic including churn and more code smells, but same grading logic, made available for use by hooks)
14
+ * configuring points per [RubyCritic](https://github.com/whitesmith/rubycritic) grade per file
15
+ * configuring multipliers for specific static analysis attributes, including complexity, duplication, method count, reek smells
16
+ * configuring ideal max lines per file/module, and a per line penalty for each additional line
17
+ * configuing a max debt per file/module, exceeding which will fail tests
15
18
  * Comment added explicit/manual debt assignment, via `#TECH DEBT +100` or custom word/phrase
16
19
  * Whitelisting/blacklisting files by matching path/filename
17
20
  * Modifying or replacing default calculation on a per file basis
@@ -21,7 +24,7 @@ Current features include:
21
24
  * Running from a test suite to fail if debt ceiling is exceeded
22
25
  * Running from a test suite to fail if debt deadline is missed (currently only supports a single deadline, could add support for multiple targets if there's interest)
23
26
 
24
- To integrate in a test suite, set a value for `debt_ceiling` and/or `reduction_target` and `reduction_date` in your configuration and call `DebtCeiling.audit(root_dir)` from your test helper as an additional test, or drop the configuration directly in your spec helper as debt ceiling does to calculate it's own debt:
27
+ To integrate in a test suite, set a value for `debt_ceiling`, `max_debt_per_module` and/or `reduction_target` and `reduction_date` in your configuration and call `DebtCeiling.audit(root_dir)` from your test helper as an additional test, or drop the call and/or configuration directly in your spec helper:
25
28
  ```ruby
26
29
  config.after(:all) do
27
30
  DebtCeiling.configure do |c|
@@ -36,21 +39,21 @@ To integrate in a test suite, set a value for `debt_ceiling` and/or `reduction_t
36
39
 
37
40
  These features are largely demonstrated/discussed in [examples/.debt_ceiling.rb.example](https://github.com/bglusman/debt_ceiling/blob/master/examples/.debt_ceiling.rb.example) or below snippet which demonstrates configuring debt ceiling around a team or maintainer's agreed ideas about how to quantify debt automatically and/or manually in the project source code.
38
41
 
39
- Additional customization is supported via two method hooks in the debt class, which DebtCeiling will load from a provided extension_path in the main config file, which should look like the [example file](https://github.com/bglusman/debt_ceiling/blob/master/examples/debt.rb.example)
42
+ Additional customization is supported via two method hooks in the debt class, which DebtCeiling will load from a provided extension_path in the main config file, which should look like the [example file](https://github.com/bglusman/debt_ceiling/blob/master/examples/custom_debt.rb.example)
40
43
 
41
44
  You can configure/customize the debt calculated using a few simple commands in a .debt_ceiling.rb file in the project's home directory:
42
45
 
43
46
  ```
44
47
  DebtCeiling.configure do |c|
45
48
  #exceeding this will fail a test, if you run debt_ceiling binary/calculate method from test suite
46
- c.debt_ceiling = 500
49
+ c.debt_ceiling = 250
47
50
  #exceeding this target will fail after the reduction date (parsed by Chronic)
48
51
  c.reduction_target = 100
49
- c.reduction_date = 'Jan 1 2015'
52
+ c.reduction_date = 'Jan 1 2016'
50
53
  #set the multipliers per line of code in a file with each letter grade, these are the current defaults
51
54
  c.grade_points = { a: 0, b: 10, c: 20, d: 40, f: 100 }
52
- #load custom debt calculations (see examples/debt.rb) from this path
53
- c.extension_path = "./debt.rb"
55
+ #load custom debt calculations (see examples/custom_debt.rb) from this path
56
+ c.extension_path = "./custom_debt.rb"
54
57
  #below two both use same mechanic, todo just assumes capital TODO as string, cost_per_todo defaults to 0
55
58
  c.cost_per_todo = 50
56
59
  c.deprecated_reference_pairs = { 'DEPRECATED_API' => 20}
@@ -64,16 +67,14 @@ DebtCeiling.configure do |c|
64
67
  end
65
68
  ```
66
69
 
67
- As mentioned/linked above, additional customization is supported via a debt.rb file which may define one or both of two methods DebtCeiling will call if defined when calculating debt for each module scanned (if it passes the whitelist/blacklist stage of filtering).
70
+ As mentioned/linked above, additional customization is supported via a custom_debt.rb file which may define one or both of two methods DebtCeiling will call if defined when calculating debt for each module scanned (if it passes the whitelist/blacklist stage of filtering).
68
71
 
69
- As shown in example file, set a path for `extension_path` pointing to a file defining `DebtCeiling::Debt` like the one in examples directory, and define its methods for your own additional calculation per file.
72
+ As shown in example file, set a path for `extension_path` pointing to a file defining `DebtCeiling::CustomDebt` like the one in examples directory, and define its methods for your own additional calculation per file.
70
73
 
71
74
  ### Improvement ideas/suggestsions for contributing:
72
75
 
73
76
  * rubocop/cane integration debt for style violations
74
77
 
75
- * default/custom points per reek smell detected (not currently part of RubyCritic grading, but available in full analysis)
76
-
77
78
  * multipliers for important files
78
79
 
79
80
  * command line options to configure options per run/without a `.debt_ceiling.rb` file (could be done with [ENVied](https://github.com/eval/envied) gem perhaps, or [commander](https://github.com/tj/commander) or [one of these](https://www.ruby-toolbox.com/categories/CLI_Option_Parsers)
data/debt_ceiling.gemspec CHANGED
@@ -12,7 +12,6 @@ Gem::Specification.new do |s|
12
12
  s.homepage = 'https://github.com/bglusman/debt_ceiling'
13
13
  s.summary = 'DebtCeiling helps you track Tech Debt'
14
14
  s.rubyforge_project = 'debt_ceiling'
15
- s.extensions = ['Rakefile']
16
15
 
17
16
  s.description = <<-DESC
18
17
  Get a grip on your technical debt
@@ -1,3 +1,3 @@
1
1
  module DebtCeiling
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
data/lib/debt_ceiling.rb CHANGED
@@ -38,7 +38,7 @@ module DebtCeiling
38
38
  end
39
39
 
40
40
 
41
- def audit(dir, opts= {})
41
+ def audit(dir='.', opts= {})
42
42
  Audit.new(dir, opts)
43
43
  end
44
- end
44
+ end
@@ -30,16 +30,16 @@ describe DebtCeiling do
30
30
  it 'adds debt for todos with specified value' do
31
31
  todo_amount = 50
32
32
  DebtCeiling.configure {|c| c.cost_per_todo = todo_amount }
33
- expect(DebtCeiling.audit('spec/support/todo_example.rb').total_debt).to be todo_amount
33
+ expect(DebtCeiling.audit('spec/support/todo_example.rb', preconfigured: true).total_debt).to be todo_amount
34
34
  end
35
35
 
36
36
  it 'allows manual debt with TECH DEBT comment' do
37
- expect(DebtCeiling.audit('spec/support/manual_example.rb').total_debt).to be 100 # hardcoded in example file
37
+ expect(DebtCeiling.audit('spec/support/manual_example.rb', preconfigured: true).total_debt).to be 100 # hardcoded in example file
38
38
  end
39
39
 
40
40
  it 'allows manual debt with arbitrarily defined comment' do
41
41
  DebtCeiling.configure {|c| c.manual_callouts += ['REFACTOR'] }
42
- expect(DebtCeiling.audit('spec/support/manual_example.rb').total_debt).to be 150 # hardcoded in example file
42
+ expect(DebtCeiling.audit('spec/support/manual_example.rb', preconfigured: true).total_debt).to be 150 # hardcoded in example file
43
43
  end
44
44
 
45
45
  it 'assigns debt for file length over ideal file size' do
data/spec/spec_helper.rb CHANGED
@@ -3,13 +3,5 @@ Coveralls.wear!
3
3
 
4
4
  RSpec.configure do |config|
5
5
  config.before { allow($stdout).to receive(:puts) }
6
- config.after(:each) { DebtCeiling.configure {|c| c.debt_ceiling = nil; c.reduction_target = nil; c.reduction_date = nil } }
7
- config.after(:all) do
8
- DebtCeiling.configure do |c|
9
- c.whitelist = %w(app lib)
10
- c.max_debt_per_module = 150
11
- c.debt_ceiling = 250
12
- end
13
- DebtCeiling.audit('.', preconfigured: true)
14
- end
6
+ config.after(:all) { DebtCeiling.audit }
15
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debt_ceiling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Glusman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-30 00:00:00.000000000 Z
11
+ date: 2015-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubycritic
@@ -114,10 +114,10 @@ email:
114
114
  - bglusman@shutterstock.com
115
115
  executables:
116
116
  - debt_ceiling
117
- extensions:
118
- - Rakefile
117
+ extensions: []
119
118
  extra_rdoc_files: []
120
119
  files:
120
+ - ".debt_ceiling.rb"
121
121
  - ".gitignore"
122
122
  - ".travis.yml"
123
123
  - Gemfile