[previous] 2209 [next] This brace style is not consistent with 'exdented' style.
Bracing and Indentation

The use of braces does not conform with "exdented" style - the style currently configured in QA·C.

QA·C recognises 3 alternative styles in which braces are conventionally used: Exdented style is assumed by default; the other styles may be configured using the -style option.

Three messages are used to identify bracing which does not conform to the configured style.

For example:


/*PRQA S 2017,3120,3197,3198,3199,3227,3408 ++*/

/*************************
 * OPTIONS:
 * 1. -style k+r
 * 2. -style indented
 * 3. -style exdented
 *************************/

                                        /**********************************/
                                        /* 1.       * 2.       * 3.       */
                                        /* k+r      * indented * exdented */
                                        /**********************************/
extern int kandr(int n) {

    int r = 0;

    if (n > 10) {                       /*          * 2208     * 2209     */
        r = 100;
    }

    switch (n)  {                       /*          * 2208     * 2209     */
    case 0:
        r = 2;
        break;
    case 1:
        r = 4;
        break;
    default:
        r = 6;
        break;
    }

    return r;
}


extern int indented(int n)
    {
    int r = 0;

    if (n > 10)
        {                               /* 2207     *          * 2209     */
        r = 100;
        }

    switch (n)
        {                               /* 2207     *          * 2209     */
    case 0:
        r = 2;
        break;
    case 1:
        r = 4;
        break;
    default:
        r = 6;
        break;
        }

    return r;
    }


extern int exdented(int n)
{
    int r;
    if (n > 10)
    {                                   /* 2207     * 2208     *          */
        r = 100;
    }

    switch (n)
    {                                   /* 2207     * 2208     *          */
    case 0:
        r = 2;
        break;
    case 1:
        r = 4;
        break;
    default:
        r = 6;
        break;
    }

    return r;
}

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents