cnescatlab/i-CodeCNES

SHDESIGNOptions false positive

furmanc opened this issue · 1 comments

Expected behavior

By using the example of SH.DESIGN.Options in RNC CNES we should expect no error

Actual behavior

By using the example of SH.DESIGN.Options in RNC CNES we have an error SH.DESIGN.Options

In SH.DESIGN.Options LEX we have the following conditions to raise the SH.DESIGN.Options error:
if (!getopts || !getoptExtern || !help || !version || !helpLong || !versionLong)

but actually we think these conditions should be :
if ( (getopts && (!help || !version)) || (getoptExtern && (!helpLong || !versionLong)) )

Steps to reproduce behavior

Detection version

V3.0.1

pls check the correction with example below

    optspec="vr:,d:,p:,h,-:"
    while getopts "${optspec}" OPTION 
    do 
        case "${OPTION}" in 
            h ) input_to_process=0;
                usage ;; 
            v ) input_to_process=0;
                echo "ql_s2 V1.6 using OTB 6.6" ;; 
            r ) res=${OPTARG};;
            p ) product_name=${OPTARG};;
            d ) destination_root_directory=${OPTARG};;
            - )  LONG_OPTARG="${OPTARG#*=}";
                case ${OPTARG} in
                    help ) input_to_process=0;
                        usage;;
                    version ) input_to_process=0;
                        echo "ql_s2 V1.6 using OTB 6.6";;
                    sd=?* ) destination_sub_directory=${LONG_OPTARG};;
                    sd* ) echo "No arg for --${OPTARG} option" >&2; 
                         exit 1;;
                    rgb | irgb | comp ) quicklook_type=${OPTARG};;
                    rgb* | irgb* | comp* )
                        echo "No arg allowed for --${OPTARG} option" >&2; 
                        exit 1;;
                    '') break ;; # "--" terminates argument processing
                    *)  echo "No arg allowed for --${OPTARG} option" >&2; 
                        exit 1;;
                 esac;;
            \? ) echo "Invalid option: -${OPTARG}" >&2;
                exit 1;;
            : ) echo "Option -${OPTARG} requires an argument." >&2
                exit 1;;
         esac
    done