Showing 9 of 13 total issues
Method transitionToNextState
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public AbstractState transitionToNextState(String token) throws CaggiaFaException {
if (token.equalsIgnoreCase(Keywords.SELECT_KEYWORD)) {
queryInfo.setType(QueryType.SELECT);
return new SelectColumnsState(queryInfo);
Method execute
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public GomorraSqlQueryResult execute(String gomorraSqlQuery) {
QueryInfo queryInfo = parseQuery(gomorraSqlQuery);
String sqlQuery = buildSqlQuery(queryInfo);
GomorraSqlQueryResult result = new GomorraSqlQueryResult();
Method main
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in, StandardCharsets.ISO_8859_1.name());
System.out.print("Insert a JDBC string to connect to a database: ");
String url = scanner.nextLine();
Connection connection = DriverManager.getConnection(url);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method transitionToNextState
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@Override
public AbstractState transitionToNextState(String token) throws CaggiaFaException {
if (token.equals(",")) {
if (lastWasComma) {
// Case ", ,"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method transitionToNextState
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public AbstractState transitionToNextState(String token) throws CaggiaFaException {
if (Keywords.WHERE_OPERATORS.contains(token) || token.equalsIgnoreCase(Keywords.IS_KEYWORD)) {
if (token.equalsIgnoreCase(Keywords.IS_NOT_KEYWORDS[0])) {
condition.setOperator("IS NOT");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method transitionToNextState
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public AbstractState transitionToNextState(String token) throws CaggiaFaException {
if (token.equalsIgnoreCase(Keywords.SELECT_KEYWORD)) {
queryInfo.setType(QueryType.SELECT);
return new SelectColumnsState(queryInfo);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return new GreedyMatchKeywordState(queryInfo, Keywords.BEGIN_TRANSACTION_KEYWORDS, FinalState::new);
Avoid too many return
statements within this method. Open
return new GreedyMatchKeywordState(queryInfo, Keywords.COMMIT_KEYWORDS, FinalState::new);
Avoid too many return
statements within this method. Open
return new FinalState(queryInfo);