debt_ceiling 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.debt_ceiling.rb +5 -0
- data/.travis.yml +1 -0
- data/README.md +12 -11
- data/debt_ceiling.gemspec +0 -1
- data/lib/debt_ceiling/version.rb +1 -1
- data/lib/debt_ceiling.rb +2 -2
- data/spec/debt_ceiling_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -9
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6633e0f63267821bc8ae8c99dcfe483c2d81d01
|
4
|
+
data.tar.gz: d35de5e19c075db347e4aabfa8d2c78faf3aac40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16f339daef3a6ea79e3a79bab28e160b7520a899306fe6c83108336eeeb39b41478a9f7130487faf0cd9c935bbf4e2e501319fc7ba2ece3ea58595006121eb36
|
7
|
+
data.tar.gz: 211d1887abc5d273a27a3b4a14795c8935fd9adf1ab24224d488830fd2e2f5e2c45e3fe0ea51ec41688526d7a27d1df4245c766d155e6c43a8fb10dabd5cb079
|
data/.debt_ceiling.rb
ADDED
data/.travis.yml
CHANGED
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
|
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
|
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/
|
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 =
|
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
|
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/
|
53
|
-
c.extension_path = "./
|
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
|
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::
|
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
|
data/lib/debt_ceiling/version.rb
CHANGED
data/lib/debt_ceiling.rb
CHANGED
data/spec/debt_ceiling_spec.rb
CHANGED
@@ -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(:
|
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.
|
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-
|
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
|