Static code analysis
Concept
Static code analysis examines source code without running it to find bugs and security issues, often automatically on every commit in a CI/CD pipeline.
Description
Static code analysis is the practice of examining source code, or compiled code, without executing the program in order to find bugs, rule violations and security issues. Because the program is never run, the checks can happen early, before the software is deployed, and they can be repeated automatically. A common setup is to trigger the analysis on every commit in a CI/CD pipeline, so that findings reach developers while the change is still fresh.
A concrete example from Microsoft's documentation is the legacy analysis for managed code in Visual Studio, also known as FxCop analysis. This tool inspects compiled managed assemblies without running the program. It reports violations of programming and design rules drawn from the .NET design guidelines and, where possible, suggests how to fix them. Findings appear as warnings. Developers can run the analysis automatically on every build through the project's Code Analysis property page, or start it manually from the Analyze menu. Teams can also pair it with check-in policies and run it in team builds, which moves the checks from the individual workstation into a shared process.
Rule sets control which checks apply. Microsoft's default rule sets can be used, or custom rule sets can be created to match the standards of a team or organization. Individual warnings can be suppressed in source code with the SuppressMessage attribute, and a menu command can suppress all active issues at once. According to the documentation, this bulk suppression is useful after a migration that floods a project with warnings, because it lets a team establish a baseline and then deal with new findings as they appear. A key limit is that this legacy analysis does not support .NET Core or .NET Standard projects; for those, the documentation points to analyzers built on the .NET Compiler Platform.
Typical decisions around static code analysis include how strict the rule set should be, whether warnings should block a build or only inform, and how to handle suppressions so that they remain visible and justified. Choosing between default and custom rule sets, and deciding where in the pipeline the analysis runs (locally on build, at check-in, or in a team build), shapes how much friction developers experience and how reliably issues are caught.
The M365.FM episode "No-Code vs Low-Code vs Pro-Code: Which Should You Choose?" places the technique in the context of different development approaches. The episode says that security testing practices must change depending on the approach: traditional static code analysis is less useful for no-code, where there is little conventional source code to inspect. For no-code solutions, the episode recommends that security teams focus instead on runtime scanning, permission audits, configuration reviews and automated behavior testing. The same episode notes that pro-code shifts supply-chain trust to open-source dependencies and CI/CD pipelines, which is where automated static analysis typically runs and where it fits most naturally.
In summary, static code analysis is most effective where source or compiled code exists and where a build or pipeline can run the checks consistently. Its value comes from automation and early feedback, while its limits, such as platform support in a given tool or the absence of code in no-code scenarios, determine when other methods like runtime scanning and configuration review are needed alongside or instead of it.
Overview compiled with AI from M365.FM episodes and the facts on this page. You can improve it with the edit button below.
| Type | Concept |
|---|
Community wiki
Short info above, community knowledge below: add practical tips, examples or corrections. New contributions are reviewed first; trusted members publish directly.
Experts and companies for this topic
Nobody has listed this topic yet. Add it to your profile.
Maintained by Mirko Peters (Microsoft MVP) · Last updated: