Don't use arguments keyword in gettext script

Causing SAST build to fail unnecessarily.

Follow-up to !19378.
This commit is contained in:
gfyoung 2018-08-19 00:16:05 -07:00
parent d195ee8f81
commit 8a3d565c8e
2 changed files with 10 additions and 5 deletions

View file

@ -0,0 +1,5 @@
---
title: Don't use arguments keyword in gettext script
merge_request: 21296
author: gfyoung
type: fixed

View file

@ -7,7 +7,7 @@ const {
} = require('gettext-extractor-vue');
const ensureSingleLine = require('../../app/assets/javascripts/locale/ensure_single_line.js');
const arguments = argumentsParser
const args = argumentsParser
.option('-f, --file <file>', 'Extract message from one single file')
.option('-a, --all', 'Extract message from all js/vue files')
.parse(process.argv);
@ -61,12 +61,12 @@ function printJson() {
console.log(JSON.stringify(messages));
}
if (arguments.file) {
vueParser.parseFile(arguments.file).then(() => printJson());
} else if (arguments.all) {
if (args.file) {
vueParser.parseFile(args.file).then(() => printJson());
} else if (args.all) {
vueParser.parseFilesGlob('{ee/app,app}/assets/javascripts/**/*.{js,vue}').then(() => printJson());
} else {
console.warn('ERROR: Please use the script correctly:');
arguments.outputHelp();
args.outputHelp();
process.exit(1);
}