-
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
Open
traut
wants to merge
30
commits into
main
Choose a base branch
from
style-fixes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
fb8d74c
first pass
traut a08b46d
Adding a dedicated code checking workflow
traut b9dabe4
Type fixes
traut 4418a2c
linting config and python version bump
traut 999eaee
Type hints
traut 5748f78
Drop incorrect config option
traut 90e5b4e
More fixes
traut becb193
Style fixes
traut f4c7cc0
CI adjustments
traut 33b53c3
Pyproject fixes
traut fa33ed9
CI & pyproject fixes
traut 41f6433
Version bump
traut d2f947e
Tests formatting
traut 77edd83
Resolve cirtular dependency
traut 1e0eecf
Test fixes
traut 3ff0b38
Make sure the tests are formatted correctly
traut abde0d5
Check tweaks
traut 100734c
Bumping python version in CI images
traut e643fdb
Pin marshmallow do 3.x because 4.x is not supported
traut 80e5021
License fix
traut 4afd534
Convert path to str
traut 968afaf
Making myself a codeowner
traut 6b2e098
Missing kwargs param
traut 9a9a606
Adding a missing kwargs to `set_score`
traut 5959679
Update .github/CODEOWNERS
traut f20a045
Dropping unnecessary raise
traut c5ef693
Dropping skipped test
traut 6967f69
Drop unnecessary var
traut e1da64c
Drop unused commented-out func
traut 51bac0f
Disable typehinting for the whole func
traut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
# detection-rules code owners | ||
# POC: Elastic Security Intelligence and Analytics Team | ||
|
||
tests/**/*.py @mikaayenson @eric-forte-elastic @terrancedejesus | ||
detection_rules/ @mikaayenson @eric-forte-elastic @terrancedejesus | ||
tests/ @mikaayenson @eric-forte-elastic @terrancedejesus | ||
lib/ @mikaayenson @eric-forte-elastic @terrancedejesus | ||
hunting/ @mikaayenson @eric-forte-elastic @terrancedejesus | ||
tests/**/*.py @mikaayenson @eric-forte-elastic @traut | ||
detection_rules/ @mikaayenson @eric-forte-elastic @traut | ||
tests/ @mikaayenson @eric-forte-elastic @traut | ||
lib/ @mikaayenson @eric-forte-elastic @traut | ||
hunting/ @mikaayenson @eric-forte-elastic @traut | ||
|
||
# skip rta-mapping to avoid the spam | ||
detection_rules/etc/packages.yaml @mikaayenson @eric-forte-elastic @terrancedejesus | ||
detection_rules/etc/*.json @mikaayenson @eric-forte-elastic @terrancedejesus | ||
detection_rules/etc/*.json @mikaayenson @eric-forte-elastic @terrancedejesus | ||
detection_rules/etc/*/* @mikaayenson @eric-forte-elastic @terrancedejesus | ||
detection_rules/etc/packages.yaml @mikaayenson @eric-forte-elastic @traut | ||
detection_rules/etc/*.json @mikaayenson @eric-forte-elastic @traut | ||
detection_rules/etc/*/* @mikaayenson @eric-forte-elastic @traut | ||
|
||
# exclude files from code owners | ||
detection_rules/etc/non-ecs-schema.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Code checks | ||
|
||
on: | ||
push: | ||
branches: [ "main", "7.*", "8.*", "9.*" ] | ||
pull_request: | ||
branches: [ "*" ] | ||
paths: | ||
- 'detection_rules/**/*.py' | ||
- 'hunting/**/*.py' | ||
|
||
jobs: | ||
code-checks: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Set up Python 3.13 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.13' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip cache purge | ||
pip install .[dev] | ||
|
||
- name: Linting check | ||
run: | | ||
ruff check --exit-non-zero-on-fix | ||
|
||
- name: Formatting check | ||
run: | | ||
ruff format --check | ||
|
||
- name: Pyright check | ||
run: | | ||
pyright | ||
|
||
- name: Python License Check | ||
run: | | ||
python -m detection_rules dev license-check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
# coding=utf-8 | ||
"""Shell for detection-rules.""" | ||
|
||
import sys | ||
from pathlib import Path | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.