techan icon indicating copy to clipboard operation
techan copied to clipboard

Use varargs for And/Or rule.

Open tomarus opened this issue 3 years ago • 1 comments

This changes the And & Or rules to variadic functions and AFAIK it has no side effect and it's backwards compatible.

This optimizes indentation for larger rules.

Before:

entry := And(
    &PositionNewRule{},
    And(
        &ToTheMoonIndicator{},
        And(
            &UnderIndicatorRule{moonRotation, NewConstantIndicator(90)},
            &HasProfitRule{},
        )
    }
)

After:

entry := And(
    &PositionNewRule{},
    &ToTheMoonIndicator{},
    &UnderIndicatorRule{moonRotation, NewConstantIndicator(90)},
    &HasProfitRule{},
)

tomarus avatar Apr 01 '21 03:04 tomarus

Codecov Report

Merging #41 (279ca3a) into main (572c478) will increase coverage by 0.01%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #41      +/-   ##
==========================================
+ Coverage   98.36%   98.37%   +0.01%     
==========================================
  Files          42       42              
  Lines         611      615       +4     
==========================================
+ Hits          601      605       +4     
  Misses          7        7              
  Partials        3        3              
Impacted Files Coverage Δ
rule.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 572c478...279ca3a. Read the comment docs.

codecov[bot] avatar Apr 01 '21 03:04 codecov[bot]