repochecker: Ensure non-optional flag doesn't depend on optional one
This commit is contained in:
parent
b3c207d07d
commit
09c1111135
1 changed files with 9 additions and 0 deletions
|
@ -555,6 +555,15 @@ func CheckExerciceFlags(i Importer, exercice *fic.Exercice, files []string, exce
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check dependency to flag optional flag
|
||||||
|
if fk, ok := flag.Flag.(*fic.FlagKey); ok && fk.BonusGain == 0 {
|
||||||
|
for _, nf := range flag.FlagsDeps {
|
||||||
|
if fk2, ok := flags[nf].Flag.(*fic.FlagKey); ok && fk2.BonusGain != 0 {
|
||||||
|
errs = multierr.Append(errs, NewFlagError(exercice, nil, flag.Line, fmt.Errorf("flag is not optional but depend on flag id=%d which is optional", nf)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check dependency loop
|
// Check dependency loop
|
||||||
deps := flag.FlagsDeps
|
deps := flag.FlagsDeps
|
||||||
for i := 0; i < len(deps); i++ {
|
for i := 0; i < len(deps); i++ {
|
||||||
|
|
Reference in a new issue