Code style checking in test suite

Question: How can I find the file which contains a given function?

I would like to include a test in a test suite which runs a function on the actual scala file containing a certain function. I have the function written, but I don’t know how to ask “give me the name of the file containing a given function” from a test suite.

Why would I like to do this? Because I have asked students to write code avoiding certain idioms such as “return” and mutable variables. The students run the tests and find all the tests pass. Then they submit code via a Moodle. In my manual tests I run a processor over their file. Unfortunately the students do not have access to my auto-grader.

I’d like to promise the student that if he passes all the tests, he’ll get 100% credit for the assignment.

1 Like

Hey @jimka,
Your use case might be covered by the under-development tool language features à la carte.
Otherwise, you could use scalameta to write a program that would look for a Scala file containing a def myFunction.

1 Like