Skip to content

Commit 210e3cd

Browse files
fix - dont add spaces add the end of the line (before newline rule); remove unused import
1 parent e32a540 commit 210e3cd

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

hcl2/reconstructor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def _should_add_space_before(
8787

8888
# Space after commas in tuples and function arguments...
8989
if self._last_token_name == tokens.COMMA.lark_name():
90-
# ... except for last comma
91-
if token_type == tokens.RSQB.lark_name():
90+
# ... except before closing brackets or newlines
91+
if token_type in (tokens.RSQB.lark_name(), "NL_OR_COMMENT"):
9292
return False
9393
return True
9494

hcl2/rules/abstract.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from abc import ABC, abstractmethod
2-
from typing import Any, Union, List, Optional, Tuple, Callable
2+
from typing import Any, Union, List, Optional, Callable
33

44
from lark import Token, Tree
5-
from lark.exceptions import VisitError
65
from lark.tree import Meta
76

87
from hcl2.utils import SerializationOptions, SerializationContext

0 commit comments

Comments
 (0)