Add typing to Worker module
评估
这个 Issue 还没有评估数据。
描述
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.
- 主要语言
- Python
- 星标
- 8
- 派生
- 18
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TheHive-Project/cortexutils 的其他 Issue
-
Enroll cortexutils to codecov可能重新可做 @Kamforka 于 114 天前认领,目前没有进行中的 PR。 未关闭enhancement
TheHive-Project/cortexutils#36 · 已指派 1 人 ·
-
Add or rework integration tests可能已有人在做 @Kamforka 于 119 天前认领。 未关闭enhancement
TheHive-Project/cortexutils#34 · 已指派 1 人 ·
-
难度 3/5 1-2 天 新手友好度 45/100
TheHive-Project/cortexutils#12 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
查看 TheHive-Project/cortexutils 的全部 Issue
相似的 Issue
-
changelog investigate
难度 2/5 1-3 小时 新手友好度 62/100
ramnes/notion-sdk-py#409 ·
-
good first issue help wanted
难度 2/5 1-3 小时 新手友好度 72/100
lindicaphxag-tech/kaggle#28 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
BSData/horus-heresy-3rd-edition#3211 ·
维护者通常 1 天内回复
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
bug tests
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复