Closed glennj closed 1 year ago
@Bajger feel free to assign this to me.
@glennj Hi! Here you are :) Just a side note: Pharo has own way to compute lines of code, that respects different formatting (removes whitespaces, etc.). You can send #linesOfCode to method, class or package:
The Exercism lines-of-code counter uses tokei: you configure the single line comment leader and multi-line comment markers. It will remove comments and empty lines to report LOC. There's no way to invoke a language-aware parser
For example https://exercism.org/tracks/pharo-smalltalk/exercises/two-fer/solutions/glennj
Pharo probably counts just a methods - its body (including defined name), but ignores enclosing brackets and protocol names (since counting considers this as syntactic sugar). It also doesn't count class definition itself. So probably to be consistent with rest of language tracks, we should keep with tokei? There should be a way to omit text files - maybe I can put in current implementation some markers for omitting this (like \" )?
we should keep with tokei
Yes. We don't want to radically overhaul https://github.com/exercism/lines-of-code-counter/tree/main
I just discovered there's a .tokeignore
file that's like a .gitignore. We could add TestResults.txt to that file for each exercise.
Otherwise, we'd have to give the TestResults file a different extension, one for a language with multi-line comments. TestResults.st
seems wrong.
Will it upset test generation if I add a .tokeignore
file into each exercises/practice/$exercise
?
I think it is ok to put it there, tests shouldn't harmed, since Pharo generates TestResults.txt
file and then is part of submission. Only problem/impediment I see in new exercise generation prom problem spec, if this .tokeignore
should be common for all exercises. E.g. one would call configlet sync --metadata -uy -e slug-name
and part of sync result should be .tokeignore
file I suppose. Otherwise it needs to be added manually each time.
Anyway: You probably should test whole user exercise life-cycle with this new file:
@glennj Please feel free to submit PR with .tokeignore
on one exercise and I can try out loading baselne with you PR into the image.
Thinking a little more about this. The TestResults.txt file can be configured away in the exercism/lines-of-code-counter repo: Add an ignore file in https://github.com/exercism/lines-of-code-counter/tree/main/tracks
I'm testing that hypothesis
This is now completed: http://forum.exercism.org/t/question-about-the-lines-of-code-counter/8172
Tokei is the "lines of code counter" tool.
Add Pharo configuration
https://github.com/exercism/tokei/blob/master/CONTRIBUTING.md#language-addition https://discord.com/channels/854117591135027261/1169215168484479006