What Is Static Sentiment Analysis?
Static sentiment analysis is a groundbreaking theoretical approach that could reshape the software development process. Here we explain what is static sentiment analysis and how it has the potential to understand developer intent.
Read along or jump ahead to the section that interests you most:
➡️ easily enforce devops best practices
Back to topWhat Is Sentiment Analysis?
Sentiment analysis takes large volumes of data and uses natural language processing (NLP) to determine whether a body of text has a positive, negative, or neutral sentiment.
There are three main approaches to sentiment analysis:
- Rules-based techniques: A group of words (lexicons) are classified in terms of tone. For example, a positive lexicon might include “secure” and “compliant,” while a negative lexicon might contain “insecure” and “non-compliant.”
- Machine learning (ML)-based techniques: These techniques use algorithms trained to determine sentiment based on words appearing in blocks of text and the order in which they appear. The ML learns and improves as more data is ingested.
- Hybrid techniques: This combines rules-based and ML approaches to balance speed and accuracy based on the use case.
In a talk by Perforce Principal Software Engineer Alex Celeste at Embedded World, Celeste introduced the concept of static sentiment analysis, which combines sentiment analysis and static analysis.
Back to topWhat Is Static Sentiment Analysis?
Static sentiment analysis takes the concept of sentiment analysis and combines it with static analysis. Static sentiment analysis uses machine learning (a small-language model) to analyze code and determine developer intent.
In other words, static sentiment analysis could determine whether the code does what a developer meant for it to do.
As artificial intelligence and machine learning technologies advance, they can help automate the software development process by adding a new dimension to testing and save development teams time and effort.
Back to topMore on Static Sentiment Analysis
Explore how static sentiment analysis works, its benefits, and how static sentiment analysis complements static analysis best practices in our new eBook.
Challenges of Traditional Testing in Software Development
Traditional software testing isn’t enough in today’s complex digital landscape, especially with the introduction of AI and ML.
Manual testing and manual code reviews slow down the development cycle and introduce a higher risk of human error. Currently, teams using static analysis tools — like Perforce Helix QAC and Klocwork — are automating the process by detecting bugs, code vulnerabilities, and compliance issues early in development.
But while traditional techniques like static analysis perform well against “hard” criteria like syntax errors, buffer overflows, and quantifiable rules in coding standards, they can miss “soft” criteria like developer intent. That’s where static sentiment analysis comes in.
Developers may soon be able to bridge the gap between intent and implementation by taking a static sentiment analysis approach.
Back to topHow Does Static Sentiment Analysis Work?
Static sentiment analysis analyzes an abstract representation of code to determine if a test section is significantly different from a reference sample in the same code base. These differences could be changes in a developer’s style, code clarity, or misapplied design patterns.
A successful static sentiment analysis would not just detect the pattern of the structure — it would need to identify instances where the test section is sufficiently different from a reference sample and raise a flag.
To break it down further, static sentiment analysis determines the mathematical distance between the entropy of a test feature and a reference sample. The distance measures the similarity between features, and entropy evaluates the feature’s information. A significant increase in the distance between features indicates an unexpected change in style, which may require further investigation.
Back to topHow Static Analysis and Machine Learning Level Up DevOps Workflows
The promise of static sentiment analysis allows developers to identify where developer intent went amiss in code and better fulfill the needs of customers and industry standards.
While static sentiment analysis is still in the research phase, static analysis is currently helping DevOps teams shift left and increase developer productivity.
Static code analyzers Helix QAC and Klocwork help reduce technical debt by:
- Finding and fixing coding issues earlier
- Improving overall software quality
- Quickly inspecting millions of lines of source code (legacy and new code)
- Enforcing coding standards compliance
- Prioritizing risk and analysis results.
With the introduction of static sentiment analysis, DevOps teams could even further level up their workflows by also automatically checking for instances where developer intent may have been missed — greatly reducing the time and effort required for exhaustive functional testing.
In the meantime, there’s a lot you can do to level up now. See for yourself how Perforce Static Analysis helps accelerate development. Sign up for your free 7-day trial today.
➡️ Free Static Analysis Trial