Skip to content

Commit 52376b9

Browse files
committed
Use rule loader to load single rule in toml-lint
1 parent 3b74752 commit 52376b9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

detection_rules/main.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,11 @@ def name_to_filename(name):
114114

115115

116116
@root.command('toml-lint')
117-
@click.option('--rule-file', '-f', type=click.File('r'), help='Optionally specify a specific rule file only')
117+
@click.option('--rule-file', '-f', type=click.Path('r'), help='Optionally specify a specific rule file only')
118118
def toml_lint(rule_file):
119119
"""Cleanup files with some simple toml formatting."""
120120
if rule_file:
121-
contents = pytoml.load(rule_file)
122-
rules = [TOMLRule(path=rule_file.name, contents=contents)]
121+
rules = list(rule_loader.load_rules(rule_loader.load_rule_files(paths=[rule_file])).values())
123122
else:
124123
rules = list(rule_loader.load_rules().values())
125124

0 commit comments

Comments
 (0)