This repository contains a simple coding kata.
Category: refactoring
Skill Level: beginner
Time: ~30 mins
This repository contains the starting code.
The logic is contained in a single method, Pipeline.run()
.
This method contains a number of embedded if
statements.
Your goal is to refactor the code to a more understandable and desireable state.
Remember, keep the tests passing while you refactor!
Below you can find some resources demonstrating the approach that this kata was designed to teach. However, I recommend you try the kata yourself first, and then review the resources.
- Blog Post: Refactoring — Untangling Conditionals.
- Video:
We are creating a spike Pipeline class which controls tour build pipeline.
We will have dependencies for Config, Email, Logging and Project information
later.
-
If the project has tests we run tests
- we log test result (success or failure)
-
if there are no tests we log that there are no tests and proceed
-
if tests passed (or no tests) we deploy the project.
- we log deploy result (success or failure)
-
if config is set to send emails, we send email report
- when test and deploy passed we email a report of that
- when deploy failed we email a report that
- when test failed we email a report that
- else we log that email is disabled.