getMetrics appears to be miscounting blank lines in docstrings
- 主要語言
- CodeQL
- 星號
- 10.1k
- 分支
- 2.1k
- 平均合併
- 2 天 15 小時
- 30 天內合併 PR
- 141
描述
The definition of the python function `combine_docs` starts on line 227 in [combine_documents/map_reduce.py](https://github.com/langchain-ai/langchain/blob/master/libs/langchain/langchain_classic/chains/combine_documents/map_reduce.py) and ends on line 259.
[func-def.txt](https://github.com/user-attachments/files/23375865/func-def.txt)
Running the above QL script on the latest langchain database produces the values:
func.getMetrics().getNumberOfLines() = 33
func.getMetrics().getNumberOfLinesOfCode() = 27 # Should be 26
func.getMetrics().getNumberOfLinesOfComments() = 2
func.getMetrics().getNumberOfLinesOfDocStrings() = 5
I suspect that the number of blank line in the docstring might be a factor.
The above function contains one blank line in a docstring, while the example below contains two blank lines in a docstring.
The function `collapse_docs` starts on line 67 in [combine_documents/reduce.py](https://github.com/langchain-ai/langchain/blob/master/libs/langchain/langchain_classic/chains/combine_documents/reduce.py) and ends on line 96.
The above QL script produces the values:
func.getMetrics().getNumberOfLines() = 30
func.getMetrics().getNumberOfLinesOfCode() = 12 # Should be 14
func.getMetrics().getNumberOfLinesOfComments() = 0
func.getMetrics().getNumberOfLinesOfDocStrings() = 16
貢獻指南
研究方向
使用連結的 QL 指令碼和附件,重現 libs/langchain/langchain_classic/chains/combine_documents/map_reduce.py 中 combine_docs 以及 combine_documents/reduce.py 中 collapse_docs 的報告指標。將總數、程式碼、註解和 docstring 的計數與所述預期值進行比較,尤其關注 docstring 中的空白行。當兩個範例的指標都持續回報預期計數時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- devtools
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100