MozaicWorks / DMARCReporting

Simple tool to extract error reports from DMARC files
MIT License
11 stars 2 forks source link

Extract the file listing done in the CLI into a dedicated class #10

Closed tdpauw closed 11 months ago

tdpauw commented 2 years ago
        files = [
            f for f in listdir(input_dir) if isfile(join(input_dir, f))
        ]

from CLI.execute() should be extracted into a dedicated class, for instance FileLister.

The listing should also be limited to .gz and .zip file extensions.

alexboly commented 2 years ago

I've pushed a solution to this:

To run the tests, you need to install the dev dependencies - I've added a module named parameterized, because I prefer data driven tests whenever possible.

I think we can also make it better by removing the need to join(input_dir, file) in cli.py if we return the already joined path from FileLister. But I need to change the tests to do that, so I'll leave it for later.

Please review the changes when you can.

tdpauw commented 2 years ago

I agree we'd better remove the need to join(input_dir, file) in cli.py by moving this to the FileLister.

I like what you did. Thank you!

tdpauw commented 11 months ago

⚠️ Breaking change By moving the join(input_dir, file) to the FileLister, the console renderer now displays the report file path in the table instead of just the filename.