Lifeguard is a static analyzer to detect Lazy Imports incompatibilities and ease the adoption overhead for Lazy Imports in Python
by facebookPython
Last 12 weeks · 274 commits
4 of 6 standards met
Re-exported symbols (e.g. bar.Foo re-exporting foo.Foo) were not being resolved to their original definitions during safety analysis. This caused check_call to miss unsafe constructors/functions accessed through re-exports, incorrectly marking them as safe. Make the re_exports more visible to the main analysis, and resolve them when needed. I'm not totally happy with this approach, though, because it's would be easy to miss new places that a reexport needs to be chased down. I'll do a bit more thinking, but I'd be interested in architectural suggestions from the team.
Changes: Group errors by ErrorKind (using BTreeMap for consistent ordering) Sort errors within each group by line number Display the count of occurrences for each error type Example output: ImportedModuleAssignment (2) Line 12 - os Line 17 - sys UnsafeFunctionCall (1) Line 38 - example.demo.unsafe_method Benefits: Easier to scan large reports and identify patterns Highlights the most common issue categories Does not change the underlying analysis Backward compatible with existing analysis logic Testing: Updated existing tests to verify grouped output Added comprehensive test for grouping and sorting behavior
Repository: facebook/Lifeguard. Description: Lifeguard is a static analyzer to detect Lazy Imports incompatibilities and ease the adoption overhead for Lazy Imports in Python Stars: 86, Forks: 9. Primary language: Python. Languages: Python (72.1%), Rust (27.9%), Starlark (0%). License: MIT. Topics: lazy-imports, pep810, python, rust, static-analysis. Open PRs: 1, open issues: 0. Last activity: 6h ago. Community health: 75%. Top contributors: brittanyrey, martindemello, alrobichaud, QuantumManiac, msullivan, samwgoldman, dependabot[bot], czardoz, alexmalyshev, kuecks and others.