Skip to content
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

Merged
merged 5 commits into from
Nov 23, 2021

Conversation

JeffAshton
Copy link
Contributor

@JeffAshton JeffAshton commented Nov 22, 2021

Description

Closing the file stream of schema.yml

Checklist

  • I have reviewed the contributing guidelines.
  • I have included unit tests for my changes or additions.
  • I have successfully run make test-docker with my changes.
  • I have manually tested all relevant modes of the change in this PR.
  • I have updated the documentation.
  • I have updated the changelog.

@@ -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))
Copy link
Contributor Author

@JeffAshton JeffAshton Nov 22, 2021

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()
Copy link
Contributor Author

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

@jertel jertel merged commit d783c93 into jertel:master Nov 23, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants