Add typing to Worker module
Assessment
This issue has not been assessed yet.
Description
Currently, all cortexutils is missing typing, but we should start with the worker module as it is the root of the inheritance.
This makes writing analyzers with any static type checker very tedious.
One example of a noisy/hard function to type is any that uses error with conditional branching:
from cortexutils.analyzer import Analyzer
class ExampleAnalyzer(Analyzer):
...
def preprocess_url(self, url: str) -> str:
if not url.startswith("http"):
self.error(f"Invalid URL: {url}")
else:
processed_url = url.lower()
return processed_url
cortexutils/example.py:5: error: Missing return statement [return]
Found 1 error in 1 file (checked 6 source files)
Current workaround is to add # type: ignore[return], which is not ideal as it invalidates most of the type safety.
- Dominant language
- Python
- Stars
- 8
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TheHive-Project/cortexutils
-
Enroll cortexutils to codecovMay be free again @Kamforka claimed this 111 days ago, and no pull request is open. Openenhancement
TheHive-Project/cortexutils#36 · 1 assignee ·
-
Add or rework integration testsPossibly taken @Kamforka claimed this 116 days ago. Openenhancement
TheHive-Project/cortexutils#34 · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
TheHive-Project/cortexutils#12 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in TheHive-Project/cortexutils
Similar issues
-
json_params_matcher fails on falsy top-level JSON primitives (0, False, "")Possibly taken @mayureshsonawane17 claimed this today. OpenWaiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
bojieli/ai-agent-book#1169 ·
Maintainers usually reply within 1 day
-
priority:low ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenHands/extensions#738 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
micronaut-projects/micronaut-core#13677 ·
Maintainers usually reply within 1 day