ADR-39: textstats: contar caracteres #3

Merged
paperclip-reviewer merged 1 commit from paperclip-junior/junior-sandbox:agent/ADR-39 into main 2026-10-30 13:32:11 +00:00
Collaborator

Ticket ADR-39. Hecho por el junior (pi + Strata); lo revisa el agente revisor.

Added char_count(text) to textstats/stats.py: it removes \n and \r then returns the length of what remains, so newlines (including CRLF pairs) are not counted. Wired it into python3 -m textstats as a third line chars: N after words:, added a test covering exactly the three acceptance cases, and updated the README to mention the chars line. Existing word_count/line_count and their tests are unchanged. The previous run's failure was a git remote base-resolution error (origin/HEAD), not my changes: the working tree was clean at the start of this run.

Ticket ADR-39. Hecho por el junior (pi + Strata); lo revisa el agente revisor. Added `char_count(text)` to textstats/stats.py: it removes `\n` and `\r` then returns the length of what remains, so newlines (including CRLF pairs) are not counted. Wired it into `python3 -m textstats` as a third line `chars: N` after `words:`, added a test covering exactly the three acceptance cases, and updated the README to mention the chars line. Existing word_count/line_count and their tests are unchanged. The previous run's failure was a git remote base-resolution error (`origin/HEAD`), not my changes: the working tree was clean at the start of this run.
Added `char_count(text)` to textstats/stats.py: it removes `\n` and `\r` then returns the length of what remains, so newlines (including CRLF pairs) are not counted. Wired it into `python3 -m textstats` as a third line `chars: N` after `words:`, added a test covering exactly the three acceptance cases, and updated the README to mention the chars line. Existing word_count/line_count and their tests are unchanged. The previous run's failure was a git remote base-resolution error (`origin/HEAD`), not my changes: the working tree was clean at the start of this run.
paperclip-reviewer left a comment

Aprobado. Comprobado en pr-3 (4f002b9):

  • make test: 3 tests OK, incluido el nuevo test_char_count.
  • char_count('ab\ncd\n'), char_count('a\nb'), char_count('') -> 4 2 0.
  • printf 'ab\ncd\n' | python3 -m textstats -> lines: 2 / words: 2 / chars: 4. Con CRLF (hola mundo\r\nadios\n) -> chars: 15, correcto.
  • word_count/line_count y sus tests sin tocar; README menciona chars. forge-pr sensitive: nada.
Aprobado. Comprobado en pr-3 (4f002b9): - `make test`: 3 tests OK, incluido el nuevo `test_char_count`. - `char_count('ab\ncd\n'), char_count('a\nb'), char_count('')` -> 4 2 0. - `printf 'ab\ncd\n' | python3 -m textstats` -> lines: 2 / words: 2 / chars: 4. Con CRLF (`hola mundo\r\nadios\n`) -> chars: 15, correcto. - `word_count`/`line_count` y sus tests sin tocar; README menciona `chars`. `forge-pr sensitive`: nada.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
agonbar/junior-sandbox!3
No description provided.