-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Tracking bug for limitations associated with relying solely on the Zig AST. Ideally these would be solved by moving closer to the build system and compiler.
The bug description will be updated over time:
-
exclude_test
features - excluding code dedicated to testing may have limitations without some sort of multi build system where builds are compared to see what only appears in what (This could also have false positives due to logic being unused and only used in tests -which could be a lint rule itself but definitely needs some sort of multibuild)- Simple case like if its encased in
test {...}
block is fairly trivial but not whether its only ever called from within atest { ... }
or whether its excluded by some build time flag likebuiltin.is_test
- Simple case like if its encased in
-
exclude_debug
similar to exclude test excluding based on whetherbuiltin.mode
is debug is limited -
no_unused
rule is limited in that it can't inform you whether it's unused in everything except tests, which will give false negatives if your project is well tested, i.e., always referenced by some test. Potentially this could be improved by ignoring references intest { ... }
blocks but it wouldn't be perfect -
The potential
no_dead_branches
has a similar issue tono_unused
in that you probably could get an idea whether something is truly dead (e.g.,if (true)
and maybe some simple cases ofif (local_var_never_set_to_false)
) but to do well we really want to to see whether its dead in all builds and would be far easier to rely on the compiler than to try and do it ourselves with the AST