Skip to content

Commit

Permalink
normalize URL properly
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerJang27 committed Jul 24, 2024
1 parent b6ab3be commit f4ff3e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`Testing linter markdownlint test basic 1`] = `
"code": "MD025",
"file": "test_data/basic.in.md",
"issueClass": "ISSUE_CLASS_EXISTING",
"issueUrl": "https://github.com/DavidAnson/markdownlint/blob/v0.27.0/doc/md025.md",
"issueUrl": "https://github.com/DavidAnson/markdownlint/blob/vx.x.x/doc/md025.md",
"level": "LEVEL_LOW",
"line": "3",
"linter": "markdownlint",
Expand Down
2 changes: 1 addition & 1 deletion tests/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export interface FileIssue {
targetPath?: string;
autofixOptions?: Autofix[];
ranges?: any[];
issueUrl: string;
issueUrl?: string;
belowThreshold?: boolean;
}

Expand Down
7 changes: 7 additions & 0 deletions tests/utils/landing_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@ const normalizeRange = ({ filePath: _filePath = undefined, ...rest }) => ({
...rest,
});

const normalizeIssueUrl = (issueUrl: string) =>
issueUrl.replace(/markdownlint\/blob\/v[0-9.]+\//gm, "markdownlint/blob/vx.x.x/").trim();

const normalizeIssues = ({
message: _message,
targetPath: _targetPath,
file: _file,
issueUrl: _issueUrl,
autofixOptions: _autofixOptions = [],
ranges: _ranges,
...rest
Expand All @@ -107,6 +111,9 @@ const normalizeIssues = ({
if (_autofixOptions.length > 0) {
ret.autofixOptions = _autofixOptions.map(normalizeAutofix);
}
if (_issueUrl) {
ret.issueUrl = normalizeIssueUrl(_issueUrl);
}
return ret;
};

Expand Down

0 comments on commit f4ff3e7

Please sign in to comment.