SonarLint: Replace if-then-else statement by single return statement.

SonarLint: Replace if-then-else statement by single return statement.

This is the most common issue you will see while fixing the sonarQube reported issues.

here we are returning true and false based on the condition.

Non Compliant Code

 private boolean isTextField(CustomField field) {
        if (field.getCustomFieldType().getKey().equals("com.atlassian.jira.")) {
            return true;
        }
        return false;
}

Compliant Code

Just return the comparison of the string whether it is true or false.

 private boolean isTextField(CustomField field) {        
        return field.getCustomFieldType().getKey().equals("com.atlassian.jira.") ;
    }