From 8172efd21823dbe130d024bddcdd30d6aded4fff Mon Sep 17 00:00:00 2001 From: Alexandru Chirila Date: Fri, 19 Jun 2020 13:27:31 +0300 Subject: [PATCH 1/8] Remove translation. --- translations/locale/ro/LC_MESSAGES/messages.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations/locale/ro/LC_MESSAGES/messages.po b/translations/locale/ro/LC_MESSAGES/messages.po index d2f160f..accb645 100644 --- a/translations/locale/ro/LC_MESSAGES/messages.po +++ b/translations/locale/ro/LC_MESSAGES/messages.po @@ -19,7 +19,7 @@ msgstr "" #: sample/python/test.py:6 msgid "Translate me" -msgstr "Traduce-mă" +msgstr "" #: sample/python/test.py:7 msgid "Don't translate me" From 910037a9da44cdbf57e348fb97a888bca1f1d7fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jun 2020 05:57:15 +0000 Subject: [PATCH 2/8] Bump eslint from 7.2.0 to 7.3.0 Bumps [eslint](https://github.com/eslint/eslint) from 7.2.0 to 7.3.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v7.2.0...v7.3.0) Signed-off-by: dependabot[bot] --- package-lock.json | 140 ++-------------------------------------------- package.json | 2 +- 2 files changed, 5 insertions(+), 137 deletions(-) diff --git a/package-lock.json b/package-lock.json index c84f52a..52f9409 100644 --- a/package-lock.json +++ b/package-lock.json @@ -446,12 +446,6 @@ "strip-ansi": "~0.1.0" } }, - "chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true - }, "clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -521,12 +515,6 @@ } } }, - "cli-width": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", - "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", - "dev": true - }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -660,9 +648,9 @@ "dev": true }, "eslint": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.2.0.tgz", - "integrity": "sha512-B3BtEyaDKC5MlfDa2Ha8/D6DsS4fju95zs0hjS3HdGazw+LNayai38A25qMppK37wWGWNYSPOR6oYzlz5MHsRQ==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.3.0.tgz", + "integrity": "sha512-dJMVXwfU5PT1cj2Nv2VPPrKahKTGdX+5Dh0Q3YuKt+Y2UhdL2YbzsVaBMyG9HC0tBismlv/r1+eZqs6SMIV38Q==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -671,6 +659,7 @@ "cross-spawn": "^7.0.2", "debug": "^4.0.1", "doctrine": "^3.0.0", + "enquirer": "^2.3.5", "eslint-scope": "^5.1.0", "eslint-utils": "^2.0.0", "eslint-visitor-keys": "^1.2.0", @@ -684,7 +673,6 @@ "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", "is-glob": "^4.0.0", "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", @@ -923,17 +911,6 @@ "strip-eof": "^1.0.0" } }, - "external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dev": true, - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - } - }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -1143,88 +1120,6 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, - "inquirer": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.2.0.tgz", - "integrity": "sha512-E0c4rPwr9ByePfNlTIB8z51kK1s2n6jrHuJeEHENl/sbq2G/S1auvibgEwNR4uSyiU+PiYHqSwsgGiXjG8p5ZQ==", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", - "cli-cursor": "^3.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.15", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.5.3", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -1753,12 +1648,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true - }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -1838,12 +1727,6 @@ "windows-release": "^3.1.0" } }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", @@ -2008,12 +1891,6 @@ "glob": "^7.1.3" } }, - "run-async": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", - "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", - "dev": true - }, "rxjs": { "version": "6.5.5", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", @@ -2231,15 +2108,6 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", diff --git a/package.json b/package.json index 31fe3ef..3ba993f 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "devDependencies": { "@zeit/ncc": "^0.22.3", "babel-eslint": "^10.1.0", - "eslint": "^7.2.0", + "eslint": "^7.3.0", "eslint-config-prettier": "^6.11.0", "eslint-plugin-prettier": "^3.1.4", "lint-staged": "^10.2.11", From 4816cf80976edd10208a6ed0dc51cbef57690352 Mon Sep 17 00:00:00 2001 From: Alexandru Chirila Date: Wed, 24 Jun 2020 12:04:55 +0300 Subject: [PATCH 3/8] Add file annotations --- dist/index.js | 32 +++++++++++++++++++++++++------- package-lock.json | 29 +++++++++++++++++++++++++++++ package.json | 1 + src/index.js | 32 +++++++++++++++++++++++++------- 4 files changed, 80 insertions(+), 14 deletions(-) diff --git a/dist/index.js b/dist/index.js index 452e6d1..ace70dd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -14180,6 +14180,7 @@ module.exports = { /* eslint-env node */ +const path = __webpack_require__(622); const core = __webpack_require__(470); const glob = __webpack_require__(281); const github = __webpack_require__(469); @@ -14214,11 +14215,14 @@ function getArrayInput(value) { } function parseFile(file) { - console.log("Parsing file:", file); + const relPath = path.relative(".", file); + console.log("Parsing file:", relPath); + const translation = po2json.parseFileSync(file); const language = translation[""].language.trim().toLowerCase(); const details = { language, + path: relPath, skipped: false, messageCount: 0, translatedMessageCount: 0, @@ -14229,9 +14233,9 @@ function parseFile(file) { (onlyLanguages.length > 0 && onlyLanguages.indexOf(language) === -1) || (ignoreLanguages.length > 0 && ignoreLanguages.indexOf(language) !== -1) ) { - console.log("Skipping file:", file); + console.log("Skipping file:", relPath); details.skipped = true; - details.summary = ` - "${file}" skipped`; + details.summary = ` - "${relPath}" skipped`; return details; } @@ -14245,7 +14249,7 @@ function parseFile(file) { (details.translatedMessageCount / details.messageCount) * 100 ).toFixed(2); - details.summary = ` - "${file}" translated ${details.coverage}% `; + details.summary = `${relPath} translated ${details.coverage}% `; details.summary += `(${details.translatedMessageCount} / ${details.messageCount} messages)`; console.log(details.summary); @@ -14255,13 +14259,14 @@ function parseFile(file) { async function main() { const globber = await glob.create(translationPath); - let allSummaries = []; + const perFileDetails = {}; let totalMessages = 0; let totalTranslatedMessages = 0; (await globber.glob()).forEach((file) => { const details = parseFile(file); - allSummaries.push(details.summary); + + perFileDetails[details.language] = details; totalMessages += details.messageCount; totalTranslatedMessages += details.translatedMessageCount; }); @@ -14299,7 +14304,20 @@ async function main() { output: { title: `${coverage.toFixed(0)}% i18n coverage.`, summary: summary + `, min-coverage: ${minCoverage}%`, - text: allSummaries.join("\n"), + text: Object.values(perFileDetails) + .map((details) => " - " + details.summary) + .join("\n"), + annotations: Object.values(perFileDetails) + .filter((details) => !details.skipped) + .map((details) => { + return { + path: details.path, + start_line: 0, + end_line: 0, + annotation_level: "notice", + message: details.summary, + }; + }), }, }); } diff --git a/package-lock.json b/package-lock.json index c84f52a..fe82ccf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1879,6 +1879,15 @@ "lines-and-columns": "^1.1.6" } }, + "path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", + "requires": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -1947,6 +1956,11 @@ "fast-diff": "^1.1.2" } }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" + }, "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -2303,6 +2317,21 @@ "punycode": "^2.1.0" } }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + } + } + }, "v8-compile-cache": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", diff --git a/package.json b/package.json index 31fe3ef..0c4805c 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "@actions/core": "^1.2.4", "@actions/github": "^3.0.0", "@actions/glob": "^0.1.0", + "path": "^0.12.7", "po2json": "^0.4.5" }, "devDependencies": { diff --git a/src/index.js b/src/index.js index 2c7d4c4..b088ed8 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,6 @@ /* eslint-env node */ +const path = require("path"); const core = require("@actions/core"); const glob = require("@actions/glob"); const github = require("@actions/github"); @@ -34,11 +35,14 @@ function getArrayInput(value) { } function parseFile(file) { - console.log("Parsing file:", file); + const relPath = path.relative(".", file); + console.log("Parsing file:", relPath); + const translation = po2json.parseFileSync(file); const language = translation[""].language.trim().toLowerCase(); const details = { language, + path: relPath, skipped: false, messageCount: 0, translatedMessageCount: 0, @@ -49,9 +53,9 @@ function parseFile(file) { (onlyLanguages.length > 0 && onlyLanguages.indexOf(language) === -1) || (ignoreLanguages.length > 0 && ignoreLanguages.indexOf(language) !== -1) ) { - console.log("Skipping file:", file); + console.log("Skipping file:", relPath); details.skipped = true; - details.summary = ` - "${file}" skipped`; + details.summary = ` - "${relPath}" skipped`; return details; } @@ -65,7 +69,7 @@ function parseFile(file) { (details.translatedMessageCount / details.messageCount) * 100 ).toFixed(2); - details.summary = ` - "${file}" translated ${details.coverage}% `; + details.summary = `${relPath} translated ${details.coverage}% `; details.summary += `(${details.translatedMessageCount} / ${details.messageCount} messages)`; console.log(details.summary); @@ -75,13 +79,14 @@ function parseFile(file) { async function main() { const globber = await glob.create(translationPath); - let allSummaries = []; + const perFileDetails = {}; let totalMessages = 0; let totalTranslatedMessages = 0; (await globber.glob()).forEach((file) => { const details = parseFile(file); - allSummaries.push(details.summary); + + perFileDetails[details.language] = details; totalMessages += details.messageCount; totalTranslatedMessages += details.translatedMessageCount; }); @@ -119,7 +124,20 @@ async function main() { output: { title: `${coverage.toFixed(0)}% i18n coverage.`, summary: summary + `, min-coverage: ${minCoverage}%`, - text: allSummaries.join("\n"), + text: Object.values(perFileDetails) + .map((details) => " - " + details.summary) + .join("\n"), + annotations: Object.values(perFileDetails) + .filter((details) => !details.skipped) + .map((details) => { + return { + path: details.path, + start_line: 0, + end_line: 0, + annotation_level: "notice", + message: details.summary, + }; + }), }, }); } From 2a142f966c1e3bd2a3328783a875570c6f02ff10 Mon Sep 17 00:00:00 2001 From: Alexandru Chirila Date: Wed, 24 Jun 2020 12:07:18 +0300 Subject: [PATCH 4/8] Typo --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index b088ed8..9e82b3f 100644 --- a/src/index.js +++ b/src/index.js @@ -55,7 +55,7 @@ function parseFile(file) { ) { console.log("Skipping file:", relPath); details.skipped = true; - details.summary = ` - "${relPath}" skipped`; + details.summary = `${relPath} skipped`; return details; } From 4bc4581d7c95ffda410037fc6aa40aa1e31ca2e4 Mon Sep 17 00:00:00 2001 From: Alexandru Chirila Date: Wed, 24 Jun 2020 12:10:18 +0300 Subject: [PATCH 5/8] Move to line 1. --- dist/index.js | 6 +++--- src/index.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/index.js b/dist/index.js index ace70dd..6721a3e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -14235,7 +14235,7 @@ function parseFile(file) { ) { console.log("Skipping file:", relPath); details.skipped = true; - details.summary = ` - "${relPath}" skipped`; + details.summary = `${relPath} skipped`; return details; } @@ -14312,8 +14312,8 @@ async function main() { .map((details) => { return { path: details.path, - start_line: 0, - end_line: 0, + start_line: 1, + end_line: 1, annotation_level: "notice", message: details.summary, }; diff --git a/src/index.js b/src/index.js index 9e82b3f..c36ee19 100644 --- a/src/index.js +++ b/src/index.js @@ -132,8 +132,8 @@ async function main() { .map((details) => { return { path: details.path, - start_line: 0, - end_line: 0, + start_line: 1, + end_line: 1, annotation_level: "notice", message: details.summary, }; From 8296d4aa82ed68b5031c3dad9c9a6adfa41480cb Mon Sep 17 00:00:00 2001 From: Alexandru Chirila Date: Wed, 24 Jun 2020 12:21:12 +0300 Subject: [PATCH 6/8] Add title and failure. --- src/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index c36ee19..ec2c236 100644 --- a/src/index.js +++ b/src/index.js @@ -129,12 +129,19 @@ async function main() { .join("\n"), annotations: Object.values(perFileDetails) .filter((details) => !details.skipped) + // TODO, handle more than 50 files. + .slice(0, 50) .map((details) => { + let level = "notice"; + if (minCoverage && details.coverage < minCoverage) { + level = "failure"; + } return { + title: `${details.coverage.toFixed(0)}% i18n coverage.`, path: details.path, start_line: 1, end_line: 1, - annotation_level: "notice", + annotation_level: level, message: details.summary, }; }), From d825014b55beb6b9be43d3ca11f5a93ab8aab399 Mon Sep 17 00:00:00 2001 From: Alexandru Chirila Date: Wed, 24 Jun 2020 12:21:39 +0300 Subject: [PATCH 7/8] New dist --- dist/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 6721a3e..20522e0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -14309,12 +14309,19 @@ async function main() { .join("\n"), annotations: Object.values(perFileDetails) .filter((details) => !details.skipped) + // TODO, handle more than 50 files. + .slice(0, 50) .map((details) => { + let level = "notice"; + if (minCoverage && details.coverage < minCoverage) { + level = "failure"; + } return { + title: `${details.coverage.toFixed(0)}% i18n coverage.`, path: details.path, start_line: 1, end_line: 1, - annotation_level: "notice", + annotation_level: level, message: details.summary, }; }), From 8627267f90ebaab59f01d3d792f1a7c96eba4a78 Mon Sep 17 00:00:00 2001 From: Alexandru Chirila Date: Wed, 24 Jun 2020 12:24:07 +0300 Subject: [PATCH 8/8] Fix converting float to string --- dist/index.js | 8 +++----- src/index.js | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index 20522e0..4e6d8e3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -14245,11 +14245,9 @@ function parseFile(file) { details.translatedMessageCount += msgstr[1] ? 1 : 0; }); - details.coverage = ( - (details.translatedMessageCount / details.messageCount) * - 100 - ).toFixed(2); - details.summary = `${relPath} translated ${details.coverage}% `; + details.coverage = + (details.translatedMessageCount / details.messageCount) * 100; + details.summary = `${relPath} translated ${details.coverage.toFixed(2)}% `; details.summary += `(${details.translatedMessageCount} / ${details.messageCount} messages)`; console.log(details.summary); diff --git a/src/index.js b/src/index.js index ec2c236..19813c7 100644 --- a/src/index.js +++ b/src/index.js @@ -65,11 +65,9 @@ function parseFile(file) { details.translatedMessageCount += msgstr[1] ? 1 : 0; }); - details.coverage = ( - (details.translatedMessageCount / details.messageCount) * - 100 - ).toFixed(2); - details.summary = `${relPath} translated ${details.coverage}% `; + details.coverage = + (details.translatedMessageCount / details.messageCount) * 100; + details.summary = `${relPath} translated ${details.coverage.toFixed(2)}% `; details.summary += `(${details.translatedMessageCount} / ${details.messageCount} messages)`; console.log(details.summary);