Beispiel #1
0
def chk_i_children(old, new, ctx):
    for oldch in old.i_children:
        chk_child(oldch, new, ctx)
    # chk_child removes all old children
    for newch in new.i_children:
        if statements.is_mandatory_node(newch):
            err_add(ctx.errors, newch.pos, 'CHK_NEW_MANDATORY', newch.arg)
Beispiel #2
0
def chk_i_children(old, new, ctx):
    for oldch in old.i_children:
        chk_child(oldch, new, ctx)
    # chk_child removes all old children
    for newch in new.i_children:
        if statements.is_mandatory_node(newch):
            err_add(ctx.errors, newch.pos, 'CHK_NEW_MANDATORY', newch.arg)
Beispiel #3
0
def chk_i_children(old, new, ctx):
    for oldch in old.i_children:
        chk_child(oldch, new, ctx)

    old_child_args = [oldch.arg for oldch in old.i_children]
    added_new_children = [new_child for new_child in new.i_children if new_child.arg not in old_child_args]
    for newch in added_new_children:
        if statements.is_mandatory_node(newch):
            err_add(ctx.errors, newch.pos, 'CHK_NEW_MANDATORY', newch.arg)
Beispiel #4
0
def chk_if_feature(old, new, ctx):
    # make sure no if-features are removed if node is mandatory
    for s in old.search('if-feature'):
        if new.search_one('if-feature', arg=s.arg) is None:
            if statements.is_mandatory_node(new):
                err_def_removed(s, new, ctx)

    # make sure no if-features are added
    for s in new.search('if-feature'):
        if old.search_one('if-feature', arg=s.arg) is None:
            err_def_added(s, ctx)
Beispiel #5
0
def chk_if_feature(old, new, ctx):
    # make sure no if-features are removed if node is mandatory
    for s in old.search('if-feature'):
        if new.search_one('if-feature', arg=s.arg) is None:
            if statements.is_mandatory_node(new):
                err_def_removed(s, new, ctx)

    # make sure no if-features are added
    for s in new.search('if-feature'):
        if old.search_one('if-feature', arg=s.arg) is None:
            err_def_added2(s, new, ctx)
Beispiel #6
0
def chk_config(old, new, ctx):
    if old.i_config == False and new.i_config == True:
        if statements.is_mandatory_node(new):
            err_add(ctx.errors, new.pos, 'CHK_MANDATORY_CONFIG', new.arg)
    elif old.i_config == True and new.i_config == False:
        err_add(ctx.errors, new.pos, 'CHK_BAD_CONFIG', new.arg)
Beispiel #7
0
def v_chk_mandatory_top_level(ctx, stmt):
    for s in stmt.i_children:
        if statements.is_mandatory_node(s):
            err_add(ctx.errors, s.pos, 'LINT_TOP_MANDATORY', s.arg)
Beispiel #8
0
def chk_config(old, new, ctx):
    if old.i_config == False and new.i_config == True:
        if statements.is_mandatory_node(new):
            err_add(ctx.errors, new.pos, 'CHK_MANDATORY_CONFIG', new.arg)
    elif old.i_config == True and new.i_config == False:
        err_add(ctx.errors, new.pos, 'CHK_BAD_CONFIG', new.arg)
Beispiel #9
0
def v_chk_mandatory_top_level(ctx, stmt):
    for s in stmt.i_children:
        if statements.is_mandatory_node(s):
            err_add(ctx.errors, s.pos, 'LINT_TOP_MANDATORY', s.arg)