the-lean-crate / criner

A tool to mine crates.io and produce static websites
MIT License
122 stars 2 forks source link

An algorithm to generate glob patterns that match given entries, but not other given glob patterns #2

Open Byron opened 4 years ago

Byron commented 4 years ago

Quite similar to what grex does for regex, we seek to do in this function: https://github.com/crates-io/criner/blob/5b0c4795c73f8a5d9c772f27d2d33abe9ec5f66f/criner/src/engine/report/waste/report/result.rs#L220-L229

If it works, it will turn this… https://github.com/crates-io/criner/blob/2ea15d562d794bea5df9664bacf9995d4b14025e/criner/src/engine/report/waste/report_test/from_extracted_crate.rs#L134-L135

…into this (note the negation)…

…
include_added: ["!pregenerated/tmp/*"]
…

There are alternatives to a negation pattern, which would be 'just the right™️' include patterns. It might also be possible to adjust the code leading up to it so that 'being smart' is not needed by simply 'being less stupid' beforehand.