Skip to content

YALO warnings trigger on ppx generated code #21

@NathanReb

Description

@NathanReb

See this warning (and multiple similar others) that are reported by yalo on oui's test suite:

File "tests/oui_lib/test_string_with_vars.ml", lines 37-41, characters 0-87
Warning (YALO+10): Inner module "Ppx_expect_test_block" should be fully uppercase ("PPX_EXPECT_TEST_BLOCK" here)

00035     [%expect {| { String_with_vars.subst_string = "<x>.<y>"; unknown_vars = ["<x>"; "<y>"] } |}]
00036
00037 > let%expect_test "subst: unknown var reported once" =
00038 >   let t = of_string "<x>.<x>" in
00039 >   let res = subst ~install_path:"XX" t in
00040 >   Format.printf "%a" pp_subst_result res;
00041 >   [%expect {| { String_with_vars.subst_string = "<x>.<x>"; unknown_vars = ["<x>"] } |}]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
00042

It appears this triggers from inside the ppx-generated code which is something we probably don't want for a large variety of warnings.

There are a few ways to approach this such as running on non preprocessed sources or not running linters on ghost loc AST nodes (which won't always work as not all ppx-es will generate nodes with ghost locations).

Note that this can probably occur with other warnings as well!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions