From 6412a29aa9ff96655e57cfd0bd08f441e6d3d3f8 Mon Sep 17 00:00:00 2001 From: miguemasx Date: Tue, 17 Mar 2020 00:57:45 +0100 Subject: [PATCH] delete nodejs script --- Dockerfile | 3 -- bin/lcov-parse.js | 129 ---------------------------------------------- 2 files changed, 132 deletions(-) delete mode 100644 bin/lcov-parse.js diff --git a/Dockerfile b/Dockerfile index d847eef..e899ed6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,5 @@ FROM ruby:2.6.5-alpine -RUN apk add --update nodejs - COPY lib /action/lib -COPY bin /action/bin CMD ["ruby", "/action/lib/index.rb"] diff --git a/bin/lcov-parse.js b/bin/lcov-parse.js deleted file mode 100644 index 80d0e52..0000000 --- a/bin/lcov-parse.js +++ /dev/null @@ -1,129 +0,0 @@ -/* -Copyright (c) 2012, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://yuilibrary.com/license/ -*/ - -var fs = require('fs'), - path = require('path'); - -/* istanbul ignore next */ -var exists = fs.exists || path.exists; - -var walkFile = function (str, cb) { - var data = [], item; - - ['end_of_record'].concat(str.split('\n')).forEach(function (line) { - line = line.trim(); - var allparts = line.split(':'), - parts = [allparts.shift(), allparts.join(':')], - lines, fn; - - switch (parts[0].toUpperCase()) { - case 'TN': - item.title = parts[1].trim(); - break; - case 'SF': - item.file = parts.slice(1).join(':').trim(); - break; - case 'FNF': - item.functions.found = Number(parts[1].trim()); - break; - case 'FNH': - item.functions.hit = Number(parts[1].trim()); - break; - case 'LF': - item.lines.found = Number(parts[1].trim()); - break; - case 'LH': - item.lines.hit = Number(parts[1].trim()); - break; - case 'DA': - lines = parts[1].split(','); - item.lines.details.push({ - line: Number(lines[0]), - hit: Number(lines[1]) - }); - break; - case 'FN': - fn = parts[1].split(','); - item.functions.details.push({ - name: fn[1], - line: Number(fn[0]) - }); - break; - case 'FNDA': - fn = parts[1].split(','); - item.functions.details.some(function (i, k) { - if (i.name === fn[1] && i.hit === undefined) { - item.functions.details[k].hit = Number(fn[0]); - return true; - } - }); - break; - case 'BRDA': - fn = parts[1].split(','); - item.branches.details.push({ - line: Number(fn[0]), - block: Number(fn[1]), - branch: Number(fn[2]), - taken: ((fn[3] === '-') ? 0 : Number(fn[3])) - }); - break; - case 'BRF': - item.branches.found = Number(parts[1]); - break; - case 'BRH': - item.branches.hit = Number(parts[1]); - break; - } - - if (line.indexOf('end_of_record') > -1) { - data.push(item); - item = { - lines: { - found: 0, - hit: 0, - details: [] - }, - functions: { - hit: 0, - found: 0, - details: [] - }, - branches: { - hit: 0, - found: 0, - details: [] - } - }; - } - }); - - data.shift(); - - if (data.length) { - cb(null, data); - } else { - cb('Failed to parse string'); - } -}; - -var parse = function (file, cb) { - exists(file, function (x) { - if (!x) { - return walkFile(file, cb); - } - fs.readFile(file, 'utf8', function (err, str) { - walkFile(str, cb); - }); - }); - -}; - -var path = process.argv[2] -parse(path, function (err, data) { - console.log(JSON.stringify(data, null, 2)) -}); - -// console.log(process.argv[2])