Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

Analyzer Architecture

rhit-siahmasf edited this page May 13, 2022 · 16 revisions

Overview

Currently, there are 12 different concrete analyzer classes (see _Concrete Analyzer Classes_below). Using the the abstract DomainAnalyzer, each concrete analyzer implements the template method getFeedback(classList: String[]), which calls three uniquely defined methods, respectively: getRelevantData(classList: String[]), analyzeData(), & composeReturnTurn(): ReturnType.

Methods

Method Name Description
getRelevantData collects all relevant data using parser: ASMParser
analyzeData utilize the getRelevantData() to create respective linter messages
composeReturnType constructs an AnalyzerReturn, counting the linter messages constructed

Concrete Analyzer Classes

Class Name Description
VarNameAnalyzer analyzes variable names to check for Java naming standards
TemplateMethodAnalyzer analyzes sets of classes to check for Template Pattern
StrategyAnalyzer analyzes sets of classes to check for Strategy Pattern
SingletonAnalyzer analyzes sets of classes to check for Singleton Pattern
PrincipleOfLeastKnowledgeAnalyzer analyzes module to check for any violations of the Principle of Least Knowledge
ObjectAdapterIdentifierAnalyzer analyzes module to check for Adapter Pattern
HighCouplingAnalyzer analyzes module to check for high coupling between classes
GenericTypeNameAnalyzer analyzes module for any Java generic type names being used & their format
ExceptionThrownAnalyzer analyzes module for unchecked Exceptions not being thrown properly
EqualsAndHashcodeAnalyzer analyzes module to check for overriding compatibility between equals & hashcode methods
CodeToInterfaceAnalyzer analyzes module to check for any violations of Coding to an interface (i.e. coding to abstraction)

Extensibility of Analyzers

If this repo is cloned, a developer can create their own Analyzer by extending the DomainAnalyzer class and implementing the respective methods. Below is an example of what this may look like for a new Analyzer:

public class MySpecialAnalyzer extends DomainAnalyzer {

         ASMParser parser = null;

         public MySpecialAnalyzer(ASMParser parser) {
              this.parser = parser;
         }

         public ReturnType getFeedback(String[] classList) {
                getRelevantData(classList);
                analyzeData();
               return composeReturnType();
         }

         public void getRelevantData(String[] classList){...}

         public void analyzeData(){...}

         public ReturnType composeReturnType(){...}
}

Clone this wiki locally