bake-toolkit 2.36.1 → 2.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bakeqac +50 -6
- data/lib/blocks/block.rb +2 -2
- data/lib/common/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10b5d02b50a49b9fe736175a016c46db97ae6e02
|
4
|
+
data.tar.gz: 32adc905319f5e567b4571fff3e0d22315cdecee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a1135b69cb94a02c4e15f8c3bb31d36f2ae293872ae3834a1d7dc3e6427cad1c1a2106840bf102db4113a305852002be8ef30ca9db62b4d344408a4b4d1946
|
7
|
+
data.tar.gz: ef5156a0c490148bab91dd25d14ef687b1a59c0b0c7ee210602c7c8592a817eb74ae6bb0c16aea01cef94e14e439935f747b7ae0161aa55258ed2bf030831f04
|
data/bin/bakeqac
CHANGED
@@ -75,6 +75,17 @@ def self.executeQacli(cmd, adminStepAndImmediateOutput = false)
|
|
75
75
|
return [success, consoleOutput, checkError]
|
76
76
|
end
|
77
77
|
|
78
|
+
def self.getLineNumbersOfFunctions(entities)
|
79
|
+
fileFunctions = []
|
80
|
+
entities.each do |e2|
|
81
|
+
if e2.has_key?("type") && e2["type"] == "function"
|
82
|
+
fileFunctions << e2["line"].to_i
|
83
|
+
end
|
84
|
+
end
|
85
|
+
fileFunctions.sort
|
86
|
+
return fileFunctions
|
87
|
+
end
|
88
|
+
|
78
89
|
###### PREREQUISITE 1: BAKEQAC OPTIONS ######
|
79
90
|
|
80
91
|
@options = BakeqacOptions.new(ARGV)
|
@@ -389,12 +400,15 @@ end
|
|
389
400
|
jsons = Dir.glob(@options.qacdata + "/prqa/reports/data/*.json")
|
390
401
|
|
391
402
|
maxComplexity = 0
|
392
|
-
|
403
|
+
numGreaterAllowed = 0
|
393
404
|
jsons.each do |file|
|
394
405
|
raw = File.read(file)
|
395
406
|
data = JSON.parse(raw)
|
396
407
|
|
397
408
|
filename = File.normalize(data["file"])
|
409
|
+
filename = @options.qacdata + "/../" + filename unless File.is_absolute?(filename) # only needed for UT
|
410
|
+
fileContent = nil
|
411
|
+
fileFunctions = []
|
398
412
|
|
399
413
|
if ProjectFilter.localFile(filename)
|
400
414
|
Bake.formatter.printAdditionalInfo(filename)
|
@@ -404,10 +418,40 @@ end
|
|
404
418
|
if e.has_key?("type") && e["type"] == "function"
|
405
419
|
if e.has_key?("metrics") && e["metrics"].has_key?("STCYC")
|
406
420
|
complexity = e["metrics"]["STCYC"].to_i
|
407
|
-
|
408
|
-
|
421
|
+
line = e["line"].to_i
|
422
|
+
allowed = 10
|
423
|
+
|
424
|
+
if complexity > 10 && File.exist?(filename)
|
425
|
+
if fileContent.nil?
|
426
|
+
fileContent = File.readlines(filename)
|
427
|
+
fileFunctions = getLineNumbersOfFunctions(entities)
|
428
|
+
end
|
429
|
+
lineOfLastFunction = 0
|
430
|
+
pos = fileFunctions.find_index(line)
|
431
|
+
if !pos.nil? and fileContent.length >= line
|
432
|
+
lineOfLastFunction = fileFunctions[pos-1] if pos > 0
|
433
|
+
# "line" received from json count from 1...
|
434
|
+
# ... so adjustment of lineOfLastFunction for array access not needed
|
435
|
+
# line-2 = index of array for line above the current function
|
436
|
+
(line-2).downto(lineOfLastFunction) do |i|
|
437
|
+
res = fileContent[i].scan(/METRIC\s+STCYC\s+(\d+)/)
|
438
|
+
if (res.length > 0)
|
439
|
+
allowed = res[0][0].to_i if res[0][0].to_i > 10
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
str = " #{e["name"]}:#{line}: cyclomatic complexity = #{complexity}"
|
446
|
+
if complexity > allowed
|
447
|
+
str = str + " (warning: accepted = #{allowed})"
|
448
|
+
elsif allowed > 10
|
449
|
+
str = str + " (info: accepted = #{allowed})"
|
450
|
+
end
|
451
|
+
|
452
|
+
complexity > allowed ? Bake.formatter.printWarning(str) : puts(str)
|
409
453
|
maxComplexity = complexity if complexity > maxComplexity
|
410
|
-
|
454
|
+
numGreaterAllowed +=1 if complexity > allowed
|
411
455
|
end
|
412
456
|
end
|
413
457
|
end
|
@@ -415,8 +459,8 @@ end
|
|
415
459
|
end
|
416
460
|
end
|
417
461
|
Bake.formatter.printInfo("\n**** Maximum cyclomatic complexity: #{maxComplexity} ****")
|
418
|
-
resultStr = "**** Number of functions with cyclomatic complexity
|
419
|
-
|
462
|
+
resultStr = "**** Number of functions with cyclomatic complexity more than accepted: #{numGreaterAllowed} ****"
|
463
|
+
numGreaterAllowed > 0 ? Bake.formatter.printWarning(resultStr) : Bake.formatter.printSuccess(resultStr)
|
420
464
|
else
|
421
465
|
Bake.formatter.printError("Failed to generate MDR report.")
|
422
466
|
end
|
data/lib/blocks/block.rb
CHANGED
@@ -416,7 +416,7 @@ module Bake
|
|
416
416
|
SyncOut.mutex.synchronize do
|
417
417
|
@outputStep = nil
|
418
418
|
SyncOut.startStream() if Bake.options.syncedOutput
|
419
|
-
if Bake.options.verbose >= 2 || isBuildBlock?
|
419
|
+
if Bake.options.verbose >= 2 || (isBuildBlock? && Bake.options.verbose >= 1)
|
420
420
|
typeStr = "Building"
|
421
421
|
if @prebuild
|
422
422
|
typeStr = "Using"
|
@@ -467,7 +467,7 @@ module Bake
|
|
467
467
|
Bake.formatter.printAdditionalInfo "**** #{typeStr} #{Block.block_counter} of #{@@num_projects}: #{@projectName} (#{@configName}) ****"
|
468
468
|
end
|
469
469
|
|
470
|
-
if Bake.options.verbose >= 2 || isBuildBlock?
|
470
|
+
if Bake.options.verbose >= 2 || (isBuildBlock? && Bake.options.verbose >= 1)
|
471
471
|
Block.inc_block_counter()
|
472
472
|
end
|
473
473
|
|
data/lib/common/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bake-toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.37.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Schaal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rtext
|