From b69ca5ecedd5f054f1de222d51ea01b8ff65324b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 1 Apr 2026 07:11:03 +0000 Subject: [PATCH] refactor: remove unintended this.standard mutation in getArgs() getArgs() called getStandard(document) and stored the result back to this.standard as a side effect. This was unintentional: loadSettings() is the only method that should update this.standard. The mutation made getArgs() harder to reason about (a method whose name implies it only builds an argument list also silently modifies state). In practice the behaviour was harmless because loadSettings() is called before every format() invocation, but the pattern could lead to confusion or subtle bugs if the call order changes. Use a local const instead so getArgs() remains a pure builder with no observable side effects on the instance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- extension.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extension.js b/extension.js index 6457e71..806dd3a 100644 --- a/extension.js +++ b/extension.js @@ -90,10 +90,10 @@ class PHPCBF { } args.push(tmpFileName); - this.standard = this.getStandard(document); + const standard = this.getStandard(document); - if (this.standard) { - args.push("--standard=" + this.standard); + if (standard) { + args.push("--standard=" + standard); } if (this.debug) { console.group("PHPCBF");