Showing 37 of 75 total issues
Method onSendButtonClicked
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
override fun onSendButtonClicked(feedback: Feedback?): Boolean {
// Depending on your use case, you may add specific data in the feedback object returned,
// and manipulate it accordingly
feedback?.put("Email", mEmail?.text ?: "???")
feedback?.put("My Extra Edit Text", mExtraEditText?.text ?: "")
- 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 onSendButtonClicked
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onSendButtonClicked(feedback: Feedback?): Boolean {
// Depending on your use case, you may add specific data in the feedback object returned,
// and manipulate it accordingly
feedback?.put("Email", mEmail?.text ?: "???")
feedback?.put("My Extra Edit Text", mExtraEditText?.text ?: "")
Builder
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
public static final class Builder {
static final long READ_TIMEOUT_DEFAULT = 10;
static final TimeUnit READ_TIMEOUT_UNIT_DEFAULT = TimeUnit.SECONDS;
static final long CONNECT_TIMEOUT_DEFAULT = 10;
Method onSendButtonClicked
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onSendButtonClicked(feedback: Feedback?): Boolean {
debug {"onSendButtonClicked"}
val connectivityManager =
context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
Method validateAndSubmitForm
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void validateAndSubmitForm() {
//Validate form
if (this.validateForm(mRootView)) {
//TODO Check that device is actually connected to the internet prior to going any further
boolean includeScreenshot = false;
Method getLogsToFile
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void getLogsToFile(@NonNull final File outputFile) {
PrintWriter out = null;
BufferedReader bufferedReader = null;
InputStreamReader in = null;
Method buildImmutableMapView
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Map<String, Object> buildImmutableMapView() {
final SortedMap<String, Object> output = new DeviceInfoSortedMap();
output.put(SDK_VERSION, sdkVersion);
Method validateForm
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private boolean validateForm(@NonNull View rootView) {
if (mContent != null) {
if (TextUtils.isEmpty(mContent.getText())) {
if (mContentInputLayout != null) {
mContentInputLayout.setErrorEnabled(true);
- 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 getLogsAsString
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static String getLogsAsString() {
final StringBuilder builder = new StringBuilder();
InputStreamReader in = null;
Method buildMaoniEmailListener
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun buildMaoniEmailListener(feedback: Feedback?): Listener {
val customSubject = context.defaultSharedPreferences.getString("maoni_email_subject", "")
val useCustomSubject = customSubject?.isNotBlank()
val customTo = context.defaultSharedPreferences.getString("maoni_email_to", "")
?.split(",")
Method buildMaoniGithubListener
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun buildMaoniGithubListener(): Listener {
val customUsername = context.defaultSharedPreferences.getString("maoni_github_username", "")
val useCustomUsername = customUsername?.isNotBlank()
val customToken = context.defaultSharedPreferences.getString("maoni_github_token", "")
Method buildMaoniJiraListener
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun buildMaoniJiraListener(): Listener {
val customApiEndpoint = context.defaultSharedPreferences.getString("maoni_jira_rest_base_url", "")
val useCustomApiEndpoint = customApiEndpoint?.isNotBlank()
val customUsername = context.defaultSharedPreferences.getString("maoni_jira_username", "")
Method getLogsToFile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static void getLogsToFile(@NonNull final File outputFile) {
PrintWriter out = null;
BufferedReader bufferedReader = null;
InputStreamReader in = null;
- 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 withSharedPreferences
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public Builder withSharedPreferences(@Nullable final Map<String, Integer> sharedPreferencesModeMap) {
if (sharedPreferencesModeMap == null || sharedPreferencesModeMap.isEmpty()) {
return this;
}
if (this.context == null) {
- 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 onOffsetChanged
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@Override
public final void onOffsetChanged(AppBarLayout appBarLayout, int i) {
if (i == 0) {
if (mCurrentState != State.EXPANDED) {
onStateChanged(appBarLayout, State.EXPANDED);
- 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 getLogsAsString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static String getLogsAsString() {
final StringBuilder builder = new StringBuilder();
InputStreamReader in = null;
- 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
Consider simplifying this complex logical expression. Open
if (maoniJiraConfigured &&
context.defaultSharedPreferences.getString("maoni_jira_rest_base_url", "")?.isBlank() == true &&
context.defaultSharedPreferences.getString("maoni_jira_username", "")?.isBlank() == true &&
(
TextUtils.isEmpty(BuildConfig.JIRA_REST_BASE_URL)