PeterJCLaw / srcomp

Reliable software for running robotics competitions
https://github.com/PeterJCLaw/srcomp/wiki
GNU General Public License v3.0
0 stars 1 forks source link

Validate score files are in the right format #9

Open PeterJCLaw opened 3 years ago

PeterJCLaw commented 3 years ago

Specifically if the match number is a string this is incorrect but doesn't error. This results in much confusion which could be avoided by validation while loading the data.

PeterJCLaw commented 2 years ago

Worth noting that this does cause an error when loading the compstate, though the error isn't particularly helpful in identifying the source of the issue:

Traceback (most recent call last):
  File "virtualenvs/srcomp/bin/srcomp", line 33, in <module>
    sys.exit(load_entry_point('sr.comp.cli', 'console_scripts', 'srcomp')())
  File "/home/srobo/srcomp-cli/sr/comp/cli/command_line.py", line 84, in main
    settings.func(settings)
  File "/home/srobo/srcomp-cli/sr/comp/cli/validate.py", line 10, in command
    comp = SRComp(settings.compstate)
  File "/home/srobo/srcomp/sr/comp/comp.py", line 68, in __init__
    self.scores = scores.Scores.load(
  File "/home/srobo/srcomp/sr/comp/scores.py", line 424, in load
    return cls(league, knockout, tiebreaker)
  File "/home/srobo/srcomp/sr/comp/scores.py", line 449, in __init__
    lsm = scores.last_scored_match
  File "/home/srobo/srcomp/sr/comp/scores.py", line 267, in last_scored_match
    return max(num for arena, num in matches)
TypeError: '>' not supported between instances of 'str' and 'int'