pronto-simplecov 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +18 -0
- data/LICENSE.txt +21 -0
- data/bin/console +14 -0
- data/bin/setup +10 -0
- data/lib/pronto/pronto_simplecov/runner.rb +29 -0
- data/lib/pronto/pronto_simplecov/version.rb +5 -0
- data/lib/pronto/simplecov.rb +4 -0
- data/spec/data/test.git/COMMIT_EDITMSG +8 -0
- data/spec/data/test.git/HEAD +1 -0
- data/spec/data/test.git/config +7 -0
- data/spec/data/test.git/hooks/ctags +1 -0
- data/spec/data/test.git/hooks/post-checkout +1 -0
- data/spec/data/test.git/hooks/post-commit +1 -0
- data/spec/data/test.git/hooks/post-merge +1 -0
- data/spec/data/test.git/hooks/post-rewrite +1 -0
- data/spec/data/test.git/index +0 -0
- data/spec/data/test.git/logs/HEAD +3 -0
- data/spec/data/test.git/logs/refs/heads/master +1 -0
- data/spec/data/test.git/logs/refs/heads/methods +2 -0
- data/spec/data/test.git/objects/44/b65751859967fd2795b983288c32abac207693 +0 -0
- data/spec/data/test.git/objects/9f/80eedc9b95982d9e69b3e96c1f98b337b8349b +0 -0
- data/spec/data/test.git/objects/ad/52e9109d5f31fae0c554d85d4bd5f2ded2acec +0 -0
- data/spec/data/test.git/objects/af/9d20dfd9a150a907fccf6e8b344f5ff9e466f4 +0 -0
- data/spec/data/test.git/objects/fa/6f28ab49f1793671180802d6a410ce99ce11af +5 -0
- data/spec/data/test.git/objects/ff/1926a8d1686b0d3474f012db0b352c74d43563 +0 -0
- data/spec/data/test.git/refs/heads/master +1 -0
- data/spec/data/test.git/refs/heads/methods +1 -0
- data/spec/data/test.git/tags +9 -0
- data/spec/data/test/test.rb +9 -0
- data/spec/pronto/pronto_simplecov/runner_spec.rb +38 -0
- data/spec/pronto/simplecov_spec.rb +7 -0
- data/spec/spec_helper.rb +10 -0
- metadata +171 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2d01ddf77deaecc75f925c014b1f483b7be5ad32
|
4
|
+
data.tar.gz: 6118bd0a15329aef9bdf24f91d75f5e6b2631b66
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '081433d216c2a7d57b858791c8eb1d65ca79861765b70fab4447858dfbd9ced7b8137eafceebcdb9a95c86cc4a4fd39cb788d14472fe38ec7643a95dcadc5d79'
|
7
|
+
data.tar.gz: 108126be11de1aa085be1a158f0d683c22646602dee64e3e990c29f55476c1e5738cead77c78580a02783eed8cb5edd64b099a6dce648d1d601981931b651cc5
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
## [Unreleased]
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
|
13
|
+
## [0.1.0] - 2017-05-07
|
14
|
+
|
15
|
+
- First release
|
16
|
+
|
17
|
+
[Unreleased]: https://github.com/dsander/pronto-simplecov/compare/v0.1.0...HEAD
|
18
|
+
[0.1.0]: https://github.com/dsander/pronto-simplecov/compare/e020a804f16c5df8f1d45d1f921955928a669dd6...v0.1.0
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Dominik Sander
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "pronto/simplecov"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Pronto
|
2
|
+
module ProntoSimplecov
|
3
|
+
class Runner < Runner
|
4
|
+
def run
|
5
|
+
return [] unless @patches
|
6
|
+
return [] if coverage.empty?
|
7
|
+
@patches.map { |patch| process(patch) }
|
8
|
+
.flatten.compact
|
9
|
+
end
|
10
|
+
|
11
|
+
def process(patch)
|
12
|
+
file_coverage = coverage[patch.new_file_full_path.to_s]
|
13
|
+
return unless file_coverage
|
14
|
+
patch.added_lines
|
15
|
+
.select { |line| file_coverage.line(line.new_lineno).missed? }
|
16
|
+
.map { |line| message(line) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def message(line)
|
20
|
+
path = line.patch.delta.new_file[:path]
|
21
|
+
Message.new(path, line, :error, 'This change has no test coverage', nil, self.class)
|
22
|
+
end
|
23
|
+
|
24
|
+
def coverage
|
25
|
+
@coverage ||= Hash[SimpleCov::ResultMerger.merged_result.files.map { |file| [file.filename, file] }]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
ref: refs/heads/methods
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/data/test.git/hooks/Users/dominik/.dotfiles/git_template/hooks/ctags
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/data/test.git/hooks/Users/dominik/.dotfiles/git_template/hooks/post-checkout
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/data/test.git/hooks/Users/dominik/.dotfiles/git_template/hooks/post-commit
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/data/test.git/hooks/Users/dominik/.dotfiles/git_template/hooks/post-merge
|
@@ -0,0 +1 @@
|
|
1
|
+
spec/data/test.git/hooks/Users/dominik/.dotfiles/git_template/hooks/post-rewrite
|
Binary file
|
@@ -0,0 +1,3 @@
|
|
1
|
+
0000000000000000000000000000000000000000 9f80eedc9b95982d9e69b3e96c1f98b337b8349b Dominik Sander <git@dsander.de> 1494167914 +0200 commit (initial): initial commit
|
2
|
+
9f80eedc9b95982d9e69b3e96c1f98b337b8349b 9f80eedc9b95982d9e69b3e96c1f98b337b8349b Dominik Sander <git@dsander.de> 1494167918 +0200 checkout: moving from master to methods
|
3
|
+
9f80eedc9b95982d9e69b3e96c1f98b337b8349b fa6f28ab49f1793671180802d6a410ce99ce11af Dominik Sander <git@dsander.de> 1494167925 +0200 commit: Added a method
|
@@ -0,0 +1 @@
|
|
1
|
+
0000000000000000000000000000000000000000 9f80eedc9b95982d9e69b3e96c1f98b337b8349b Dominik Sander <git@dsander.de> 1494167914 +0200 commit (initial): initial commit
|
@@ -0,0 +1,2 @@
|
|
1
|
+
0000000000000000000000000000000000000000 9f80eedc9b95982d9e69b3e96c1f98b337b8349b Dominik Sander <git@dsander.de> 1494167918 +0200 branch: Created from HEAD
|
2
|
+
9f80eedc9b95982d9e69b3e96c1f98b337b8349b fa6f28ab49f1793671180802d6a410ce99ce11af Dominik Sander <git@dsander.de> 1494167925 +0200 commit: Added a method
|
@@ -0,0 +1 @@
|
|
1
|
+
9f80eedc9b95982d9e69b3e96c1f98b337b8349b
|
@@ -0,0 +1 @@
|
|
1
|
+
fa6f28ab49f1793671180802d6a410ce99ce11af
|
@@ -0,0 +1,9 @@
|
|
1
|
+
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
|
2
|
+
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
|
3
|
+
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
|
4
|
+
!_TAG_PROGRAM_NAME Exuberant Ctags //
|
5
|
+
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
|
6
|
+
!_TAG_PROGRAM_VERSION 5.8 //
|
7
|
+
Test ../test.rb /^class Test$/;" c
|
8
|
+
initialize ../test.rb /^ def initialize$/;" f class:Test
|
9
|
+
two ../test.rb /^ def two$/;" f class:Test
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require 'pp'
|
3
|
+
describe Pronto::ProntoSimplecov::Runner do
|
4
|
+
let(:runner) { Pronto::ProntoSimplecov::Runner.new(patches) }
|
5
|
+
let(:patches) { [] }
|
6
|
+
|
7
|
+
it 'does nothing with no patches' do
|
8
|
+
expect(runner.run).to eq([])
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'with patches' do
|
12
|
+
let(:patches) { Pronto::Git::Repository.new('./spec/data/test').diff('master') }
|
13
|
+
|
14
|
+
it 'returns nothing when no coverage information is present' do
|
15
|
+
expect(SimpleCov::ResultMerger).to receive_message_chain(:merged_result, :files).and_return({})
|
16
|
+
expect(runner.run).to eq([])
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'returns nothing when unchanged lines are uncovered' do
|
20
|
+
files = [SimpleCov::SourceFile.new(File.expand_path('spec/data/test/test.rb'), [0, 0, 0, 1, 1, 1, 1, 1, 1])]
|
21
|
+
expect(SimpleCov::ResultMerger).to receive_message_chain(:merged_result, :files).and_return(files)
|
22
|
+
expect(runner.run).to eq([])
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'only creates messages for uncovered lines' do
|
26
|
+
files = [SimpleCov::SourceFile.new(File.expand_path('spec/data/test/test.rb'), [1, 1, 1, 1, 1, 1, 0, 1, 1])]
|
27
|
+
expect(SimpleCov::ResultMerger).to receive_message_chain(:merged_result, :files).and_return(files)
|
28
|
+
expect(runner.run.length).to eq(1)
|
29
|
+
expect(runner.run.first.msg).to eq('This change has no test coverage')
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'it irgnores empt lines' do
|
33
|
+
files = [SimpleCov::SourceFile.new(File.expand_path('spec/data/test/test.rb'), [1, 1, 1, 1, nil, 1, 1, 1, 1])]
|
34
|
+
expect(SimpleCov::ResultMerger).to receive_message_chain(:merged_result, :files).and_return(files)
|
35
|
+
expect(runner.run).to eq([])
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pronto-simplecov
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dominik Sander
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pronto
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.9.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.9.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: simplecov
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.13'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.13'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- git@dsander.de
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- CHANGELOG.md
|
91
|
+
- LICENSE.txt
|
92
|
+
- bin/console
|
93
|
+
- bin/setup
|
94
|
+
- lib/pronto/pronto_simplecov/runner.rb
|
95
|
+
- lib/pronto/pronto_simplecov/version.rb
|
96
|
+
- lib/pronto/simplecov.rb
|
97
|
+
- spec/data/test.git/COMMIT_EDITMSG
|
98
|
+
- spec/data/test.git/HEAD
|
99
|
+
- spec/data/test.git/config
|
100
|
+
- spec/data/test.git/hooks/ctags
|
101
|
+
- spec/data/test.git/hooks/post-checkout
|
102
|
+
- spec/data/test.git/hooks/post-commit
|
103
|
+
- spec/data/test.git/hooks/post-merge
|
104
|
+
- spec/data/test.git/hooks/post-rewrite
|
105
|
+
- spec/data/test.git/index
|
106
|
+
- spec/data/test.git/logs/HEAD
|
107
|
+
- spec/data/test.git/logs/refs/heads/master
|
108
|
+
- spec/data/test.git/logs/refs/heads/methods
|
109
|
+
- spec/data/test.git/objects/44/b65751859967fd2795b983288c32abac207693
|
110
|
+
- spec/data/test.git/objects/9f/80eedc9b95982d9e69b3e96c1f98b337b8349b
|
111
|
+
- spec/data/test.git/objects/ad/52e9109d5f31fae0c554d85d4bd5f2ded2acec
|
112
|
+
- spec/data/test.git/objects/af/9d20dfd9a150a907fccf6e8b344f5ff9e466f4
|
113
|
+
- spec/data/test.git/objects/fa/6f28ab49f1793671180802d6a410ce99ce11af
|
114
|
+
- spec/data/test.git/objects/ff/1926a8d1686b0d3474f012db0b352c74d43563
|
115
|
+
- spec/data/test.git/refs/heads/master
|
116
|
+
- spec/data/test.git/refs/heads/methods
|
117
|
+
- spec/data/test.git/tags
|
118
|
+
- spec/data/test/test.rb
|
119
|
+
- spec/pronto/pronto_simplecov/runner_spec.rb
|
120
|
+
- spec/pronto/simplecov_spec.rb
|
121
|
+
- spec/spec_helper.rb
|
122
|
+
homepage: https://github.com/dsander/pronto-simplecov
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.6.8
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Pronto runner for Simplecov, reports changed lines without coverage.
|
146
|
+
test_files:
|
147
|
+
- spec/data/test/test.rb
|
148
|
+
- spec/data/test.git/COMMIT_EDITMSG
|
149
|
+
- spec/data/test.git/config
|
150
|
+
- spec/data/test.git/HEAD
|
151
|
+
- spec/data/test.git/hooks/ctags
|
152
|
+
- spec/data/test.git/hooks/post-checkout
|
153
|
+
- spec/data/test.git/hooks/post-commit
|
154
|
+
- spec/data/test.git/hooks/post-merge
|
155
|
+
- spec/data/test.git/hooks/post-rewrite
|
156
|
+
- spec/data/test.git/index
|
157
|
+
- spec/data/test.git/logs/HEAD
|
158
|
+
- spec/data/test.git/logs/refs/heads/master
|
159
|
+
- spec/data/test.git/logs/refs/heads/methods
|
160
|
+
- spec/data/test.git/objects/44/b65751859967fd2795b983288c32abac207693
|
161
|
+
- spec/data/test.git/objects/9f/80eedc9b95982d9e69b3e96c1f98b337b8349b
|
162
|
+
- spec/data/test.git/objects/ad/52e9109d5f31fae0c554d85d4bd5f2ded2acec
|
163
|
+
- spec/data/test.git/objects/af/9d20dfd9a150a907fccf6e8b344f5ff9e466f4
|
164
|
+
- spec/data/test.git/objects/fa/6f28ab49f1793671180802d6a410ce99ce11af
|
165
|
+
- spec/data/test.git/objects/ff/1926a8d1686b0d3474f012db0b352c74d43563
|
166
|
+
- spec/data/test.git/refs/heads/master
|
167
|
+
- spec/data/test.git/refs/heads/methods
|
168
|
+
- spec/data/test.git/tags
|
169
|
+
- spec/pronto/pronto_simplecov/runner_spec.rb
|
170
|
+
- spec/pronto/simplecov_spec.rb
|
171
|
+
- spec/spec_helper.rb
|