April 17, 2024, 8:56 a.m. | Anastasiia Ogneva

DEV Community dev.to

Author: Andrey Karpov


Static analyzers help not only detect errors and security flaws but also make code cleaner. Analyzers find redundant checks, duplicate actions, and other anomalies — they give the opportunity to make code simpler, nicer, and easier to read. Let's break it down with a real example of function refactoring.



Look at the C code fragment from the iSulad project.



/* container state to disk */
int container_state_to_disk(const container_t *cont)
{
int ret = 0;

if (cont == …

actions author code cpp detect down easier errors find flaws function nicer opportunity programming real refactoring security security flaws static analyzer

Information Security Engineers

@ D. E. Shaw Research | New York City

Technology Security Analyst

@ Halton Region | Oakville, Ontario, Canada

Senior Cyber Security Analyst

@ Valley Water | San Jose, CA

Security Operations Manager-West Coast

@ The Walt Disney Company | USA - CA - 2500 Broadway Street

Vulnerability Analyst - Remote (WFH)

@ Cognitive Medical Systems | Phoenix, AZ, US | Oak Ridge, TN, US | Austin, TX, US | Oregon, US | Austin, TX, US

Senior Mainframe Security Administrator

@ Danske Bank | Copenhagen V, Denmark