Github user dkuppitz commented on the issue:

    https://github.com/apache/tinkerpop/pull/381
  
    Lots of calls to ` traversal.asAdmin().getEndStep()`. Maybe it's smarter to 
call it only once..? More like this:
    
    ```
    // The ProfileSideEffectStep must be the last step, 2nd last step when 
accompanied by the cap step,
    // or 3rd to last when the traversal ends with a RequirementsStep.
    Step endStep;
    if (TraversalHelper.hasStepOfClass(ProfileSideEffectStep.class, traversal) 
&&
            !((endStep = traversal.asAdmin().getEndStep()) instanceof 
ProfileSideEffectStep ||
                    (endStep instanceof SideEffectCapStep && 
endStep.getPreviousStep() instanceof ProfileSideEffectStep) ||
                    (endStep instanceof RequirementsStep && (
                            endStep.getPreviousStep() instanceof 
SideEffectCapStep ||
                            endStep.getPreviousStep() instanceof 
ProfileSideEffectStep)))) {
        throw new VerificationException("When specified, the profile()-Step 
must be the last step or followed only by the cap()-step and/or requirements 
step.", traversal);
    }
    ```
    
    ^ I also removed all the negations, which makes the chained conditions a 
bit easier to read IMO.
    
    But all in all this PR looks good to me.
    
    VOTE: +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to