|
|
|
# wpj
|
|
|
|
我从[这些角度](https://github.com/google/eng-practices/blob/master/review/reviewer/looking-for.md)来做代码审核。
|
|
|
|
|
|
|
|
## 设计
|
|
|
|
- [项目地址](http://tech.pingansec.com/granite/project-judicature/-/tree/dev_court_notice/scrapy_spiders/judicature_spiders)
|
|
|
|
- 文件夹目录结构清晰
|
|
|
|
- 但是两个项目混在一起
|
|
|
|
- pyreverse对类的组合支持不好
|
|
|
|
|
|
|
|
## 复杂性
|
|
|
|
- [field_map.py](http://tech.pingansec.com/granite/project-judicature/-/blob/dev_court_notice/scrapy_spiders/judicature_spiders/utils/wenshu/field_map.py)
|
|
|
|
- 对IDE不友好
|
|
|
|
- class
|
|
|
|
- [namedtuple](https://docs.python.org/zh-cn/3.7/library/collections.html#collections.namedtuple)
|
|
|
|
- [dataclass](https://docs.python.org/zh-cn/3.7/library/dataclasses.html) 推荐
|
|
|
|
- [util.py](http://tech.pingansec.com/granite/project-judicature/-/blob/dev_court_notice/scrapy_spiders/judicature_spiders/utils/wenshu/util.py)
|
|
|
|
- ConditionDynamicSingleLink
|
|
|
|
- Compress
|
|
|
|
- [wenshu.py](http://tech.pingansec.com/granite/project-judicature/-/blob/dev_court_notice/scrapy_spiders/judicature_spiders/spiders/wenshu.py#L77)
|
|
|
|
- [cookie_manager.py](http://tech.pingansec.com/granite/project-judicature/-/blob/dev_court_notice/scrapy_spiders/judicature_spiders/utils/wenshu/cookie_manager.py)
|
|
|
|
- 异步
|
|
|
|
- 最大并发请求数
|
|
|
|
- CookieManager 线程安全?
|
|
|
|
|
|
|
|
## 测试
|
|
|
|
有测试
|
|
|
|
|
|
|
|
## 命名
|
|
|
|
- WenshuSpider
|
|
|
|
- CookieManager
|
|
|
|
- update_cookie_by_cookie_header
|
|
|
|
- Condition
|
|
|
|
- Dynamic
|
|
|
|
- DataDumpIO
|
|
|
|
- Decrypt
|
|
|
|
|
|
|
|
## 注释
|
|
|
|
- 主干WenshuSpider中 每个函数都有注释
|
|
|
|
|
|
|
|
## 文档
|
|
|
|
- 缺少README
|
|
|
|
- kb Wiki和project之间的关系太弱
|
|
|
|
|