generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add
ruleId
to Markdown format output
The `ruleId` links to the corresponding rule documentation.
- Loading branch information
1 parent
0ae2b03
commit 913007c
Showing
11 changed files
with
82 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
let version: string; | ||
let formattedVersion: string; | ||
|
||
// This module holds the CLI's version information (set via cli.js) for later retrieval (e.g. from middlewares/logger) | ||
export function setVersion(v: string) { | ||
export function setVersionInfo(v: string, p: string) { | ||
version = v; | ||
formattedVersion = `${v} (from ${p})`; | ||
} | ||
export function getVersion(): string { | ||
return version || ""; | ||
} | ||
export function getFormattedVersion(): string { | ||
return formattedVersion || ""; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import test from "ava"; | ||
import {setVersion, getVersion} from "../../../src/cli/version.js"; | ||
import {setVersionInfo, getFormattedVersion, getVersion} from "../../../src/cli/version.js"; | ||
|
||
test("Set and get version", (t) => { | ||
const sampleVersion = "1.2.3"; | ||
const sampleVersion2 = "4.5.6-foo.bar"; | ||
const samplePath = "/path/to/cli.js"; | ||
|
||
t.is(getFormattedVersion(), ""); | ||
t.is(getVersion(), ""); | ||
|
||
setVersion("1.2.3"); | ||
t.is(getVersion(), "1.2.3"); | ||
setVersionInfo(sampleVersion, samplePath); | ||
t.is(getFormattedVersion(), `${sampleVersion} (from ${samplePath})`); | ||
t.is(getVersion(), sampleVersion); | ||
|
||
setVersion("4.5.6-foo.bar"); | ||
t.is(getVersion(), "4.5.6-foo.bar"); | ||
setVersionInfo(sampleVersion2, samplePath); | ||
t.is(getFormattedVersion(), `${sampleVersion2} (from ${samplePath})`); | ||
t.is(getVersion(), sampleVersion2); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.