-
Notifications
You must be signed in to change notification settings - Fork 613
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
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
588304b
first pass
traut 874b66e
Adding a dedicated code checking workflow
traut fc92230
Type fixes
traut 5a92c2b
linting config and python version bump
traut 2740f04
Type hints
traut d94aac2
Drop incorrect config option
traut 5e221b2
More fixes
traut f78dc2e
Style fixes
traut dc7b7a2
CI adjustments
traut ccc208e
Pyproject fixes
traut 61898ba
CI & pyproject fixes
traut 46fd006
Proper version bump
traut 144fab6
Tests formatting
traut 39942ca
Resolve cirtular dependency
traut 006dd9a
Test fixes
traut cee3c97
Make sure the tests are formatted correctly
traut 5a4719b
Check tweaks
traut ab76929
Bumping python version in CI images
traut 8f379d2
Pin marshmallow do 3.x because 4.x is not supported
traut 38d8361
License fix
traut 671e1d0
Convert path to str
traut c345bba
Making myself a codeowner
traut 83bbec7
Missing kwargs param
traut 46cef36
Adding a missing kwargs to `set_score`
traut efa69f7
Update .github/CODEOWNERS
traut 2c897dc
Dropping unnecessary raise
traut e2b5af7
Dropping skipped test
traut df22b29
Drop unnecessary var
traut 16a1f7e
Drop unused commented-out func
traut 4248cda
Disable typehinting for the whole func
traut 1266464
Update linting command
traut b86269e
Invalid type hist on the input param
traut 25f08d5
Incorrect field type
traut bd77b17
Incorrect value used fix
traut acc1aff
Stricter values check
traut bc80a22
Simpler function call
traut 057d73c
Type condition fix
traut 69eb161
TOML formatter fix
traut aed7a86
Simpligy output conditions
traut 125a083
Formatting
traut 85265b2
Use proper types instead of aliases
traut 926ea78
MITRE attack fixes
traut 86c3b7a
Using pathlib.Path for an argument
traut bea53a1
Use proper method to update a set from a dict
traut 15f71cf
First round of `ruff` fixes
traut b468ed1
More fixes
traut e2395c1
More fixes
traut e0f178c
Hack against cyclic dependency
traut ada1e27
Ignore `PLC0415`
traut 04883eb
Remove unused markers
traut cdcb1a4
Cleanup
traut d3a0fa6
Fixing the incorrect condition
traut e395c5f
Update .github/CODEOWNERS
traut bcdc4c7
Set explicit default values for optional fields
traut c32579e
Update the guidelines
traut 191fc42
Adding None Defaults
eric-forte-elastic 76e4f03
Merge branch 'main' into style-fixes
Mikaayenson 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/**/*.py @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
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 |
|---|---|---|
| @@ -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
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.