-
Notifications
You must be signed in to change notification settings - Fork 575
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
31
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.
+6,619
−5,223
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
9b19290
first pass
traut 6597e31
Adding a dedicated code checking workflow
traut de5b3d3
Type fixes
traut 7815e09
linting config and python version bump
traut b074381
Type hints
traut b02388a
Drop incorrect config option
traut 763a857
More fixes
traut 1501ffe
Style fixes
traut b9d0fc8
CI adjustments
traut f8e9e93
Pyproject fixes
traut 21236e3
CI & pyproject fixes
traut 552976d
Proper version bump
traut 11065e8
Tests formatting
traut 1f03075
Resolve cirtular dependency
traut 5c047e5
Test fixes
traut e295635
Make sure the tests are formatted correctly
traut 2dcb69b
Check tweaks
traut 530016f
Bumping python version in CI images
traut 7961ac1
Pin marshmallow do 3.x because 4.x is not supported
traut be43ac6
License fix
traut 1bf082b
Convert path to str
traut 5e70923
Making myself a codeowner
traut 29c4e4d
Missing kwargs param
traut a9b9472
Adding a missing kwargs to `set_score`
traut 38051b8
Update .github/CODEOWNERS
traut 82dd93a
Dropping unnecessary raise
traut 364d57c
Dropping skipped test
traut a97bf0f
Drop unnecessary var
traut fbc38ca
Drop unused commented-out func
traut 542ab44
Disable typehinting for the whole func
traut 0f9e6e8
Update linting command
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
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.