SlideShare a Scribd company logo
Static Code Analysis
Christoforus Surjoputro
Engineering Manager - Alterra
Tools
Linter
Outline
Techniques
SonarQube
Definition
Definition
is the analysis of computer
software that is performed
without actually executing
programs.
is usually performed as part of
a Code Review (also known
as white-box testing) and is
carried out at the
Implementation phase of a
Security Development
Lifecycle (SDL).
https://en.wikipedia.org/wiki/Static_program_analysis
https://owasp.org/www-community/controls/Static_Code_Analysis
Techniques - Data Flow Analysis
is used to collect run-time
(dynamic) information about
data in software while it is in a
static state.
https://owasp.org/www-community/controls/Static_Code_Analysis
https://en.wikipedia.org/wiki/Common_subexpression_elimination
https://en.wikipedia.org/wiki/Live_variable_analysis
Techniques - Taint Analysis
is a feature in some computer
programming languages, such
as Perl and Ruby, (or in static
analysis tools), designed to
increase security by
preventing malicious users
from executing commands on
a host computer.
https://en.wikipedia.org/wiki/Taint_checking
https://www.cs.cmu.edu/~ckaestne/15313/2018/20181023-taint-analysis.pdf
Techniques - Others
- Abstract interpretation
- Hoare logic
- Model checking
- Symbolic execution
- etc.
https://en.wikipedia.org/wiki/Static_program_analysis
Tools
https://eslint.org/
https://www.sonarqube.org/
https://www.microfocus.com/en-us/cyberres/application-security/static-code-analyzer
Linter
is a static code analysis tool
used to flag programming
errors, bugs, stylistic errors
and suspicious constructs.
https://en.wikipedia.org/wiki/Lint_(software)
Linter - vscode - no extension
without go extension, vscode
does not tell us any concern in
this code although some point
of code will never reached or
executed.
https://github.com/3mp3ri0r/cgomath
Linter - vscode - installation
install go extension on vscode
via marketplace.
https://code.visualstudio.com/docs/languages/go
Linter - vscode - with extension
with go extension, vscode tell
us any concern in this code,
does not like before.
https://github.com/3mp3ri0r/cgomath
SonarQube
is an open-source platform
developed by SonarSource for
continuous inspection of code
quality to perform automatic
reviews with static analysis of
code to detect bugs, code
smells, and security
vulnerabilities on 20+
programming languages.
https://en.wikipedia.org/wiki/SonarQube
https://www.sonarqube.org/
SonarQube - running
docker run -d 
--name sonarqube 
-e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true 
-m 2g 
-p 9000:9000 
sonarqube:9.0.1-community
docker logs -f sonarqube
https://en.wikipedia.org/wiki/SonarQube
https://docs.sonarqube.org/latest/setup/get-started-2-minutes/
SonarQube - first time access
use admin on Login and
Password field. SonarQube
use admin as default
username and password.
https://docs.sonarqube.org/6.7/Authentication.html
SonarQube - first time access
enter the old and new
password. SonarQube force
us to change default
username and password on
first time access.
https://docs.sonarqube.org/6.7/Authentication.html
SonarQube - create new project
create project manually by
choosing “Manually” option.
SonarQube can be integrated
to many source version control
like github or any other devops
tools.
SonarQube - create new project
enter project display name and
project key with something
that you like. In our case we
use cgomath.
SonarQube - code integration
choose Locally since we want
to check our code manually
and locally.
SonarQube - code integration
put any name just to
differentiate with other token.
SonarQube - code integration
copy and keep it save as it will
be used to push our code to
project that we already create
before.
SonarQube - code integration
choose appropriate project
that you are work on. In our
case we use Go, so choose
Other.
choose OS you are using. In
our case, we use macOS, so
choose macOS.
SonarQube - code integration
go test -v -coverpkg=./... -coverprofile=coverage.out ./...
https://go.dev/blog/cover
SonarQube - code integration
update this properties
especially sonar.projectKey
to match with project key that
you put before when creating
new project at SonarQube. In
our case, we use cgomath.
docker run 
--rm 
-e SONAR_HOST_URL="http://localhost:9000" 
-e SONAR_LOGIN="13cf55024cfa7fc063f9b9ae49f5281f1a6b657a" 
-v "/Users/alt-christoforus/Personal/cgomath:/usr/src" 
--network host 
-m 1g 
sonarsource/sonar-scanner-cli
SonarQube - code integration
https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/
SonarQube - analyze code
analyze your code through
dashboard that we already set
before. When everything got A
means you have good quality
code.
SonarQube - analyze code
SonarQube has default quality
standard for each parameter.
You can create your own
standard that fit your need or
company goal.
The most dangerous kind of waste is the waste we do
not recognize.
~ Shigeo Shingo
https://proqc.com/blog/25-quotes-to-inspire-quality-success/
THANK YOU

More Related Content

PPTX
SonarQube Presentation.pptx
PPTX
SonarQube.pptx
PDF
#NoEstimates vs #Estimates - Vraiment?
PPTX
Static code analysis with sonar qube
DOCX
[DOC] Java - Code Analysis using SonarQube
PDF
Java Source Code Analysis using SonarQube
PDF
Continuous Inspection of Code Quality: SonarQube
DOCX
What is SonarQube in DevOps.docx
SonarQube Presentation.pptx
SonarQube.pptx
#NoEstimates vs #Estimates - Vraiment?
Static code analysis with sonar qube
[DOC] Java - Code Analysis using SonarQube
Java Source Code Analysis using SonarQube
Continuous Inspection of Code Quality: SonarQube
What is SonarQube in DevOps.docx

Similar to Static code analysis (20)

PPTX
Sonar qube
PDF
Code Quality Lightning Talk
PPTX
postgres.pptx
PDF
Control source code quality using the SonarQube platform
PPTX
Maven.pptx
PPTX
Sonarqube
PPTX
mydevops.pptx
PPTX
Code checkup
PPTX
postdev.pptx
PDF
SonarQube - Should I Stay or Should I Go ?
PPTX
Track code quality with SonarQube
PDF
Using Analyzers to Resolve Security Problems
PPTX
mastering-code-quality-an-in-depth-guide-to-sonarqube.pptx
PPTX
SonarQube: Continuous Code Inspection
PPTX
Static code analysis
PPTX
Static code analysis
PDF
The story of SonarQube told to a DevOps Engineer
PPTX
Beyond the basics of SonarQube: improve your Java(Script) code even further
PPTX
SonarQube - The leading platform for Continuous Code Quality
PPTX
SonarQube presentation.pptx
Sonar qube
Code Quality Lightning Talk
postgres.pptx
Control source code quality using the SonarQube platform
Maven.pptx
Sonarqube
mydevops.pptx
Code checkup
postdev.pptx
SonarQube - Should I Stay or Should I Go ?
Track code quality with SonarQube
Using Analyzers to Resolve Security Problems
mastering-code-quality-an-in-depth-guide-to-sonarqube.pptx
SonarQube: Continuous Code Inspection
Static code analysis
Static code analysis
The story of SonarQube told to a DevOps Engineer
Beyond the basics of SonarQube: improve your Java(Script) code even further
SonarQube - The leading platform for Continuous Code Quality
SonarQube presentation.pptx
Ad

More from Christoforus Surjoputro (9)

PDF
Deno Fundamentals
PDF
Is it fun to become a software engineer?
PDF
Backend engineer journey
PDF
Life as software engineer at startup
PDF
Unit testing ❤ pure function
PDF
Google maps replacement with python
PDF
How messenger bot work
PDF
Introduction to polymer project
ODP
Better Code With Python
Deno Fundamentals
Is it fun to become a software engineer?
Backend engineer journey
Life as software engineer at startup
Unit testing ❤ pure function
Google maps replacement with python
How messenger bot work
Introduction to polymer project
Better Code With Python
Ad

Recently uploaded (20)

PPTX
L1 - Introduction to python Backend.pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Introduction to Artificial Intelligence
PPTX
ai tools demonstartion for schools and inter college
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Transform Your Business with a Software ERP System
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
System and Network Administraation Chapter 3
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Essential Infomation Tech presentation.pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
medical staffing services at VALiNTRY
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Understanding Forklifts - TECH EHS Solution
L1 - Introduction to python Backend.pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
Introduction to Artificial Intelligence
ai tools demonstartion for schools and inter college
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
CHAPTER 2 - PM Management and IT Context
Transform Your Business with a Software ERP System
Odoo Companies in India – Driving Business Transformation.pdf
System and Network Administraation Chapter 3
Wondershare Filmora 15 Crack With Activation Key [2025
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Essential Infomation Tech presentation.pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
medical staffing services at VALiNTRY
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Upgrade and Innovation Strategies for SAP ERP Customers
Understanding Forklifts - TECH EHS Solution

Static code analysis

  • 4. Definition is the analysis of computer software that is performed without actually executing programs. is usually performed as part of a Code Review (also known as white-box testing) and is carried out at the Implementation phase of a Security Development Lifecycle (SDL). https://en.wikipedia.org/wiki/Static_program_analysis https://owasp.org/www-community/controls/Static_Code_Analysis
  • 5. Techniques - Data Flow Analysis is used to collect run-time (dynamic) information about data in software while it is in a static state. https://owasp.org/www-community/controls/Static_Code_Analysis https://en.wikipedia.org/wiki/Common_subexpression_elimination https://en.wikipedia.org/wiki/Live_variable_analysis
  • 6. Techniques - Taint Analysis is a feature in some computer programming languages, such as Perl and Ruby, (or in static analysis tools), designed to increase security by preventing malicious users from executing commands on a host computer. https://en.wikipedia.org/wiki/Taint_checking https://www.cs.cmu.edu/~ckaestne/15313/2018/20181023-taint-analysis.pdf
  • 7. Techniques - Others - Abstract interpretation - Hoare logic - Model checking - Symbolic execution - etc. https://en.wikipedia.org/wiki/Static_program_analysis
  • 9. Linter is a static code analysis tool used to flag programming errors, bugs, stylistic errors and suspicious constructs. https://en.wikipedia.org/wiki/Lint_(software)
  • 10. Linter - vscode - no extension without go extension, vscode does not tell us any concern in this code although some point of code will never reached or executed. https://github.com/3mp3ri0r/cgomath
  • 11. Linter - vscode - installation install go extension on vscode via marketplace. https://code.visualstudio.com/docs/languages/go
  • 12. Linter - vscode - with extension with go extension, vscode tell us any concern in this code, does not like before. https://github.com/3mp3ri0r/cgomath
  • 13. SonarQube is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs, code smells, and security vulnerabilities on 20+ programming languages. https://en.wikipedia.org/wiki/SonarQube https://www.sonarqube.org/
  • 14. SonarQube - running docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -m 2g -p 9000:9000 sonarqube:9.0.1-community docker logs -f sonarqube https://en.wikipedia.org/wiki/SonarQube https://docs.sonarqube.org/latest/setup/get-started-2-minutes/
  • 15. SonarQube - first time access use admin on Login and Password field. SonarQube use admin as default username and password. https://docs.sonarqube.org/6.7/Authentication.html
  • 16. SonarQube - first time access enter the old and new password. SonarQube force us to change default username and password on first time access. https://docs.sonarqube.org/6.7/Authentication.html
  • 17. SonarQube - create new project create project manually by choosing “Manually” option. SonarQube can be integrated to many source version control like github or any other devops tools.
  • 18. SonarQube - create new project enter project display name and project key with something that you like. In our case we use cgomath.
  • 19. SonarQube - code integration choose Locally since we want to check our code manually and locally.
  • 20. SonarQube - code integration put any name just to differentiate with other token.
  • 21. SonarQube - code integration copy and keep it save as it will be used to push our code to project that we already create before.
  • 22. SonarQube - code integration choose appropriate project that you are work on. In our case we use Go, so choose Other. choose OS you are using. In our case, we use macOS, so choose macOS.
  • 23. SonarQube - code integration go test -v -coverpkg=./... -coverprofile=coverage.out ./... https://go.dev/blog/cover
  • 24. SonarQube - code integration update this properties especially sonar.projectKey to match with project key that you put before when creating new project at SonarQube. In our case, we use cgomath.
  • 25. docker run --rm -e SONAR_HOST_URL="http://localhost:9000" -e SONAR_LOGIN="13cf55024cfa7fc063f9b9ae49f5281f1a6b657a" -v "/Users/alt-christoforus/Personal/cgomath:/usr/src" --network host -m 1g sonarsource/sonar-scanner-cli SonarQube - code integration https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/
  • 26. SonarQube - analyze code analyze your code through dashboard that we already set before. When everything got A means you have good quality code.
  • 27. SonarQube - analyze code SonarQube has default quality standard for each parameter. You can create your own standard that fit your need or company goal.
  • 28. The most dangerous kind of waste is the waste we do not recognize. ~ Shigeo Shingo https://proqc.com/blog/25-quotes-to-inspire-quality-success/