Improve performance on files whitelist processing #410
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The original file whitelisting process works by using a
FileWhitelistScoper
class that maintains a list of all the whitelisted files. Every time a file is to be prefixed, the list is scanned and if it contains the file, then it's not prefixed. This is inefficient when the list of whitelisted files is big.This pull request changes the process to use a different approach
AddPrefixCommand
class.fileSystem->copy
.The
ConfigurableScoper
andFileWhitelistScoper
classes are removed since they are no longer needed.The logger is modified too so that now at the end of the process two separate counts are displayed, one for the prefixed files and
another one for the copied (whitelisted) files.
Improvement on
validateOutputDir
The
validateOutputDir
method asks the user for confirmation in a number of cases (e.g. target directory already exists) but does nothing with the user input. As an additional improvement, this pull request fixes this so that if the user answers "no" then the AddPrefixCommand process is aborted and the application terminates.TODO: Unit tests.