From 5a718aa45d8b9f0039e2978cea1f13c0a0c3f76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=8C=AF=E5=AE=87?= <> Date: Fri, 7 Feb 2025 16:16:43 +0800 Subject: [PATCH] fix(lint): wrap linting commands in workspace directory context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙振宇 <> --- .../src/com/freeleaps/devops/lint/ESLint.groovy | 10 ++++++---- .../src/com/freeleaps/devops/lint/PyLint.groovy | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/first-class-pipeline/src/com/freeleaps/devops/lint/ESLint.groovy b/first-class-pipeline/src/com/freeleaps/devops/lint/ESLint.groovy index 1e525dcf..79e4f0d1 100644 --- a/first-class-pipeline/src/com/freeleaps/devops/lint/ESLint.groovy +++ b/first-class-pipeline/src/com/freeleaps/devops/lint/ESLint.groovy @@ -20,9 +20,11 @@ class ESLint extends LinterBase { } def doLint() { - steps.log.info("${linterType.linter}", "Install eslint dependencies...") - steps.sh("npm install -g ${deps.join(' ')}") - steps.log.info("${linterType.linter}", "Running eslint...") - steps.sh("eslint --config ${configs} ${workspace}") + steps.dir(workspace) { + steps.log.info("${linterType.linter}", "Install eslint dependencies...") + steps.sh("npm install --save-dev ${deps.join(' ')}") + steps.log.info("${linterType.linter}", "Running eslint...") + steps.sh("eslint --config ${configs} ${workspace}") + } } } \ No newline at end of file diff --git a/first-class-pipeline/src/com/freeleaps/devops/lint/PyLint.groovy b/first-class-pipeline/src/com/freeleaps/devops/lint/PyLint.groovy index 928a3119..e0b6c9c8 100644 --- a/first-class-pipeline/src/com/freeleaps/devops/lint/PyLint.groovy +++ b/first-class-pipeline/src/com/freeleaps/devops/lint/PyLint.groovy @@ -9,6 +9,8 @@ class PyLint extends LinterBase { } def doLint() { - steps.sh("pylint --rcfile=${configs} ${workspace}") + steps.dir(workspace) { + steps.sh("pylint --rcfile=${configs} ${workspace}") + } } } \ No newline at end of file