diff --git a/checkov/common/util/docs_generator.py b/checkov/common/util/docs_generator.py index 385eaf323ee..c212e4e5fae 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,