gchq / gchq/sleeper

Scripts do not type check boolean inputs

Open
#6,790 0 comments 0 reactions 0 assignees View on GitHub
bug scripts under-discussion
Dominant language
Java
Stars
107
Forks
29
Avg merge
19h 46m
Merged PRs (30d)
141

Description

### Description / Background

Most of the scripts do not type check boolean inputs, and default to false if anything other than "true" is entered (case insensitive).

### Steps to reproduce

1. Run `./scripts/utility/reinitialiseTable.sh $ID table1 scripts/test/splitpoints/string/1024-partitions.txt`
2. This reads the split points file as the delete-partitions flag and defaults it to false

### Expected behaviour

The script should fail because a boolean was not provided for a boolean argument.

### Technical Notes / Implementation Details

This is because in a lot of places we use Boolean.parseBoolean to read these arguments.

Scripts using the new CommandArguments class do not have this problem as it uses flag options for booleans.

We could consider using CommandArguments in more places. It might be worth adding an option to configure this with annotations on a record, rather than passing around strings to identify the different arguments.

More broadly, this would also be solved by unifying the scripts as in the following epic:
- https://github.com/gchq/sleeper/issues/1328

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.