Skip to content

Commit

Permalink
fix(#143) fix report generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Kucherenko committed Jun 18, 2018
1 parent cc1c06b commit f194546
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/jscpd.coffee
Expand Up @@ -51,6 +51,7 @@ class JsCpd
logger.profile 'Generate report time:'
@report = reportResult
@map = codeMap
report.thresholds @map.getPercentage()
report: @report, map: @map

if @options.blame
Expand Down
6 changes: 5 additions & 1 deletion src/report.coffee
Expand Up @@ -39,7 +39,11 @@ class Report
fs.writeFileSync(@options.output, dump or raw)
else
logger.warn 'output file is not provided'

return raw or dump

thresholds: (percent) ->
if @options.limit <= percent and percent isnt "0.00"
logger.error "ERROR: jscpd found too many duplicates over threshold"
process.exit(1)

exports.Report = Report
5 changes: 0 additions & 5 deletions src/reporters/_std-log.coffee
Expand Up @@ -77,9 +77,4 @@ module.exports = ->
duplicated lines out of
#{@map.numberOfLines} total lines of code.\n"

if @options.limit <= percent and percent isnt "0.00"
console.error log
console.error "ERROR: jscpd found too many duplicates over threshold"
process.exit(1)

return log

0 comments on commit f194546

Please sign in to comment.