softwareconstruction240 / autograder

Autograder for BYU's CS 240 Chess project
https://cs240.click
2 stars 2 forks source link

Backend: Identify Common Issues — Modified Test Files #361

Closed frozenfrank closed 1 month ago

frozenfrank commented 1 month ago

This is a sub-issue of #266 that describes and defines one issue that can be solved independent of the others.

Overview

Detection Strategy

  1. Hash their test files against two different version: one with the CRLF line endings, and one with the LF line endings.
  2. Run git diff on the known test file and the student's file as demonstrated by this StackOverflow answer.

Option number 2 may be easier to implement since we can easily configure it to ignore whitespace differences. Additionally, we may be able to run it on entire directories of test objects in a single command instead of having to compare named files one-by-one.

Implementation Details

See the following details about ignoring whitespace details from git diff --help:

       --ignore-space-at-eol
           Ignore changes in whitespace at EOL.

       -b, --ignore-space-change
           Ignore changes in amount of whitespace. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters to be
           equivalent.

       -w, --ignore-all-space
           Ignore whitespace when comparing lines. This ignores differences even if one line has whitespace where the other line has none.

       --ignore-blank-lines
           Ignore changes whose lines are all blank.