diff --git a/tests/test_cli.py b/tests/test_cli.py index ac1de0f..26d828d 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -597,31 +597,31 @@ class CommandLineTestCase(unittest.TestCase): '"defaultConfiguration": {"level": "error"}, "properties": {' '"description": "trailing spaces", "tags": [], "queryUri": ' '"https://yamllint.readthedocs.io/en/v1.32.0/rules.html#module' - '-yamllint.rules.trailing-spaces"}, "shortDescription": {"text": ' + '-yamllint.rules.trailing_spaces"}, "shortDescription": {"text": ' '"trailing spaces"}, "fullDescription": {"text": "trailing ' 'spaces"}, "helpUri": ' '"https://yamllint.readthedocs.io/en/v1.32.0/rules.html#module' - '-yamllint.rules.trailing-spaces", "help": {"text": "More info: ' + '-yamllint.rules.trailing_spaces", "help": {"text": "More info: ' 'https://yamllint.readthedocs.io/en/v1.32.0/rules.html#module' - '-yamllint.rules.trailing-spaces", "markdown": "[More info](' + '-yamllint.rules.trailing_spaces", "markdown": "[More info](' 'https://yamllint.readthedocs.io/en/v1.32.0/rules.html#module' - '-yamllint.rules.trailing-spaces)"}}, {"id": ' + '-yamllint.rules.trailing_spaces)"}}, {"id": ' '"new-line-at-end-of-file", "name": "NewLineAtEndOfFile", ' '"defaultConfiguration": {"level": "error"}, "properties": {' '"description": "no new line character at the end of file", ' '"tags": [], "queryUri": ' '"https://yamllint.readthedocs.io/en/v1.32.0/rules.html#module' - '-yamllint.rules.new-line-at-end-of-file"}, "shortDescription": ' + '-yamllint.rules.new_line_at_end_of_file"}, "shortDescription": ' '{"text": "no new line character at the end of file"}, ' '"fullDescription": {"text": "no new line character at the end ' 'of file"}, "helpUri": ' '"https://yamllint.readthedocs.io/en/v1.32.0/rules.html#module' - '-yamllint.rules.new-line-at-end-of-file", "help": {"text": ' + '-yamllint.rules.new_line_at_end_of_file", "help": {"text": ' '"More info: https://yamllint.readthedocs.io/en/v1.32.0/rules' - '.html#module-yamllint.rules.new-line-at-end-of-file", ' + '.html#module-yamllint.rules.new_line_at_end_of_file", ' '"markdown": "[More info](' 'https://yamllint.readthedocs.io/en/v1.32.0/rules.html#module' - '-yamllint.rules.new-line-at-end-of-file)"}}]}}, "results": [{' + '-yamllint.rules.new_line_at_end_of_file)"}}]}}, "results": [{' '"ruleId": "trailing-spaces", "ruleIndex": 0, "message": {' '"text": "trailing spaces (trailing-spaces)"}, "locations": [{' '"physicalLocation": {"artifactLocation": {"uri": "%s", ' @@ -651,16 +651,16 @@ class CommandLineTestCase(unittest.TestCase): '"defaultConfiguration": {"level": "warning"}, "properties": {' '"description": "missing document start \\"---\\"", "tags": [], ' '"queryUri": "https://yamllint.readthedocs.io/en/v1.32.0/rules' - '.html#module-yamllint.rules.document-start"}, ' + '.html#module-yamllint.rules.document_start"}, ' '"shortDescription": {"text": "missing document start ' '\\"---\\""}, "fullDescription": {"text": "missing document ' 'start \\"---\\""}, "helpUri": ' '"https://yamllint.readthedocs.io/en/v1.32.0/rules.html#module' - '-yamllint.rules.document-start", "help": {"text": "More info: ' + '-yamllint.rules.document_start", "help": {"text": "More info: ' 'https://yamllint.readthedocs.io/en/v1.32.0/rules.html#module' - '-yamllint.rules.document-start", "markdown": "[More info](' + '-yamllint.rules.document_start", "markdown": "[More info](' 'https://yamllint.readthedocs.io/en/v1.32.0/rules.html#module' - '-yamllint.rules.document-start)"}}]}}, "results": [{"ruleId": ' + '-yamllint.rules.document_start)"}}]}}, "results": [{"ruleId": ' '"document-start", "ruleIndex": 0, "message": {"text": "missing ' 'document start \\"---\\" (document-start)"}, "locations": [{' '"physicalLocation": {"artifactLocation": {"uri": "%s", ' diff --git a/yamllint/formatters/sarif.py b/yamllint/formatters/sarif.py index e9f73f6..9980be4 100644 --- a/yamllint/formatters/sarif.py +++ b/yamllint/formatters/sarif.py @@ -67,7 +67,7 @@ def format_results(results, no_warn): def format_rule(problem): uri = 'https://yamllint.readthedocs.io/en/v%s/rules.html#module-yamllint' \ - '.rules.%s' % (APP_VERSION, problem.rule) + '.rules.%s' % (APP_VERSION, problem.rule.replace('-', '_')) name = ''.join([word.capitalize() for word in problem.rule.split('-')])