From e52c6708148ba51f00aec43bdba3232cc2f13ce5 Mon Sep 17 00:00:00 2001 From: James Woolfenden Date: Wed, 30 Nov 2022 16:03:43 +0000 Subject: [PATCH] fix doc links on windows --- checkov/common/util/docs_generator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/checkov/common/util/docs_generator.py b/checkov/common/util/docs_generator.py index 16f1b4af644..25558f76a3b 100644 --- a/checkov/common/util/docs_generator.py +++ b/checkov/common/util/docs_generator.py @@ -63,7 +63,12 @@ def print_checks(frameworks: Optional[List[str]] = None, use_bc_ids: bool = Fals def get_check_link(absolute_path: str) -> str: - return f'{CODE_LINK_BASE}{absolute_path.split("/checkov")[1]}' + # this will do nothing unless it's a windows path + absolute_path = absolute_path.replace('\\', '/') + temp = absolute_path.split("checkov") + # this will even work in the likely event that you're running checkov from a folder called checkov + link = f'{CODE_LINK_BASE}{temp[len(temp)-1]}' + return link def get_checks(frameworks: Optional[List[str]] = None, use_bc_ids: bool = False,