Laravel Pint is one of the recent linting tools in the Laravel ecosystem (its name is in fact a contraction of “PHP” and “lint”). You can use these tools in your local environment or hook them up to your CI/CD pipelines to automate the process and enforce the same quality standards across the team. As you get accustomed to them, you can write new rules and tailor them to your needs. Since you can start with almost no configuration, it's easy to integrate them in your workflow. For most of these tools, you can either use the default coding standard shipped with them or implement your own rules. These are some of the tools we use to keep our Laravel code clean and easy to maintain. Our top static analysis tools for PHP Laravel inconsistent or superfluous naming conventions.incorrect indentation (array indent, object operator indent, method chaining etc.).unused elements (unused variables, private elements, parameters etc.).In our experience working with PHP Laravel, here are a few: Things that are not necessarily complex, but tend to be overlooked precisely because they are common and would require some serious nitpicking by a human code reviewer. They can catch errors that are tricky to spot for humans or issues that might be overlooked when writing test cases or running dynamic tests. Think of it as a code reviewer that never sleeps. Static analysis tools also provide an additional layer of protection. Instant feedback equals quicker fixes, quicker fixes equal less time-consuming issues down the road. You fire up the analysis tool, it goes over your code and reports back any issues almost instantly. The biggest advantage of static analysis is that it provides an automated feedback loop. Let's say you're unable to run the tests locally, so you need to push your code to GitHub, want several minutes for the checks to run and then the test fails. In software development, feedback can sometimes be frustratingly slow. Static analysis tools allow you to grade code performance, check it against coding standards or discover things like unused variables and deprecated functions. This ensures that the code you pass on to the QA team is the highest quality possible. It's usually performed before you “test” the application in the traditional sense of the word. Static code analysis is a way to test the quality of your code and find bugs or inconsistencies without actually running the code (hence “static”). In this article you`ll find some of our top choices, tools we regularly use in all our Laravel projects. Especially if you work on large projects with tight deadlines and a lot of code that needs to be reviewed daily. Next, update the "scripts" configuration in your package.What's the first thing that comes to your mind when you think of “software testing”? Is it QA engineers writing test cases? Or the QA team checking if the software works properly and meets specifications? If your answer is either one, you might be missing out on one of the most underrated tools for maintaining quality under pressure: static code analysis.Īs a PHP Laravel developer, there are a lot of great static analysis tools you can use. # or npm install -D prettier prettier-plugin-blade prettier-plugin-tailwindcss Run the following command: yarn add -D prettier prettier-plugin-blade prettier-plugin-tailwindcss To get started, you need to install Prettier along with the Prettier Blade and Prettier Tailwind CSS plugins. To my delight, it worked flawlessly in all three projects I tested it on, prompting me to share this amazing tool with the world. ![]() In collaboration with John Koster, they have made significant improvements to this plugin recently.Īs someone who has been searching for a reliable Blade formatter, I was immediately intrigued and decided to give it a try. While scrolling through Twitter, I came across a tweet by Zep Fietje regarding a new Blade formatter plugin for Prettier.
0 Comments
Leave a Reply. |