-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closing the rule schema.yml file stream #567
Conversation
@@ -137,10 +145,7 @@ class RulesLoader(object): | |||
jinja_environment = Environment(loader=FileSystemLoader("")) | |||
|
|||
def __init__(self, conf): | |||
# schema for rule yaml | |||
self.rule_schema = jsonschema.Draft7Validator( | |||
yaml.load(open(os.path.join(os.path.dirname(__file__), 'schema.yaml')), Loader=yaml.FullLoader)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chasing down unclosed streams from the yaml
library and came across this one. Likely not an issue, but the with open
pattern should be followed everywhere.
self.rule_schema = jsonschema.Draft7Validator( | ||
yaml.load(open(os.path.join(os.path.dirname(__file__), 'schema.yaml')), Loader=yaml.FullLoader)) | ||
|
||
self.rule_schema = load_rule_schema() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing test coverage utilizes the rule_schema
Description
Closing the file stream of
schema.yml
Checklist
make test-docker
with my changes.