Showing 73 of 73 total issues

Method onSendButtonClicked has a Cognitive Complexity of 119 (exceeds 20 allowed). Consider refactoring.
Open

    override fun onSendButtonClicked(feedback: Feedback?): Boolean {
        debug {"onSendButtonClicked"}

        val connectivityManager =
                context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager

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

File Maoni.java has 584 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2016 Armel Soro
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
Severity: Major
Found in maoni/src/main/java/org/rm3l/maoni/Maoni.java - About 1 day to fix

    File MaoniActivity.java has 513 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright (c) 2016 Armel Soro
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
    Severity: Major
    Found in maoni/src/main/java/org/rm3l/maoni/ui/MaoniActivity.java - About 1 day to fix

      Method onCreate has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          protected void onCreate(Bundle savedInstanceState) {
      
              super.onCreate(savedInstanceState);
      
      
      Severity: Minor
      Found in maoni/src/main/java/org/rm3l/maoni/ui/MaoniActivity.java - About 7 hrs to fix

      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

      File MaoniDoorbellListener.java has 443 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       * Copyright (c) 2016 Armel Soro
       *
       * Permission is hereby granted, free of charge, to any person obtaining a copy
       * of this software and associated documentation files (the "Software"), to deal

        Method onCreate has 147 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            protected void onCreate(Bundle savedInstanceState) {
        
                super.onCreate(savedInstanceState);
        
        
        Severity: Major
        Found in maoni/src/main/java/org/rm3l/maoni/ui/MaoniActivity.java - About 5 hrs to fix

          Method onSendButtonClicked has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public boolean onSendButtonClicked(final Feedback feedback) {
          
                  final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
                  intent.setData(Uri.parse("mailto:")); // only email apps should handle this

          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 127 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

            Builder has 37 methods (exceeds 20 allowed). Consider refactoring.
            Open

                public static class Builder {
            
                    @Nullable
                    private final Context context;
            
            
            Severity: Minor
            Found in maoni/src/main/java/org/rm3l/maoni/Maoni.java - About 4 hrs to fix

              Method start has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

                  private void start(Activity callerActivity, Window window) {
                      if (mUsed.getAndSet(true)) {
                          this.clear();
                          throw new UnsupportedOperationException(
                                  "Maoni instance cannot be reused to start a new activity. " +
              Severity: Minor
              Found in maoni/src/main/java/org/rm3l/maoni/Maoni.java - About 4 hrs to fix

              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 initScreenCaptureView has 114 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void initScreenCaptureView(@NonNull final Intent intent) {
                      final ImageButton screenshotThumb = findViewById(R.id.maoni_screenshot);
              
                      final TextView touchToPreviewTextView = findViewById(R.id.maoni_screenshot_touch_to_preview);
                      if (touchToPreviewTextView != null && intent.hasExtra(SCREENSHOT_TOUCH_TO_PREVIEW_HINT)) {
              Severity: Major
              Found in maoni/src/main/java/org/rm3l/maoni/ui/MaoniActivity.java - About 4 hrs to fix

                Method doWork has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        @Override
                        protected Throwable doWork() {
                            publishProgress(STARTED);
                            final boolean includeScreenshot = feedback.includeScreenshot;
                            final boolean includeLogs = feedback.includeLogs;

                  Method validateAndSubmitForm has a Cognitive Complexity of 29 (exceeds 5 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;
                  Severity: Minor
                  Found in maoni/src/main/java/org/rm3l/maoni/ui/MaoniActivity.java - About 4 hrs to fix

                  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 doWork has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                          @Override
                          protected Throwable doWork() {
                              publishProgress(STARTED);
                              final boolean includeScreenshot = feedback.includeScreenshot;
                              final boolean includeLogs = feedback.includeLogs;

                  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 initScreenCaptureView has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private void initScreenCaptureView(@NonNull final Intent intent) {
                          final ImageButton screenshotThumb = findViewById(R.id.maoni_screenshot);
                  
                          final TextView touchToPreviewTextView = findViewById(R.id.maoni_screenshot_touch_to_preview);
                          if (touchToPreviewTextView != null && intent.hasExtra(SCREENSHOT_TOUCH_TO_PREVIEW_HINT)) {
                  Severity: Minor
                  Found in maoni/src/main/java/org/rm3l/maoni/ui/MaoniActivity.java - About 4 hrs to fix

                  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 start has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private void start(Activity callerActivity, Window window) {
                          if (mUsed.getAndSet(true)) {
                              this.clear();
                              throw new UnsupportedOperationException(
                                      "Maoni instance cannot be reused to start a new activity. " +
                  Severity: Major
                  Found in maoni/src/main/java/org/rm3l/maoni/Maoni.java - About 4 hrs to fix

                    Method onSendButtonClicked has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
                    Open

                        override fun onSendButtonClicked(feedback: Feedback?): Boolean {
                            debug {"onSendButtonClicked"}
                    
                            val connectivityManager =
                                    context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager

                    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 a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
                    Open

                        override fun onSendButtonClicked(feedback: Feedback?): Boolean {
                            debug {"onSendButtonClicked: webhook='$webhookUrl', channel='$channel', username='$username'"}
                    
                            val connectivityManager =
                                    context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager

                    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 86 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        override fun onSendButtonClicked(feedback: Feedback?): Boolean {
                            debug {"onSendButtonClicked: webhook='$webhookUrl', channel='$channel', username='$username'"}
                    
                            val connectivityManager =
                                    context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager

                      Method onSendButtonClicked has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          @Override
                          public boolean onSendButtonClicked(final Feedback feedback) {
                      
                              final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
                              intent.setData(Uri.parse("mailto:")); // only email apps should handle this
                        Severity
                        Category
                        Status
                        Source
                        Language