From the course: Refactoring with GitHub Copilot
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Keep devs happy - Github Copilot Tutorial
From the course: Refactoring with GitHub Copilot
Keep devs happy
What's your favorite project to work on? I think most devs would prefer building something new versus maintaining existing code. Imagine the worst codebase you've worked in. No one set out for it to be that difficult. It just grew that way, and no time was spent refactoring along the way. This is the app directory from a Laravel project. The purpose of this project was to be a dashboard for sales information from multiple e-commerce sites. This is code I wrote several years ago for a client; the site is no longer online. E-commerce sites in this network would write to the API, and this controller was responsible for ingesting the data and storing it. But the problematic part was in need to calculate averages on sales for different ranges of time. This CLI command was responsible for that. It's a cool to do, output might be nice. The generate_averages method is really interesting to me in hindsight. Specifically, line 44, iterating through each of the ranges to run some raw database…