Hello all :wave:
I am new to the Roc community and am looking to make my first contribution! In particular, I have picked up Issue 6980. After having a quick look at the code I had a couple of questions that I'm hoping either may have already been answered somewhere and I don't know where or someone can help me with. I'll tag @Anton since they opened up the original issue.
First up, roc check
currently uses check_file
from here which in turn uses load_and_typecheck
from here. This means that we are expecting a Roc source file to be passed in right? That won't be the case if roc check
can check code blocks in markdown files. One option would be to write out each code block to a tmp file and check those in the usual way but I was wondering if there was an equivalent to load_and_typecheck
that would take a string or something? And would that be preferable?
My second question is more on the user facing design. Currently, roc check
gives output something like:
0 errors and 0 warnings found in 26 ms
in the simplest case. Given that we could have multiple code blocks (that we are checking separately) we should probably mark each block? For example, for the simple output we could have:
Block 0: 0 errors and 0 warnings found in 26 ms
etc. For the output with --time
included we might need an easier to spot separator? Actually :thinking: we might want that in all cases since even without --time
the output of roc check
can still be quite long if there are issues!
Hi @David Edwards,
There is load_and_typecheck_str
in the same file but that function is currently only used for tests. I would stick with load_and_typecheck
and tmp files.
For the separator, I would not worry about "polish" in this first PR. I would focus on landing the desired functionality but without resorting to hacky code of course.
Great stuff, thanks!
I've just opened a draft PR that I think gets a rough overall flow that might work for this. I've sort of added this in the "easy to add" kinda way without trying to be clever, I'd be interested in some early feedback on where are the right places to spend some time making this a bit better. :thank_you:
And brilliantly, didn't include a link :man_facepalming: https://github.com/roc-lang/roc/pull/7154
I think it looks ok. I haven't tested it. Someone with more rust foo might be able to critique the implementation or provide better feedback. :smiley:
Thanks for everyone's input on this one :tada:
Last updated: Jul 06 2025 at 12:14 UTC