abcing 0.0.2 → 0.0.3
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/.travis.yml +6 -0
- data/README.md +15 -8
- data/abcing.gemspec +3 -3
- data/lib/abcing.rb +9 -3
- data/lib/abcing/class_file_finder.rb +1 -13
- data/lib/abcing/colour_alphabet_result.rb +1 -1
- data/lib/abcing/renderer.rb +1 -1
- data/lib/abcing/version.rb +1 -1
- data/spec/alphabet_match_spec.rb +3 -19
- data/spec/class_file_finder_spec.rb +6 -19
- data/spec/colour_alphabet_result_spec.rb +3 -3
- data/spec/{scan_result_spec.rb → scanner_spec.rb} +6 -0
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44e2acf631192f7e19859f1eceef233fe3a6d89c
|
4
|
+
data.tar.gz: ed85447226cc1a8fc749f8320a9ee47707b44e96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99d392ca8b0d58ecb0d9298ced3a084bc524e26c2555ef9c89a3c0c29d713d05b259fde6d57bbf64eee9a134f6740979661a5874673408601424d901328cebeb
|
7
|
+
data.tar.gz: 42c2b29d3f429522ce7bb20876cbfc71df2627c46826aeedf441462822a0b57b993b7983f1ee54c386f7e69e42ffd98c6c09ffc261a41c03e79d75e5a59ace02
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# ABCing
|
2
2
|
|
3
|
-
|
3
|
+
[](http://badge.fury.io/rb/abcing)
|
4
|
+
[](https://travis-ci.org/emileswarts/ABCing.svg)
|
5
|
+

|
6
|
+

|
4
7
|
|
5
8
|
Dumbed down automated test coverage metrics.
|
6
9
|
Checks your working directory for class names, and tries to match them in the test directories.
|
@@ -11,6 +14,13 @@ If it finds a matching class name in one of your test directories, you get a gre
|
|
11
14
|
If it finds a class name in the working directory but not in the test directory, it is printed in red.
|
12
15
|
Other letters (not present in your working directory or test directories) are printed in yellow.
|
13
16
|
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
$ abcing /path/to/project/root
|
20
|
+
|
21
|
+
Right now this will check /path/to/project/root/spec and /path/to/project/root/features to find test files.
|
22
|
+
It will use app/ and lib/ to find classes that should be tested.
|
23
|
+
|
14
24
|
## Installation
|
15
25
|
|
16
26
|
Add this line to your application's Gemfile:
|
@@ -27,12 +37,6 @@ Or install it yourself as:
|
|
27
37
|
|
28
38
|
$ gem install abcing
|
29
39
|
|
30
|
-
## Usage
|
31
|
-
|
32
|
-
abcing /path/to/project/root
|
33
|
-
|
34
|
-
Currently this only considers app/ and lib/ for the scan.
|
35
|
-
It will check spec/ and features/ for matching class names found in the working directory.
|
36
40
|
|
37
41
|
## Contributing
|
38
42
|
|
@@ -44,4 +48,7 @@ It will check spec/ and features/ for matching class names found in the working
|
|
44
48
|
|
45
49
|
## TODO
|
46
50
|
|
47
|
-
1.
|
51
|
+
1. Check for presence of config file for scan params
|
52
|
+
2. Add verbose mode that mentions the class names scanned for results
|
53
|
+
3. Add score results
|
54
|
+
4. Improve performance
|
data/abcing.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Abcing::VERSION
|
9
9
|
spec.authors = ["Emile"]
|
10
10
|
spec.email = ["emile.swarts123@gmail.com"]
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.description = %q{
|
13
|
-
spec.homepage = ""
|
11
|
+
spec.summary = %q{Idiot code metrics}
|
12
|
+
spec.description = %q{Find classes mentioned in your application but not in your test suite.}
|
13
|
+
spec.homepage = "https://github.com/emileswarts/ABCing"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/lib/abcing.rb
CHANGED
@@ -13,15 +13,21 @@ module ABCing
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def run
|
16
|
-
app_directories = [
|
17
|
-
|
16
|
+
app_directories = [
|
17
|
+
"#{@working_dir}/app",
|
18
|
+
"#{@working_dir}/lib"
|
19
|
+
]
|
20
|
+
|
21
|
+
test_directories = [
|
22
|
+
"#{@working_dir}/spec",
|
23
|
+
"#{@working_dir}/features"
|
24
|
+
]
|
18
25
|
|
19
26
|
params = {
|
20
27
|
app_directories: app_directories,
|
21
28
|
test_directories: test_directories }
|
22
29
|
|
23
30
|
scan_results = ABCing::Scanner.new(params).results
|
24
|
-
|
25
31
|
ABCing::Renderer.new(scan_results).render
|
26
32
|
end
|
27
33
|
end
|
@@ -5,23 +5,11 @@ module ABCing
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def find
|
8
|
-
@target_directories.collect
|
9
|
-
matching_files(dir)
|
10
|
-
end.flatten
|
8
|
+
@target_directories.collect { |d| files_for_directory(d) }.flatten.sort
|
11
9
|
end
|
12
10
|
|
13
11
|
private
|
14
12
|
|
15
|
-
def matching_files(directory)
|
16
|
-
files_for_directory(directory).select do |f|
|
17
|
-
is_class_file? f
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def is_class_file?(file)
|
22
|
-
File.read(file).include?('class ')
|
23
|
-
end
|
24
|
-
|
25
13
|
def files_for_directory(directory)
|
26
14
|
Dir["#{directory}/**/*.rb"]
|
27
15
|
end
|
data/lib/abcing/renderer.rb
CHANGED
data/lib/abcing/version.rb
CHANGED
data/spec/alphabet_match_spec.rb
CHANGED
@@ -2,34 +2,18 @@
|
|
2
2
|
require_relative '../lib/abcing/alphabet_match'
|
3
3
|
|
4
4
|
describe ABCing::AlphabetMatch do
|
5
|
-
before(:each) do
|
6
|
-
Dir.mkdir 'dummy'
|
7
|
-
end
|
8
|
-
|
9
|
-
after(:each) do
|
10
|
-
FileUtils.rm_rf 'dummy'
|
11
|
-
end
|
12
|
-
|
13
5
|
it 'collects 2 letters' do
|
14
|
-
|
15
|
-
matcher = ABCing::AlphabetMatch.new(class_names)
|
16
|
-
|
6
|
+
matcher = ABCing::AlphabetMatch.new ['Bar', 'Foo']
|
17
7
|
expect(matcher.letters).to eq(['B', 'F'])
|
18
8
|
end
|
19
9
|
|
20
10
|
it 'Only collects unique letters' do
|
21
|
-
|
22
|
-
|
23
|
-
matcher = ABCing::AlphabetMatch.new(class_names)
|
24
|
-
|
11
|
+
matcher = ABCing::AlphabetMatch.new(['Zoo', 'Zebra'])
|
25
12
|
expect(matcher.letters).to eq(['Z'])
|
26
13
|
end
|
27
14
|
|
28
15
|
it 'Orders letter results alphabetically' do
|
29
|
-
|
30
|
-
|
31
|
-
matcher = ABCing::AlphabetMatch.new(class_names)
|
32
|
-
|
16
|
+
matcher = ABCing::AlphabetMatch.new(['Cobra', 'Acid', 'Bee'])
|
33
17
|
expect(matcher.letters).to eq(['A', 'B', 'C'])
|
34
18
|
end
|
35
19
|
end
|
@@ -4,26 +4,20 @@ require 'abcing/class_file_finder'
|
|
4
4
|
describe ABCing::ClassFileFinder do
|
5
5
|
before(:each) do
|
6
6
|
Dir.mkdir 'dummy'
|
7
|
-
out_file = File.new("dummy/foo.rb", "w")
|
8
|
-
out_file.puts("class Foo; end;")
|
9
|
-
out_file.close
|
10
7
|
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
['foo', 'bar'].each do |name|
|
9
|
+
File.write("dummy/#{ name }.rb", '')
|
10
|
+
end
|
14
11
|
end
|
15
12
|
|
13
|
+
let(:expected_results) { ['dummy/bar.rb', 'dummy/foo.rb'] }
|
14
|
+
|
16
15
|
after(:each) do
|
17
16
|
FileUtils.rm_rf 'dummy'
|
18
17
|
end
|
19
18
|
|
20
19
|
context 'Included files' do
|
21
20
|
it 'Finds files with class defined in them' do
|
22
|
-
expected_results = [
|
23
|
-
'dummy/bar.rb',
|
24
|
-
'dummy/foo.rb',
|
25
|
-
]
|
26
|
-
|
27
21
|
finder = ABCing::ClassFileFinder.new(['dummy'])
|
28
22
|
expect(finder.find).to eq(expected_results)
|
29
23
|
end
|
@@ -31,14 +25,7 @@ describe ABCing::ClassFileFinder do
|
|
31
25
|
|
32
26
|
context 'Excluded files' do
|
33
27
|
it 'that do not have a .rb extension' do
|
34
|
-
|
35
|
-
out_file.puts("class FooConfig; end;")
|
36
|
-
out_file.close
|
37
|
-
|
38
|
-
expected_results = [
|
39
|
-
'dummy/bar.rb',
|
40
|
-
'dummy/foo.rb',
|
41
|
-
]
|
28
|
+
File.write('dummy/foo_config.txt', '')
|
42
29
|
|
43
30
|
finder = ABCing::ClassFileFinder.new(['dummy'])
|
44
31
|
expect(finder.find).to eq(expected_results)
|
@@ -8,7 +8,7 @@ describe ABCing::ColourAlphabetResult do
|
|
8
8
|
}
|
9
9
|
|
10
10
|
result = ABCing::ColourAlphabetResult.new(params).calculate
|
11
|
-
expect(result).to include(A
|
11
|
+
expect(result).to include('A' => :green, 'B' => :green)
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'does not find a test for a class letter' do
|
@@ -18,7 +18,7 @@ describe ABCing::ColourAlphabetResult do
|
|
18
18
|
}
|
19
19
|
|
20
20
|
result = ABCing::ColourAlphabetResult.new(params).calculate
|
21
|
-
expect(result).to include(A
|
21
|
+
expect(result).to include('A' => :green, 'B' => :red)
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'does not find an application class or test class from the letter of the alphabet' do
|
@@ -28,7 +28,7 @@ describe ABCing::ColourAlphabetResult do
|
|
28
28
|
}
|
29
29
|
|
30
30
|
result = ABCing::ColourAlphabetResult.new(params).calculate
|
31
|
-
expect(result).to include(A
|
31
|
+
expect(result).to include('A' => :yellow, 'B' => :yellow)
|
32
32
|
end
|
33
33
|
|
34
34
|
|
@@ -5,4 +5,10 @@ describe ABCing::Scanner do
|
|
5
5
|
params = { app_directories: [], test_directories: [] }
|
6
6
|
scanner = ABCing::Scanner.new(params)
|
7
7
|
end
|
8
|
+
|
9
|
+
context 'Raises an error' do
|
10
|
+
it 'when supplied with nil params' do
|
11
|
+
expect { ABCing::Scanner.new(nil) }.to raise_error()
|
12
|
+
end
|
13
|
+
end
|
8
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abcing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emile
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 3.2.0
|
55
|
-
description:
|
55
|
+
description: Find classes mentioned in your application but not in your test suite.
|
56
56
|
email:
|
57
57
|
- emile.swarts123@gmail.com
|
58
58
|
executables:
|
@@ -62,6 +62,7 @@ extra_rdoc_files: []
|
|
62
62
|
files:
|
63
63
|
- ".gitignore"
|
64
64
|
- ".rspec"
|
65
|
+
- ".travis.yml"
|
65
66
|
- Gemfile
|
66
67
|
- Gemfile.lock
|
67
68
|
- LICENSE.txt
|
@@ -82,8 +83,8 @@ files:
|
|
82
83
|
- spec/class_name_finder_spec.rb
|
83
84
|
- spec/colour_alphabet_result_spec.rb
|
84
85
|
- spec/renderer_spec.rb
|
85
|
-
- spec/
|
86
|
-
homepage:
|
86
|
+
- spec/scanner_spec.rb
|
87
|
+
homepage: https://github.com/emileswarts/ABCing
|
87
88
|
licenses:
|
88
89
|
- MIT
|
89
90
|
metadata: {}
|
@@ -106,11 +107,11 @@ rubyforge_project:
|
|
106
107
|
rubygems_version: 2.2.2
|
107
108
|
signing_key:
|
108
109
|
specification_version: 4
|
109
|
-
summary:
|
110
|
+
summary: Idiot code metrics
|
110
111
|
test_files:
|
111
112
|
- spec/alphabet_match_spec.rb
|
112
113
|
- spec/class_file_finder_spec.rb
|
113
114
|
- spec/class_name_finder_spec.rb
|
114
115
|
- spec/colour_alphabet_result_spec.rb
|
115
116
|
- spec/renderer_spec.rb
|
116
|
-
- spec/
|
117
|
+
- spec/scanner_spec.rb
|