Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruleguard,analyzer: implement rules debugging #104

Merged
merged 1 commit into from
Oct 30, 2020

Commits on Oct 30, 2020

  1. ruleguard,analyzer: implement rules debugging

    When ruleguard is called with -debug-group=<string> arg,
    it'll print rejected matches explanations to the stderr
    for the specified rules group.
    
    By default, this argument is an empty string that means "no debug".
    
    Explanation includes:
    
    	* Submatch nodes (with types)
    	* Rejection reason (sometimes approx)
    	* Rejected node location
    
    Here is an example of how explanations can look like:
    
    	example.go:4: rejected by rules.go:6 ($s type filter)
    	  $s [10]int: a
    
    	example2.go:9: rejected rules2.go:8 ($s2 is const)
    	  $s1 string: v1
    	  $s2 string: ""
    
    	example2.go:7: rejected rules2.go:8 ($s1 is not const)
    	  $s1 string: v1
    	  $s2 string: v2
    
    The debug output format is experimental and can change over time.
    Any feedback is appreciated.
    
    This change also adds Line:int and Group:string fields to the rules info.
    
    	Line is a rules file line that declared this rule
    	Group is a containing function name
    
    Refs #98
    
    Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
    quasilyte committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    6d996d5 View commit details
    Browse the repository at this point in the history