hw_checker 1.3.46 → 1.3.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/hw_checker/python_stat.rb +6 -5
- data/lib/hw_checker/python_test_run.rb +6 -5
- data/lib/hw_checker/ruby_stat.rb +19 -22
- data/lib/hw_checker/ruby_test_run.rb +6 -5
- data/lib/hw_checker/zip.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzFkNTRjNTA5MDI3NGQ4MzE5M2U0YjFhYTY2Y2FkZTk3ZTA4MzhjOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzJkOTY5YTM2ZTAzZGI4YzkyOTgzYzQzNzJlYzUyMzBiYTkwZTJiOA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWQ4ZWU5OWMyZjEyMTljNWY2NjI3YmI0NzlhMTNkMjY2ZDcxNTk4YzQ3ODRi
|
10
|
+
YzUxOTBiMWYxODUwMWMzODVkY2ZjODFiNWU1NDA2ZmNkNGM3YzVlMTQ5M2Mx
|
11
|
+
ZDc0NDYyZWZhZmFlOTNkNjQ2MGQwMjJkZWI2MDc5ZTk4MjEyMjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2MzZTBkYjdhN2U5NTQ0OGM1ZTBkZDI4NWYxYmQxZTU3M2Y1OTAzYzA1ZjI4
|
14
|
+
ZTJjMWE5OWRhYzEyMDFkZGExNjAxMjEyNmQ4MjdmN2U0YjA3ODZhMzM3NjZj
|
15
|
+
MDI2M2YwZWIzY2M3NGJkNTZkYTQ5ZjQwYmQ0YTc4YTBmNzM3MWI=
|
@@ -2,16 +2,17 @@ module HomeWorkChecker
|
|
2
2
|
module TestRunStat
|
3
3
|
class PythonStat
|
4
4
|
def initialize(tmp_path, dirname)
|
5
|
-
@
|
5
|
+
@work_path = "#{tmp_path}/#{dirname}/tests/statistic"
|
6
|
+
raise DirectoryExistError, "Archive '#{dirname}' is invalid" unless Dir::exist?(@work_path)
|
6
7
|
@lines_all = @lines_failed = 0
|
7
8
|
end
|
8
9
|
|
9
10
|
def perform
|
10
11
|
result = 0
|
11
|
-
Dir.foreach(
|
12
|
-
next unless File.file?("#{@
|
13
|
-
`pylint #{@
|
14
|
-
result = calc_percent_quality("#{@
|
12
|
+
Dir.foreach(@work_path) do |p|
|
13
|
+
next unless File.file?("#{@work_path}/#{p}") && File.extname(p) == '.py' && p != '__init__.py'
|
14
|
+
`pylint #{@work_path}/#{p} > #{@work_path}/#{p}.tmp 2>&1`
|
15
|
+
result = calc_percent_quality("#{@work_path}/#{p}.tmp")
|
15
16
|
end
|
16
17
|
result
|
17
18
|
end
|
@@ -2,15 +2,16 @@ module HomeWorkChecker
|
|
2
2
|
module TestRunStat
|
3
3
|
class PythonTestRun
|
4
4
|
def initialize(tmp_path, dirname)
|
5
|
-
@
|
5
|
+
@work_path = "#{tmp_path}/#{dirname}/tests/application"
|
6
|
+
raise DirectoryExistError, "Archive '#{dirname}' is invalid" unless Dir::exist?(@work_path)
|
6
7
|
@passed = @failed = 0
|
7
8
|
end
|
8
9
|
|
9
10
|
def perform
|
10
|
-
Dir.foreach(
|
11
|
-
next unless File.file?("#{@
|
12
|
-
`python #{@
|
13
|
-
count_passed_failed("#{@
|
11
|
+
Dir.foreach(@work_path) do |p|
|
12
|
+
next unless File.file?("#{@work_path}/#{p}") && File.extname(p) == '.py' && p != '__init__.py'
|
13
|
+
`python #{@work_path}/#{p} > #{@work_path}/#{p}.tmp 2>&1`
|
14
|
+
count_passed_failed("#{@work_path}/#{p}.tmp")
|
14
15
|
end
|
15
16
|
calc_percent_passed
|
16
17
|
end
|
data/lib/hw_checker/ruby_stat.rb
CHANGED
@@ -1,37 +1,34 @@
|
|
1
1
|
module HomeWorkChecker
|
2
2
|
module TestRunStat
|
3
|
-
class
|
3
|
+
class RubyTestRun
|
4
4
|
def initialize(tmp_path, dirname)
|
5
|
-
@
|
6
|
-
|
5
|
+
@work_path = "#{tmp_path}/#{dirname}/test"
|
6
|
+
raise DirectoryExistError, "Archive '#{dirname}' is invalid" unless Dir::exist?(@work_path)
|
7
|
+
@passed = @failed = 0
|
7
8
|
end
|
8
9
|
|
9
10
|
def perform
|
10
|
-
Dir.foreach(
|
11
|
-
next unless File
|
12
|
-
`
|
13
|
-
|
14
|
-
count_lines_all("#{@tmp_path}/#{@dirname}/#{p}")
|
11
|
+
Dir.foreach(@work_path) do |p|
|
12
|
+
next unless File.file?("#{@work_path}/#{p}") && File.extname(p) == '.rb'
|
13
|
+
`rspec #{@work_path}/#{p} > #{@work_path}/#{p}.tmp`
|
14
|
+
count_passed_failed("#{@work_path}/#{p}.tmp")
|
15
15
|
end
|
16
|
-
|
16
|
+
calc_percent_passed
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
File.open(filename).
|
22
|
-
|
23
|
-
|
19
|
+
private
|
20
|
+
def count_passed_failed(filename)
|
21
|
+
report = File.open(filename).first.chomp
|
22
|
+
return if report == 'No examples found.'
|
23
|
+
report.each_char do |value|
|
24
|
+
@passed += 1 if value == '.'
|
25
|
+
@failed += 1 if value == 'F'
|
24
26
|
end
|
25
|
-
@lines_failed += temp.uniq.size
|
26
27
|
end
|
27
28
|
|
28
|
-
def
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
def calc_percent_quality
|
33
|
-
return 0.00 if @lines_all.zero?
|
34
|
-
( (1.0 - @lines_failed.to_f / @lines_all) * 100).round(2)
|
29
|
+
def calc_percent_passed
|
30
|
+
return 0.00 if @passed.zero? && @failed.zero?
|
31
|
+
(@passed.to_f / (@passed + @failed) * 100).round(2)
|
35
32
|
end
|
36
33
|
end
|
37
34
|
end
|
@@ -2,15 +2,16 @@ module HomeWorkChecker
|
|
2
2
|
module TestRunStat
|
3
3
|
class RubyTestRun
|
4
4
|
def initialize(tmp_path, dirname)
|
5
|
-
@
|
5
|
+
@work_path = "#{tmp_path}/#{dirname}/test"
|
6
|
+
raise DirectoryExistError, "Archive '#{dirname}' is invalid" unless Dir::exist?(@work_path)
|
6
7
|
@passed = @failed = 0
|
7
8
|
end
|
8
9
|
|
9
10
|
def perform
|
10
|
-
Dir.foreach(
|
11
|
-
next unless File.file?("#{@
|
12
|
-
`rspec #{@
|
13
|
-
count_passed_failed("#{@
|
11
|
+
Dir.foreach(@work_path) do |p|
|
12
|
+
next unless File.file?("#{@work_path}/#{p}") && File.extname(p) == '.rb'
|
13
|
+
`rspec #{@work_path}/#{p} > #{@work_path}/#{p}.tmp`
|
14
|
+
count_passed_failed("#{@work_path}/#{p}.tmp")
|
14
15
|
end
|
15
16
|
calc_percent_passed
|
16
17
|
end
|
data/lib/hw_checker/zip.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hw_checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.47
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lv-LAMP-085
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|