示例#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
示例#2
0
def main(args=None):
    try:
        app = RfLint()
        result = app.run(args)
        return result

    except Exception, e:
        print str(e)
        return 1
示例#3
0
 def __init__(self):
     """Initialize Robot Lint class."""
     config = {
         'TooFewKeywordSteps': (0,),
         'TooFewTestSteps': (0,),
         'TrailingBlankLines': (1,),
     }
     RfLint.__init__(self)
     user_rules = join(expanduser('~'), '.rflint.d')
     for user_rule in glob('%s/*.py' % user_rules):
         if user_rule.endswith('.__init__.py'):
             continue
         self._load_rule_file(user_rule)
     # pylint: disable=expression-not-assigned
     [rule.configure(*config[rule.name]) for rule in self.all_rules
      if rule.name in config.keys()]
示例#4
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)