Skip to content

Commit 59977b7

Browse files
committed
Allow ignoring comments
1 parent d82089a commit 59977b7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎language_check/main.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def parse_args():
4343
parser.add_argument('-s', '--spell-check-off', dest='spell_check',
4444
action='store_false',
4545
help='disable spell-checking rules')
46+
parser.add_argument('--ignore-comments', action='store_true',
47+
help='ignore lines that start with a hash')
4648
return parser.parse_args()
4749

4850

@@ -58,7 +60,8 @@ def get_rules(rules: str) -> set:
5860

5961
def get_text(file, encoding):
6062
with open(file, encoding=encoding) as f:
61-
text = ''.join(f.readlines())
63+
text = ''.join(line for line in f.readlines()
64+
if not line.lstrip().startswith('#'))
6265
return text
6366

6467

0 commit comments

Comments
 (0)