getMetrics appears to be miscounting blank lines in docstrings
- Lingua principale
- CodeQL
- Stelle
- 10.1k
- Fork
- 2.1k
- Merge medio
- 2g 15h
- PR unite (30g)
- 141
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Riprodurre le metriche riportate per combine_docs in libs/langchain/langchain_classic/chains/combine_documents/map_reduce.py e collapse_docs in combine_documents/reduce.py usando lo script QL collegato e l’allegato. Confrontare i conteggi totali, del codice, dei commenti e delle docstring con i valori attesi indicati, soprattutto per quanto riguarda le righe vuote nelle docstring. Il lavoro è completato quando le metriche riportano in modo coerente i conteggi attesi per entrambi gli esempi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100