Skip to content

checkstyle RightCurly not correct when there are comments #637

@xenoterracide

Description

@xenoterracide
/CustomerAuditServiceImpl.java:441:9: '}' at column 9 should be on the same line as the next part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else, do/while or try/catch/finally). [RightCurly]

**Prettier-Java 2.5.0 **

Input:

I apologize, this hot mess is so long, but I'm wondering if that's part of what's causing the problem. I added a violation in the code here.

        if (
            isAddNode &&
            (NODE_CARD.equalsIgnoreCase(nodeLabel) ||
                NODE_PERSON.equalsIgnoreCase(nodeLabel) ||
                NODE_ADDRESS.equalsIgnoreCase(nodeLabel) ||
                NODE_PHONE.equalsIgnoreCase(nodeLabel) ||
                NODE_HOUSEHOLD.equalsIgnoreCase(nodeLabel))
        ) {
        } else if (isNodePropChange && !StringUtils.isEmpty(getPropertiesAsString(audit))) {
            String propString = getPropertiesAsString(audit);
            String keyNumber = ignoreUuids(primaryKey);
            responseString = String.format("Change to POSID: %s - %s", keyNumber, propString);
        }
        // Attributes (which are relations)
        else if (isAddRelation && isAttributeType) { // ** VIOLATION **
            // TX Template: SetLoyaltyAttribute_A
            // Seems like this will also handle Un/Enroll Customer and NationalRewards
            String attrName = getAttributeName(audit);
            responseString = String.format("Attribute %s added with value %s", attrName, propValue);
        } else if (isChangeRelation && isAttributeType) {

Expected behavior:

...

I'm not sure this is wrong per prettier, but I don't see a way to fix per checkstyle either. Please leave open until one or the other can be resolved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions