-
Notifications
You must be signed in to change notification settings - Fork 574
fix: type hinting fixes and additional code checks #4790
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
base: main
Are you sure you want to change the base?
Conversation
Enhancement - GuidelinesThese guidelines serve as a reminder set of considerations when addressing adding a new schema feature to the code. Documentation and Context
Code Standards and Practices
Testing
Additional Schema Related Checks
|
osquery_note_pattern = ( | ||
"> **Note**:\n> This investigation guide uses the [Osquery Markdown Plugin]" | ||
"(https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) " | ||
"introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display " | ||
"unrendered Markdown in this guide." | ||
) | ||
invest_note_pattern = ( | ||
'> This investigation guide uses the [Investigate Markdown Plugin]' | ||
'(https://www.elastic.co/guide/en/security/current/interactive-investigation-guides.html)' | ||
' introduced in Elastic Stack version 8.8.0. Older Elastic Stack versions will display ' | ||
'unrendered Markdown in this guide.') | ||
"> This investigation guide uses the [Investigate Markdown Plugin]" | ||
"(https://www.elastic.co/guide/en/security/current/interactive-investigation-guides.html)" | ||
" introduced in Elastic Stack version 8.8.0. Older Elastic Stack versions will display " | ||
"unrendered Markdown in this guide." | ||
) |
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.
We should double check that when the transform occurs, its still formatted correctly.
suggested_path: Path = Path(DEFAULT_PREBUILT_RULES_DIRS[0]) / contents["name"] | ||
path = Path(path or input(f"File path for rule [{suggested_path}]: ") or suggested_path).resolve() |
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.
Seems a bit odd to type hint as Path when we explicitly set as a Path object. We also dont type hint the next field path
.
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.
contents
is dict[str, Any]
, so there is ambiguity in the calculation of the result type
"""Get schema for KQL.""" | ||
indexes = indexes or () | ||
converted = flatten_multi_fields(get_schema(version, name='ecs_flat')) | ||
indexes = indexes or [] |
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.
Curious as to why this was a tuple
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.
no idea. I don't think there is a risk of mutation, so we might as well simplify and have list
here
|
Co-authored-by: Mika Ayenson, PhD <[email protected]>
Pull Request
Issue link(s):
Summary - What I changed
ruff
andpyright
checks in CI workflowpyright
has no complainsHow To Test
Checklist
bug
,enhancement
,schema
,maintenance
,Rule: New
,Rule: Deprecation
,Rule: Tuning
,Hunt: New
, orHunt: Tuning
so guidelines can be generatedmeta:rapid-merge
label if planning to merge within 24 hoursContributor checklist