Skip to content

Extend boolean_arithmetic_linter to detect all()-like cases too #1581

@MichaelChirico

Description

@MichaelChirico

Follow-up to #1579

Extend boolean_arithmetic_linter() to include all()-alike expressions like sum(x == y) == length(x) --> all(x == y).

The issues are

  1. we can't just test for length() on the RHS (e.g. sum(x == y) == length(z) could be totally different)
  2. looking for sum(x == y) == length(x == y) (i.e., exact expression matching, which we do in some other places) will only find a particularly silly manifestation of the issue
  3. there is a bit of a combinatorial explosion if we have to look for any symbol found inside the logical expression on the RHS (e.g. sum(x == y) == [length(x) _or_ length(y)]).

A first pass would be to check how many hits there are for the naive version (i.e., condition 1), to see how worth investing in this complicated logic is to begin with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions