Coffeescript 这是一个意外的缩进错误,你知道吗?有人知道吗?

Coffeescript 这是一个意外的缩进错误,你知道吗?有人知道吗?,coffeescript,Coffeescript,下面是我的咖啡脚本。它给出了意外的缩进错误。 任何人都能猜出错误是什么 evaluateContainerRules: ( rules, containerType ) -> deferred = Ext.create( 'Deft.promise.Deferred' ) searchCriteria = [] for rule in rules if rule.searchTerms? and rule.searchTerms.length &g

下面是我的咖啡脚本。它给出了意外的缩进错误。 任何人都能猜出错误是什么

evaluateContainerRules: ( rules, containerType ) ->
    deferred = Ext.create( 'Deft.promise.Deferred' )

    searchCriteria = []
    for rule in rules
        if rule.searchTerms? and rule.searchTerms.length > 0
            searchCriteria.push( rule )
            console.log 'rule'
            console.log 'searchCriteria'

      if searchCriteria.length <= 0
             emptyRules = 
               [
              {
                 searchOption: 'EMPTY_RULE'
                searchTerms: true
        }
        ]
        console.log 'emptyRules'
        searchCriteria.push( emptyRules )
        searchCriteria.push["Hello"]
        console.log 'searchCriteria'

    store = Ext.create( 'Traverse.core.store.admin.container.ContainerMemberSummarySearchStore',
        params: 
            searchCriterias: searchCriteria
            traverseTypeEnums: if containerType is 'device' then [ Traverse.core.enumeration.TraverseType.DEVICE ] else [ Traverse.core.enumeration.TraverseType.TEST ]
    )
    complete = false
    store.on( 
        'load' 
        ( records, operation, success ) ->
            # NOTE: callback is fired multiple times for a paging store, only execute logic during the first call
            if complete
                return
            complete = true
            if success
                deferred.resolve( store )
            else
                store.destroyStore()
                @showError( operation.getError() )
                deferred.reject( operation.getError() )
            return
        scope: @
    )
    store.load()
    return deferred.promise

这似乎是对编译代码的合理重新缩进

evaluateContainerRules: ( rules, containerType ) ->
    deferred = Ext.create( 'Deft.promise.Deferred' )

    searchCriteria = []
    for rule in rules
        if rule.searchTerms? and rule.searchTerms.length > 0
            searchCriteria.push( rule )
            console.log 'rule'
            console.log 'searchCriteria'

        if searchCriteria.length <= 0
            emptyRules = 
                [{
                    searchOption: 'EMPTY_RULE'
                    searchTerms: true
                }]
        console.log 'emptyRules'
        searchCriteria.push( emptyRules )
        searchCriteria.push["Hello"]
        console.log 'searchCriteria'

    store = Ext.create( 'Traverse.core.store.admin.container.ContainerMemberSummarySearchStore',
        params: 
            searchCriterias: searchCriteria
            traverseTypeEnums: if containerType is 'device' then [ Traverse.core.enumeration.TraverseType.DEVICE ] else [ Traverse.core.enumeration.TraverseType.TEST ]
    )
    complete = false
    store.on( 
        'load' 
        ( records, operation, success ) ->
            # NOTE: callback is fired multiple times for a paging store, only execute logic during the first call
            if complete
                return
            complete = true
            if success
                deferred.resolve( store )
            else
                store.destroyStore()
                @showError( operation.getError() )
                deferred.reject( operation.getError() )
            return
        scope: @
    )
    store.load()

希望这有帮助

好吧,第二个if块似乎完全格式错误。在第11-18行之间,你能帮我输入正确格式的代码吗。