Package roswtf :: Module rules
[frames] | no frames]

Module rules

source code

Common library for writing rule-style checks for generating warnings and errors. Use of this style streamlines reporting.

The pattern for rules is simple: a rule provides a function that implements the rule and a format string. If the function returns a non-zero value, that value is combined with the format string to produced an error reporting string. There are other conveniences as well. If the rule returns a list or a tuple, that will be transformed into a human-readable list.

This library is a layer on top of the base WtfWarning and WtfError representation in roswtf.model.

Functions
 
warning_rule(rule, ret, ctx)
Check return value of rule and update ctx if rule failed.
source code
 
error_rule(rule, ret, ctx)
Check return value of rule and update ctx if rule failed.
source code
Variables
  __package__ = 'roswtf'
Function Details

warning_rule(rule, ret, ctx)

source code 

Check return value of rule and update ctx if rule failed.

Parameters:
  • rule ((rule_fn, format_msg)) - Rule/message pair.
  • ret - return value of rule. If value is non-zero, rule failed
  • ret - Any
  • ctx - context for which rule failed
  • ctx - WtfContext

error_rule(rule, ret, ctx)

source code 

Check return value of rule and update ctx if rule failed.

Parameters:
  • rule ((rule_fn, format_msg)) - Rule/message pair.
  • ret (Any) - return value of rule. If value is non-zero, rule failed
  • ctx (WtfContext) - context for which rule failed