Difference between revisions of "Static analysis"
(get opinionated) |
(Answer "Why") |
||
Line 1: | Line 1: | ||
− | Part of [[Testing]] is the static analysis that your IDE can perform, or that standalone analysis tools can perform. | + | Part of [[Testing]] is the '''static analysis''' that your IDE can perform, or that standalone analysis tools can perform. |
− | Some people don | + | Static analysis tools allow you to maintain a healthy codebase because every time you make a code change, you can check the entire codebase for quality without having to run the code. What does static analysis do for you? It gives you |
+ | |||
+ | * easier code review | ||
+ | * better code quality | ||
+ | * better product quality | ||
+ | |||
+ | Static analysis tools detect 'technical debt', 'smelly code' and 'bad practices'. These might be OK in the short-term, but over time will slow down your development cycle and wreck your product. | ||
+ | |||
+ | Some people don't like static analysis. Frankly, that might just be because you're OK producing software that has bugs. Or else I think it's either because those people are short-sighted in ways that extra process means "slow delivery" for them. Or, they don't know computer <nowiki>'''</nowiki>science<nowiki>'''</nowiki> and so if you mention topics like [[wp:Reification (computer science)]], they get uncomfortable and defensive. No matter the real reason, I don't believe you can be a professional software developer and disclaim the benefits and utility of static analysis tools in producing better quality software with less time and effort. | ||
[https://github.com/brendt Brent Roose] of PHP Annotated discusses Static Analysis in this video about Generics in PHP | [https://github.com/brendt Brent Roose] of PHP Annotated discusses Static Analysis in this video about Generics in PHP |
Revision as of 23:01, 25 February 2024
Part of Testing is the static analysis that your IDE can perform, or that standalone analysis tools can perform.
Static analysis tools allow you to maintain a healthy codebase because every time you make a code change, you can check the entire codebase for quality without having to run the code. What does static analysis do for you? It gives you
- easier code review
- better code quality
- better product quality
Static analysis tools detect 'technical debt', 'smelly code' and 'bad practices'. These might be OK in the short-term, but over time will slow down your development cycle and wreck your product.
Some people don't like static analysis. Frankly, that might just be because you're OK producing software that has bugs. Or else I think it's either because those people are short-sighted in ways that extra process means "slow delivery" for them. Or, they don't know computer '''science''' and so if you mention topics like wp:Reification (computer science), they get uncomfortable and defensive. No matter the real reason, I don't believe you can be a professional software developer and disclaim the benefits and utility of static analysis tools in producing better quality software with less time and effort.
Brent Roose of PHP Annotated discusses Static Analysis in this video about Generics in PHP
Static Analysis tools for PHP[edit | edit source]
Phan[edit | edit source]
see Phan
PHPStan[edit | edit source]
This is my favorite tool. See PHPStan