DEV Community

Matt Kenefick
Matt Kenefick

Posted on

Commands to check your technical debt in Laravel

The core command here is:

grep -nr -e '@urgent' -e '@todo' -e '@fixme'  resources app

    -e Designates a pattern to find
    -n Shows the line number
    -r Recursively through directories

    List as many directories in sequence to iterate through
Enter fullscreen mode Exit fullscreen mode

I've added it to composer as a script called "debt":

"debt": [
    "grep -nr -e '@urgent' -e '@todo' -e '@fixme'  resources app"
],
Enter fullscreen mode Exit fullscreen mode

Then you can run something like:

composer debt


app/Utility/Film.php:39:     * @todo Swap out with a regex
app/Utility/Media.php:161:     * @todo we have to make sure we kill the webp as well
app/Utility/Media.php:189:     * @todo move this to a utility class like we did for Utility/Media
app/Utility/Media.php:592:        // @flag @urgent the `getCommonColors` function is slow
Enter fullscreen mode Exit fullscreen mode

You could also use it in package.json like:

"scripts": {
    "debt": "grep -nr -e '@urgent' -e '@todo' -e '@fixme'  resources app"
}

...

    npm run debt
Enter fullscreen mode Exit fullscreen mode

Top comments (0)