Skip to content

Commit

Permalink
Improve comment filtering with Regex from Panlint
Browse files Browse the repository at this point in the history
  • Loading branch information
jrha committed Mar 12, 2020
1 parent c5b1947 commit f9cdcd1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pan_indent_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
# Indentation to use when formatting
INDENT = ' '

RE_COMMENT = re.compile(r'(?:#|@{.*?}).*')


def supports_color():
"""
Expand Down Expand Up @@ -83,7 +85,7 @@ def main():
indent_change = 0

# Determine whether to send the line forwards or backwards for formatting
cleanline = re.sub(r'(#.*$)', ' ', line_stripped)
cleanline = RE_COMMENT.sub('# IGNORED COMMENT', line_stripped)
startmatch = re.findall(r'[{(]', cleanline)
endmatch = re.findall(r'[})]', cleanline)
curlyout = re.search(r'(^[)}])(.*)([{(])', cleanline)
Expand Down

0 comments on commit f9cdcd1

Please sign in to comment.