repobee / repobee-sanitizer

A plugin for sanitizing master repositories before distribution to students
MIT License
2 stars 3 forks source link

Sanitizer does not tell which file had an error #81

Closed tohanss closed 4 years ago

tohanss commented 4 years ago

Instead of giving this:

[ERROR] PlugError: ['Line 36: Missing prefix', 'Line 57: Missing prefix', 'Line 78: Missing prefix', 'Line 91: Missing prefix', 'Line 104: Missing prefix', 'Line 126: Missing prefix', 'Line 144: Missing prefix', 'Line 157: Missing prefix', 'Line 168: Missing prefix', 'Line 209: Missing prefix']

We probably want it to tell us what file caused this as well, (they are all the same file, since sanitizer reports errors on a file to file basis)

slarse commented 4 years ago

Yep, we definitely wanna say which file causes the error. Ideally, we should check all files before starting to sanitize, and report errors for all files at the same time. Perhaps check_syntax should return a list of errors, as opposed to raising an error. I'd imagine something like this:

Syntax errors detected in 2 file(s):

some/bad/file.txt
    Line 36: Missing prefix
    Line 57: Missing prefix
some/other/file.txt
    Line 2: Some other error message

When you design this, take inspiration from any compiler. For example, run the java compiler on a couple of obviously bad files and see what it says.