Skip to content

stats.Collector from ScanConfig not propagated to Extractors #2316

Description

@evankanderson

Numerous extractors (for example, the package-lock.json extractor) fail mostly-silently when encountering files larger than MaxFileSizeBytes. Somewhat-helpfully, they will report these files as "size limit exceeded" to any configured stats.Collector. Unfortunately, this capability is only used in tests, and is not generally accessible from the .Scan() interface, which does accept a stats.Collector, but does not propagate it to the extractors, only to filesystem.go.

I'm currently using reflection to store the collector in each plugin that has a "Stats" field of the correct type, but this feels bad. Unfortunately, the lifecycle of the plugins and the scan seems decoupled such that the current contracts don't provide a good way to pass the stats to the multiple extractor entry-points (FileRequired/Extract).

Would a patch for this be accepted?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions