alfasoftware / astra

Astra: a Java tool for analysing and refactoring Java source code
Apache License 2.0
68 stars 35 forks source link

Progress logging tracks against total files in directory, not files after prefiltering #13

Closed RadikalJin closed 3 years ago

RadikalJin commented 3 years ago

Describe the bug Astra UseCases provide the option to specify a prefilteringPredicate. This predicate is applied to the files in the directory that Astra runs over, and can be used to reduce the number of full ASTs that the tool needs to build. Where one is specified, and does filter out files from the target directory, Astra should reflect this in the progress logging, tracking against the total number of files after filtering with the predicate.

To Reproduce Steps to reproduce the behavior:

  1. Write an Astra UseCase which includes a prefilter
  2. Run Astra with that UseCase over a directory, where the prefilter reduces the number of applicable files for Astra to run over.
  3. Logging shown:
    INFO - 2401 .java files in directory to review
    INFO - Applying prefilters to files in directory
    INFO - 250 files remain after prefiltering
        INFO - [1%] complete, [25] of [2401] files reviewed

Expected behavior Completion count should be of the files that pass the filter, not all files. i.e. the final line of the logging should actually be:

        INFO - [10%] complete, [25] of [250] files reviewed