Skip to content

Commit 38cb014

Browse files
comments
1 parent 22188ed commit 38cb014

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

hcl2/rule_transformer/rules/whitespace.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,19 @@ def to_list(
2222
if comment == "\n":
2323
return None
2424

25-
comment = comment.strip()
2625
comments = comment.split("\n")
2726

2827
result = []
2928
for comment in comments:
30-
if comment.startswith("//"):
31-
comment = comment[2:]
29+
comment = comment.strip()
3230

33-
elif comment.startswith("#"):
34-
comment = comment[1:]
31+
for delimiter in ("//", "/*", "#"):
32+
33+
if comment.startswith(delimiter):
34+
comment = comment[len(delimiter) :]
35+
36+
if comment.endswith("*/"):
37+
comment = comment[:-2]
3538

3639
if comment != "":
3740
result.append(comment.strip())

0 commit comments

Comments
 (0)