Skip to content

v0.4.9

Compare
Choose a tag to compare
@brendongo brendongo released this 07 Apr 20:44
6c55267

Changed

  • Only print out number of configs and rules when running with verbose flag
  • Match let and const to var in javascript:
    var $F = "hello"
    
    will now match any of the following expressions:
    var foo = "hello";
    let bar = "hello";
    const baz = "hello";

Added

  • Print out --dump-ast

  • Print out version with --version

  • Allow ... in arrays

    [..., 1]
    

    will now match

    [3, 2, 1]
    
  • Support Metavariable match on keyword arguments in python:

    foo(..., $K=$B, ...)
    

    will now match

    foo(1, 2, bar=baz, 3)
    
  • Support constant propogation in f-strings in python:

    $M = "..."
    ...
    $Q = f"...{$M}..."
    

    will now match

    foo = "bar"
    baz = f"qux {foo}"
  • Constant propogation in javascript:

    api("literal");
    

    will now match with any of the following:

    api("literal");
    const LITERAL = "literal";
    api(LITERAL);
    const LIT = "lit";
    api(LIT + "eral");
    const LIT = "lit";
    api(`${LIT}eral`);
  • Deep statement matching:
    Elipsis operator (...) will also include going deeper in scope (i.e. if-else, try-catch, loop, etc.)

    foo()
    ...
    bar()
    

    will now match

    foo()
    if baz():
        try:
            bar()
        except Exception:
            pass
  • Unified import resolution in python:

    import foo.bar.baz
    

    will now match any of the following statements:

    import foo.bar.baz
    import foo.bar.baz.qux
    import foo.bar.baz as flob
    import foo.bar.baz.qux as flob
    from foo.bar import baz
    from foo.bar.baz import qux
    from foo.bar import baz as flob
    from foo.bar.bax import qux as flob
  • Support for anonymous functions in javascript:

    function() {
        ...
    }
    

    will now match

    var bar = foo(
        //matches the following line
        function () { console.log("baz"); }
    );
  • Support arrow function in javascript

    (a) => { ... }
    

    will now match:

    foo( (a) => { console.log("foo"); });
    foo( a => console.log("foo"));
    // arrows are normalized in regular Lambda, so an arrow pattern
    // will match also old-style anynonous function.
    foo(function (a) { console.log("foo"); });
  • Python implicit string concatenation

    $X = "..."
    

    will now match

    # python implicitly concatenates strings
    foo = "bar"       "baz"              "qux"
  • Resolve alias in attributes and decorators in python

    @foo.bar.baz
    def $X(...):
        ...
    

    will now match

    from foo.bar import baz
    @baz
    def qux():
        print("hello")

Fixed

  • Handle misordered multiple object destructuring assignments in javascript:
    var {foo, bar} = qux;
    
    will now match
    var {bar, baz, foo} = qux;
    
  • Defining properties/functions in different order:
    var $F = {
        two: 2,
        one: 1
    };
    
    will now match both
    var foo = {
      two: 2,
      one: 1
    };
    var bar = {
        one: 1,
        two: 2
    };
  • Metavariables were not matching due to go parser adding empty statements in golang