We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Checkov failure on F driver windows
**Describe the bug**
When running checkov from the jetbrains plugin using this command:
```checkov -s --bc-api-key **-**-**-** --repo-id jetbrains/extension -f F:\Code\modules\test2\s3.tf -o json ```
We are getting this error:
 File "c:\Python39\Scripts\checkov.cmd", line 53, in <module>
    run()
  File "C:\Users\MESH User\AppData\Roaming\Python\Python37\site-packages\checkov\main.py", line 232, in run
    repo_root_for_plan_enrichment=config.repo_root_for_plan_enrichment)
  File "C:\Users\MESH User\AppData\Roaming\Python\Python37\site-packages\checkov\common\runners\runner_registry.py", line 66, in run
    for scan_report in reports:
  File "C:\Python37\lib\concurrent\futures\_base.py", line 598, in result_iterator
    yield fs.pop().result()
  File "C:\Python37\lib\concurrent\futures\_base.py", line 428, in result
    return self.__get_result()
  File "C:\Python37\lib\concurrent\futures\_base.py", line 384, in __get_result
    raise self._exception
  File "C:\Python37\lib\concurrent\futures\thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\MESH User\AppData\Roaming\Python\Python37\site-packages\checkov\common\runners\runner_registry.py", line 63, in <lambda>
    runner_filter=self.runner_filter, collect_skip_comments=collect_skip_comments),
  File "C:\Users\MESH User\AppData\Roaming\Python\Python37\site-packages\checkov\terraform\runner.py", line 102, in run
    self.check_tf_definition(report, root_folder, runner_filter, collect_skip_comments)
  File "C:\Users\MESH User\AppData\Roaming\Python\Python37\site-packages\checkov\terraform\runner.py", line 195, in check_tf_definition
    scanned_file, runner_filter, abs_referrer)
  File "C:\Users\MESH User\AppData\Roaming\Python\Python37\site-packages\checkov\terraform\runner.py", line 206, in run_all_blocks
    scanned_file, block_type, runner_filter, None, module_referrer)
  File "C:\Users\MESH User\AppData\Roaming\Python\Python37\site-packages\checkov\terraform\runner.py", line 289, in run_block
    caller_file_line_range=caller_file_line_range)
  File "C:\Users\MESH User\AppData\Roaming\Python\Python37\site-packages\checkov\common\output\record.py", line 44, in __init__
    self.repo_file_path = convert_to_unix_path(f'/{os.path.relpath(file_abs_path)}')  # matches file paths given in the BC platform and should always be a unix path
  File "C:\Python37\lib\ntpath.py", line 562, in relpath
    path_drive, start_drive))
ValueError: path is on mount 'F:', start on mount 'C:'

**To Reproduce**
Steps to reproduce the behavior:
1. Run checkov on a driver which is not the driver checkov is installed on windows.


**Additional context**
Add any other context about the problem here (e.g. code snippets).


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `checkov/common/output/record.py`
Content:
```
1 import os
2 import re
3 
4 from colorama import init, Fore, Style
5 from termcolor import colored
6 
7 from checkov.common.models.enums import CheckResult
8 from checkov.common.util.file_utils import convert_to_unix_path
9 
10 init(autoreset=True)
11 
12 
13 class Record:
14     check_id = ""
15     check_name = ""
16     check_result = None
17     check_class = ""
18     code_block = ""
19     file_path = ""
20     file_line_range = []
21     caller_file_path = None           # When created from a module
22     caller_file_line_range = None     #
23     resource = ""
24     guideline = None
25     fixed_definition = None
26     entity_tags = None
27 
28     def __init__(self, check_id, check_name, check_result, code_block, file_path, file_line_range, resource,
29                  evaluations, check_class, file_abs_path, entity_tags=None,
30                  caller_file_path=None, caller_file_line_range=None, bc_check_id=None):
31         """
32         :param evaluations: A dict with the key being the variable name, value being a dict containing:
33                              - 'var_file'
34                              - 'value'
35                              - 'definitions', a list of dicts which contain 'definition_expression'
36         """
37         self.check_id = check_id
38         self.bc_check_id = bc_check_id
39         self.check_name = check_name
40         self.check_result = check_result
41         self.code_block = code_block
42         self.file_path = file_path
43         self.file_abs_path = file_abs_path
44         self.repo_file_path = convert_to_unix_path(f'/{os.path.relpath(file_abs_path)}')  # matches file paths given in the BC platform and should always be a unix path
45         self.file_line_range = file_line_range
46         self.resource = resource
47         self.evaluations = evaluations
48         self.check_class = check_class
49         self.fixed_definition = None
50         self.entity_tags = entity_tags
51         self.caller_file_path = caller_file_path
52         self.caller_file_line_range = caller_file_line_range
53 
54     def set_guideline(self, guideline):
55         self.guideline = guideline
56 
57     @staticmethod
58     def _trim_special_chars(expression):
59         return "".join(re.findall(r'[^ ${\}]+', expression))
60 
61     def _is_expression_in_code_lines(self, expression):
62         stripped_expression = self._trim_special_chars(expression)
63         return any(stripped_expression in self._trim_special_chars(line) for (_, line) in self.code_block)
64 
65     @staticmethod
66     def _code_line_string(code_block):
67         string_block = ''
68         last_line_number, _ = code_block[-1]
69 
70         for (line_num, line) in code_block:
71             spaces = ' ' * (len(str(last_line_number)) - len(str(line_num)))
72             if line.lstrip().startswith('#'):
73                 string_block += "\t\t" + Fore.WHITE + str(line_num) + spaces + ' | ' + line
74             else:
75                 string_block += "\t\t" + Fore.WHITE + str(line_num) + spaces + ' | ' + Fore.YELLOW + line
76         return string_block
77 
78     def to_string(self, compact=False, use_bc_ids=False):
79         status = ''
80         evaluation_message = f''
81         status_color = "white"
82         if self.check_result['result'] == CheckResult.PASSED:
83             status = CheckResult.PASSED.name
84             status_color = "green"
85         elif self.check_result['result'] == CheckResult.FAILED:
86             status = CheckResult.FAILED.name
87             status_color = "red"
88         elif self.check_result['result'] == CheckResult.SKIPPED:
89             status = CheckResult.SKIPPED.name
90             status_color = 'blue'
91             suppress_comment = "\tSuppress comment: {}\n".format(self.check_result['suppress_comment'])
92 
93         check_message = colored("Check: {}: \"{}\"\n".format(self.get_output_id(use_bc_ids), self.check_name), "white")
94         guideline_message = ''
95         if self.guideline:
96             guideline_message = "\tGuide: " + Style.BRIGHT + colored(f"{self.guideline}\n", 'blue', attrs=['underline']) + Style.RESET_ALL
97         file_details = colored(
98             "\tFile: {}:{}\n".format(self.file_path, "-".join([str(x) for x in self.file_line_range])),
99             "magenta")
100         code_lines = ""
101         if self.code_block:
102             code_lines = "\n{}\n".format("".join(
103                 [self._code_line_string(self.code_block)]))
104         caller_file_details = ""
105         if self.caller_file_path and self.caller_file_line_range:
106             caller_file_details = colored(
107                 "\tCalling File: {}:{}\n".format(self.caller_file_path,
108                                                  "-".join([str(x) for x in self.caller_file_line_range])),
109                 "magenta")
110         if self.evaluations:
111             for (var_name, var_evaluations) in self.evaluations.items():
112                 var_file = var_evaluations['var_file']
113                 var_definitions = var_evaluations['definitions']
114                 for definition_obj in var_definitions:
115                     definition_expression = definition_obj["definition_expression"]
116                     if self._is_expression_in_code_lines(definition_expression):
117                         evaluation_message = evaluation_message + colored(
118                             f'\tVariable {colored(var_name, "yellow")} (of {var_file}) evaluated to value "{colored(var_evaluations["value"], "yellow")}" '
119                             f'in expression: {colored(definition_obj["definition_name"] + " = ", "yellow")}{colored(definition_obj["definition_expression"], "yellow")}\n',
120                             'white')
121         status_message = colored("\t{} for resource: {}\n".format(status, self.resource), status_color)
122         if self.check_result['result'] == CheckResult.FAILED and code_lines and not compact:
123             return check_message + status_message + file_details + caller_file_details + guideline_message + code_lines + evaluation_message
124 
125         if self.check_result['result'] == CheckResult.SKIPPED:
126             return check_message + status_message + suppress_comment + file_details + caller_file_details + guideline_message
127         else:
128             return check_message + status_message + file_details + caller_file_details + evaluation_message + guideline_message
129 
130     def __str__(self):
131         return self.to_string()
132 
133     def get_output_id(self, use_bc_ids: bool) -> str:
134         return self.bc_check_id if self.bc_check_id and use_bc_ids else self.check_id
135 
136     def get_unique_string(self):
137         return f"{self.check_id}.{self.check_result}.{self.file_abs_path}.{self.file_line_range}.{self.resource}"
138
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/checkov/common/output/record.py b/checkov/common/output/record.py
--- a/checkov/common/output/record.py
+++ b/checkov/common/output/record.py
@@ -1,5 +1,7 @@
 import os
 import re
+from pathlib import Path
+from typing import Union
 
 from colorama import init, Fore, Style
 from termcolor import colored
@@ -41,7 +43,7 @@
         self.code_block = code_block
         self.file_path = file_path
         self.file_abs_path = file_abs_path
-        self.repo_file_path = convert_to_unix_path(f'/{os.path.relpath(file_abs_path)}')  # matches file paths given in the BC platform and should always be a unix path
+        self.repo_file_path = self._determine_repo_file_path(file_abs_path)
         self.file_line_range = file_line_range
         self.resource = resource
         self.evaluations = evaluations
@@ -51,6 +53,15 @@
         self.caller_file_path = caller_file_path
         self.caller_file_line_range = caller_file_line_range
 
+    @staticmethod
+    def _determine_repo_file_path(file_path: Union[str, "os.PathLike[str]"]) -> str:
+        # matches file paths given in the BC platform and should always be a unix path
+        repo_file_path = Path(file_path)
+        if Path.cwd().drive == repo_file_path.drive:
+            return convert_to_unix_path(f"/{os.path.relpath(repo_file_path)}").replace("/..", "")
+
+        return f"/{'/'.join(repo_file_path.parts[1:])}"
+
     def set_guideline(self, guideline):
         self.guideline = guideline

{"golden_diff": "diff --git a/checkov/common/output/record.py b/checkov/common/output/record.py\n--- a/checkov/common/output/record.py\n+++ b/checkov/common/output/record.py\n@@ -1,5 +1,7 @@\n import os\n import re\n+from pathlib import Path\n+from typing import Union\n \n from colorama import init, Fore, Style\n from termcolor import colored\n@@ -41,7 +43,7 @@\n         self.code_block = code_block\n         self.file_path = file_path\n         self.file_abs_path = file_abs_path\n-        self.repo_file_path = convert_to_unix_path(f'/{os.path.relpath(file_abs_path)}')  # matches file paths given in the BC platform and should always be a unix path\n+        self.repo_file_path = self._determine_repo_file_path(file_abs_path)\n         self.file_line_range = file_line_range\n         self.resource = resource\n         self.evaluations = evaluations\n@@ -51,6 +53,15 @@\n         self.caller_file_path = caller_file_path\n         self.caller_file_line_range = caller_file_line_range\n \n+    @staticmethod\n+    def _determine_repo_file_path(file_path: Union[str, \"os.PathLike[str]\"]) -> str:\n+        # matches file paths given in the BC platform and should always be a unix path\n+        repo_file_path = Path(file_path)\n+        if Path.cwd().drive == repo_file_path.drive:\n+            return convert_to_unix_path(f\"/{os.path.relpath(repo_file_path)}\").replace(\"/..\", \"\")\n+\n+        return f\"/{'/'.join(repo_file_path.parts[1:])}\"\n+\n     def set_guideline(self, guideline):\n         self.guideline = guideline\n", "issue": "Checkov failure on F driver windows\n**Describe the bug**\r\nWhen running checkov from the jetbrains plugin using this command:\r\n```checkov -s --bc-api-key **-**-**-** --repo-id jetbrains/extension -f F:\\Code\\modules\\test2\\s3.tf -o json ```\r\nWe are getting this error:\r\n File \"c:\\Python39\\Scripts\\checkov.cmd\", line 53, in <module>\r\n    run()\r\n  File \"C:\\Users\\MESH User\\AppData\\Roaming\\Python\\Python37\\site-packages\\checkov\\main.py\", line 232, in run\r\n    repo_root_for_plan_enrichment=config.repo_root_for_plan_enrichment)\r\n  File \"C:\\Users\\MESH User\\AppData\\Roaming\\Python\\Python37\\site-packages\\checkov\\common\\runners\\runner_registry.py\", line 66, in run\r\n    for scan_report in reports:\r\n  File \"C:\\Python37\\lib\\concurrent\\futures\\_base.py\", line 598, in result_iterator\r\n    yield fs.pop().result()\r\n  File \"C:\\Python37\\lib\\concurrent\\futures\\_base.py\", line 428, in result\r\n    return self.__get_result()\r\n  File \"C:\\Python37\\lib\\concurrent\\futures\\_base.py\", line 384, in __get_result\r\n    raise self._exception\r\n  File \"C:\\Python37\\lib\\concurrent\\futures\\thread.py\", line 57, in run\r\n    result = self.fn(*self.args, **self.kwargs)\r\n  File \"C:\\Users\\MESH User\\AppData\\Roaming\\Python\\Python37\\site-packages\\checkov\\common\\runners\\runner_registry.py\", line 63, in <lambda>\r\n    runner_filter=self.runner_filter, collect_skip_comments=collect_skip_comments),\r\n  File \"C:\\Users\\MESH User\\AppData\\Roaming\\Python\\Python37\\site-packages\\checkov\\terraform\\runner.py\", line 102, in run\r\n    self.check_tf_definition(report, root_folder, runner_filter, collect_skip_comments)\r\n  File \"C:\\Users\\MESH User\\AppData\\Roaming\\Python\\Python37\\site-packages\\checkov\\terraform\\runner.py\", line 195, in check_tf_definition\r\n    scanned_file, runner_filter, abs_referrer)\r\n  File \"C:\\Users\\MESH User\\AppData\\Roaming\\Python\\Python37\\site-packages\\checkov\\terraform\\runner.py\", line 206, in run_all_blocks\r\n    scanned_file, block_type, runner_filter, None, module_referrer)\r\n  File \"C:\\Users\\MESH User\\AppData\\Roaming\\Python\\Python37\\site-packages\\checkov\\terraform\\runner.py\", line 289, in run_block\r\n    caller_file_line_range=caller_file_line_range)\r\n  File \"C:\\Users\\MESH User\\AppData\\Roaming\\Python\\Python37\\site-packages\\checkov\\common\\output\\record.py\", line 44, in __init__\r\n    self.repo_file_path = convert_to_unix_path(f'/{os.path.relpath(file_abs_path)}')  # matches file paths given in the BC platform and should always be a unix path\r\n  File \"C:\\Python37\\lib\\ntpath.py\", line 562, in relpath\r\n    path_drive, start_drive))\r\nValueError: path is on mount 'F:', start on mount 'C:'\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. Run checkov on a driver which is not the driver checkov is installed on windows.\r\n\r\n\r\n**Additional context**\r\nAdd any other context about the problem here (e.g. code snippets).\r\n\n", "before_files": [{"content": "import os\nimport re\n\nfrom colorama import init, Fore, Style\nfrom termcolor import colored\n\nfrom checkov.common.models.enums import CheckResult\nfrom checkov.common.util.file_utils import convert_to_unix_path\n\ninit(autoreset=True)\n\n\nclass Record:\n    check_id = \"\"\n    check_name = \"\"\n    check_result = None\n    check_class = \"\"\n    code_block = \"\"\n    file_path = \"\"\n    file_line_range = []\n    caller_file_path = None           # When created from a module\n    caller_file_line_range = None     #\n    resource = \"\"\n    guideline = None\n    fixed_definition = None\n    entity_tags = None\n\n    def __init__(self, check_id, check_name, check_result, code_block, file_path, file_line_range, resource,\n                 evaluations, check_class, file_abs_path, entity_tags=None,\n                 caller_file_path=None, caller_file_line_range=None, bc_check_id=None):\n        \"\"\"\n        :param evaluations: A dict with the key being the variable name, value being a dict containing:\n                             - 'var_file'\n                             - 'value'\n                             - 'definitions', a list of dicts which contain 'definition_expression'\n        \"\"\"\n        self.check_id = check_id\n        self.bc_check_id = bc_check_id\n        self.check_name = check_name\n        self.check_result = check_result\n        self.code_block = code_block\n        self.file_path = file_path\n        self.file_abs_path = file_abs_path\n        self.repo_file_path = convert_to_unix_path(f'/{os.path.relpath(file_abs_path)}')  # matches file paths given in the BC platform and should always be a unix path\n        self.file_line_range = file_line_range\n        self.resource = resource\n        self.evaluations = evaluations\n        self.check_class = check_class\n        self.fixed_definition = None\n        self.entity_tags = entity_tags\n        self.caller_file_path = caller_file_path\n        self.caller_file_line_range = caller_file_line_range\n\n    def set_guideline(self, guideline):\n        self.guideline = guideline\n\n    @staticmethod\n    def _trim_special_chars(expression):\n        return \"\".join(re.findall(r'[^ ${\\}]+', expression))\n\n    def _is_expression_in_code_lines(self, expression):\n        stripped_expression = self._trim_special_chars(expression)\n        return any(stripped_expression in self._trim_special_chars(line) for (_, line) in self.code_block)\n\n    @staticmethod\n    def _code_line_string(code_block):\n        string_block = ''\n        last_line_number, _ = code_block[-1]\n\n        for (line_num, line) in code_block:\n            spaces = ' ' * (len(str(last_line_number)) - len(str(line_num)))\n            if line.lstrip().startswith('#'):\n                string_block += \"\\t\\t\" + Fore.WHITE + str(line_num) + spaces + ' | ' + line\n            else:\n                string_block += \"\\t\\t\" + Fore.WHITE + str(line_num) + spaces + ' | ' + Fore.YELLOW + line\n        return string_block\n\n    def to_string(self, compact=False, use_bc_ids=False):\n        status = ''\n        evaluation_message = f''\n        status_color = \"white\"\n        if self.check_result['result'] == CheckResult.PASSED:\n            status = CheckResult.PASSED.name\n            status_color = \"green\"\n        elif self.check_result['result'] == CheckResult.FAILED:\n            status = CheckResult.FAILED.name\n            status_color = \"red\"\n        elif self.check_result['result'] == CheckResult.SKIPPED:\n            status = CheckResult.SKIPPED.name\n            status_color = 'blue'\n            suppress_comment = \"\\tSuppress comment: {}\\n\".format(self.check_result['suppress_comment'])\n\n        check_message = colored(\"Check: {}: \\\"{}\\\"\\n\".format(self.get_output_id(use_bc_ids), self.check_name), \"white\")\n        guideline_message = ''\n        if self.guideline:\n            guideline_message = \"\\tGuide: \" + Style.BRIGHT + colored(f\"{self.guideline}\\n\", 'blue', attrs=['underline']) + Style.RESET_ALL\n        file_details = colored(\n            \"\\tFile: {}:{}\\n\".format(self.file_path, \"-\".join([str(x) for x in self.file_line_range])),\n            \"magenta\")\n        code_lines = \"\"\n        if self.code_block:\n            code_lines = \"\\n{}\\n\".format(\"\".join(\n                [self._code_line_string(self.code_block)]))\n        caller_file_details = \"\"\n        if self.caller_file_path and self.caller_file_line_range:\n            caller_file_details = colored(\n                \"\\tCalling File: {}:{}\\n\".format(self.caller_file_path,\n                                                 \"-\".join([str(x) for x in self.caller_file_line_range])),\n                \"magenta\")\n        if self.evaluations:\n            for (var_name, var_evaluations) in self.evaluations.items():\n                var_file = var_evaluations['var_file']\n                var_definitions = var_evaluations['definitions']\n                for definition_obj in var_definitions:\n                    definition_expression = definition_obj[\"definition_expression\"]\n                    if self._is_expression_in_code_lines(definition_expression):\n                        evaluation_message = evaluation_message + colored(\n                            f'\\tVariable {colored(var_name, \"yellow\")} (of {var_file}) evaluated to value \"{colored(var_evaluations[\"value\"], \"yellow\")}\" '\n                            f'in expression: {colored(definition_obj[\"definition_name\"] + \" = \", \"yellow\")}{colored(definition_obj[\"definition_expression\"], \"yellow\")}\\n',\n                            'white')\n        status_message = colored(\"\\t{} for resource: {}\\n\".format(status, self.resource), status_color)\n        if self.check_result['result'] == CheckResult.FAILED and code_lines and not compact:\n            return check_message + status_message + file_details + caller_file_details + guideline_message + code_lines + evaluation_message\n\n        if self.check_result['result'] == CheckResult.SKIPPED:\n            return check_message + status_message + suppress_comment + file_details + caller_file_details + guideline_message\n        else:\n            return check_message + status_message + file_details + caller_file_details + evaluation_message + guideline_message\n\n    def __str__(self):\n        return self.to_string()\n\n    def get_output_id(self, use_bc_ids: bool) -> str:\n        return self.bc_check_id if self.bc_check_id and use_bc_ids else self.check_id\n\n    def get_unique_string(self):\n        return f\"{self.check_id}.{self.check_result}.{self.file_abs_path}.{self.file_line_range}.{self.resource}\"\n", "path": "checkov/common/output/record.py"}], "after_files": [{"content": "import os\nimport re\nfrom pathlib import Path\nfrom typing import Union\n\nfrom colorama import init, Fore, Style\nfrom termcolor import colored\n\nfrom checkov.common.models.enums import CheckResult\nfrom checkov.common.util.file_utils import convert_to_unix_path\n\ninit(autoreset=True)\n\n\nclass Record:\n    check_id = \"\"\n    check_name = \"\"\n    check_result = None\n    check_class = \"\"\n    code_block = \"\"\n    file_path = \"\"\n    file_line_range = []\n    caller_file_path = None           # When created from a module\n    caller_file_line_range = None     #\n    resource = \"\"\n    guideline = None\n    fixed_definition = None\n    entity_tags = None\n\n    def __init__(self, check_id, check_name, check_result, code_block, file_path, file_line_range, resource,\n                 evaluations, check_class, file_abs_path, entity_tags=None,\n                 caller_file_path=None, caller_file_line_range=None, bc_check_id=None):\n        \"\"\"\n        :param evaluations: A dict with the key being the variable name, value being a dict containing:\n                             - 'var_file'\n                             - 'value'\n                             - 'definitions', a list of dicts which contain 'definition_expression'\n        \"\"\"\n        self.check_id = check_id\n        self.bc_check_id = bc_check_id\n        self.check_name = check_name\n        self.check_result = check_result\n        self.code_block = code_block\n        self.file_path = file_path\n        self.file_abs_path = file_abs_path\n        self.repo_file_path = self._determine_repo_file_path(file_abs_path)\n        self.file_line_range = file_line_range\n        self.resource = resource\n        self.evaluations = evaluations\n        self.check_class = check_class\n        self.fixed_definition = None\n        self.entity_tags = entity_tags\n        self.caller_file_path = caller_file_path\n        self.caller_file_line_range = caller_file_line_range\n\n    @staticmethod\n    def _determine_repo_file_path(file_path: Union[str, \"os.PathLike[str]\"]) -> str:\n        # matches file paths given in the BC platform and should always be a unix path\n        repo_file_path = Path(file_path)\n        if Path.cwd().drive == repo_file_path.drive:\n            return convert_to_unix_path(f\"/{os.path.relpath(repo_file_path)}\").replace(\"/..\", \"\")\n\n        return f\"/{'/'.join(repo_file_path.parts[1:])}\"\n\n    def set_guideline(self, guideline):\n        self.guideline = guideline\n\n    @staticmethod\n    def _trim_special_chars(expression):\n        return \"\".join(re.findall(r'[^ ${\\}]+', expression))\n\n    def _is_expression_in_code_lines(self, expression):\n        stripped_expression = self._trim_special_chars(expression)\n        return any(stripped_expression in self._trim_special_chars(line) for (_, line) in self.code_block)\n\n    @staticmethod\n    def _code_line_string(code_block):\n        string_block = ''\n        last_line_number, _ = code_block[-1]\n\n        for (line_num, line) in code_block:\n            spaces = ' ' * (len(str(last_line_number)) - len(str(line_num)))\n            if line.lstrip().startswith('#'):\n                string_block += \"\\t\\t\" + Fore.WHITE + str(line_num) + spaces + ' | ' + line\n            else:\n                string_block += \"\\t\\t\" + Fore.WHITE + str(line_num) + spaces + ' | ' + Fore.YELLOW + line\n        return string_block\n\n    def to_string(self, compact=False, use_bc_ids=False):\n        status = ''\n        evaluation_message = f''\n        status_color = \"white\"\n        if self.check_result['result'] == CheckResult.PASSED:\n            status = CheckResult.PASSED.name\n            status_color = \"green\"\n        elif self.check_result['result'] == CheckResult.FAILED:\n            status = CheckResult.FAILED.name\n            status_color = \"red\"\n        elif self.check_result['result'] == CheckResult.SKIPPED:\n            status = CheckResult.SKIPPED.name\n            status_color = 'blue'\n            suppress_comment = \"\\tSuppress comment: {}\\n\".format(self.check_result['suppress_comment'])\n\n        check_message = colored(\"Check: {}: \\\"{}\\\"\\n\".format(self.get_output_id(use_bc_ids), self.check_name), \"white\")\n        guideline_message = ''\n        if self.guideline:\n            guideline_message = \"\\tGuide: \" + Style.BRIGHT + colored(f\"{self.guideline}\\n\", 'blue', attrs=['underline']) + Style.RESET_ALL\n        file_details = colored(\n            \"\\tFile: {}:{}\\n\".format(self.file_path, \"-\".join([str(x) for x in self.file_line_range])),\n            \"magenta\")\n        code_lines = \"\"\n        if self.code_block:\n            code_lines = \"\\n{}\\n\".format(\"\".join(\n                [self._code_line_string(self.code_block)]))\n        caller_file_details = \"\"\n        if self.caller_file_path and self.caller_file_line_range:\n            caller_file_details = colored(\n                \"\\tCalling File: {}:{}\\n\".format(self.caller_file_path,\n                                                 \"-\".join([str(x) for x in self.caller_file_line_range])),\n                \"magenta\")\n        if self.evaluations:\n            for (var_name, var_evaluations) in self.evaluations.items():\n                var_file = var_evaluations['var_file']\n                var_definitions = var_evaluations['definitions']\n                for definition_obj in var_definitions:\n                    definition_expression = definition_obj[\"definition_expression\"]\n                    if self._is_expression_in_code_lines(definition_expression):\n                        evaluation_message = evaluation_message + colored(\n                            f'\\tVariable {colored(var_name, \"yellow\")} (of {var_file}) evaluated to value \"{colored(var_evaluations[\"value\"], \"yellow\")}\" '\n                            f'in expression: {colored(definition_obj[\"definition_name\"] + \" = \", \"yellow\")}{colored(definition_obj[\"definition_expression\"], \"yellow\")}\\n',\n                            'white')\n        status_message = colored(\"\\t{} for resource: {}\\n\".format(status, self.resource), status_color)\n        if self.check_result['result'] == CheckResult.FAILED and code_lines and not compact:\n            return check_message + status_message + file_details + caller_file_details + guideline_message + code_lines + evaluation_message\n\n        if self.check_result['result'] == CheckResult.SKIPPED:\n            return check_message + status_message + suppress_comment + file_details + caller_file_details + guideline_message\n        else:\n            return check_message + status_message + file_details + caller_file_details + evaluation_message + guideline_message\n\n    def __str__(self):\n        return self.to_string()\n\n    def get_output_id(self, use_bc_ids: bool) -> str:\n        return self.bc_check_id if self.bc_check_id and use_bc_ids else self.check_id\n\n    def get_unique_string(self):\n        return f\"{self.check_id}.{self.check_result}.{self.file_abs_path}.{self.file_line_range}.{self.resource}\"\n", "path": "checkov/common/output/record.py"}]}