Beispiel #1
0
def main(args=None):
    try:
        app = RfLint()
        result = app.run(args)
        return result

    except Exception, e:
        sys.stderr.write(str(e) + "\n")
        return 1
def main(args=None):
    try:
        app = RfLint()
        result = app.run(args)
        return result

    except Exception, e:
        print str(e)
        return 1
Beispiel #3
0
def get_rules(rulefiles):
    import inspect
    
    rfLint = RfLint()
    for filename in rulefiles:
        rfLint._load_rule_file(filename)
    
    _ = rfLint.all_rules    # workaround to make all the rules load into _rules dictionary
    rules = []
    for rule in sorted(rfLint._rules.values(), key=lambda rule: rule.name):
        filepath = None
        try:
            filepath = inspect.getfile(rule.__class__)
            filepath = filepath[:-1] if filepath.lower().endswith('pyc') else filepath
        except:
            pass
        if filepath:
            rules.append((rule.severity, rule.name, filepath, rule.doc))
    return rules
def create_badge(robotfile, file):

    error_count = RfLint().run(robotfile)
    if error_count > 0 and error_count < 5:
        badge_svg = badge(left_text='RFLINT',
                          right_text='Errors count:' + str(error_count),
                          right_color='green',
                          logo=LOGO,
                          embed_logo=False)
        convert_svg(badge_svg, file)
    elif error_count > 5 and error_count < 9:
        badge_svg = badge(left_text='RFLINT',
                          right_text='Errors count:' + str(error_count),
                          right_color='yellow',
                          logo=LOGO,
                          embed_logo=False)
        convert_svg(badge_svg, file)
    elif error_count >= 9:
        badge_svg = badge(left_text='RFLINT',
                          right_text='Errors count:' + str(error_count),
                          right_color='red',
                          logo=LOGO,
                          embed_logo=False)
        convert_svg(badge_svg, file)