coverallsapp / coverage-reporter

Self-contained, universal coverage uploader binary. Under development.
https://coveralls.io
MIT License
44 stars 14 forks source link

chore: refactor the code #8

Closed mrexox closed 1 year ago

mrexox commented 1 year ago

Summary:

mrexox commented 1 year ago

Of course!

At first, the parsers need to be self-sufficient classes and include all the required logic in one place (matching the report files and parsing). That's why I've added an abstract class BaseParser which should be used as the base for all parsers. So, adding a new parser should feel like following a guide where you cannot make a mistake (there are only 3 methods to implement). The return type of the parse method is stricter than an Array of Hashes - it is an Array of FileReport, so you can't pass random attributes or make a typo.

The second, adding a support for a CI-specific params. A module in src/coverage_reporter/ci/ implements params method which returns some of the params we send to API. It can return nothing or just a few of them. Their names are also checked via Params class, so there's no room for a mistake. BTW I guess I need to add Github Actions support.

I plan to add a documentation section under doc/ folder for adding a new format parser and CI params. Please, tell me if something is not clear. The design is always a matter of taste and habit and I can't be sure I have the 100% right vision :thinking:

afinetooth commented 1 year ago

Excellent, Thank you! 100% on board with your vision for the design.