Showing 20 of 29 total issues

File Maoni.java has 575 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 518 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

      Method onCreate has 148 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

        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 32 (exceeds 5 allowed). Consider refactoring.
          Open

              public void start(@Nullable final Activity callerActivity) {
          
                  if (mUsed.getAndSet(true)) {
                      this.clear();
                      throw new UnsupportedOperationException(
          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 117 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method initScreenCaptureView has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

                private void initScreenCaptureView(@NonNull final Intent intent) {
                    final ImageButton screenshotThumb = (ImageButton)
                            findViewById(R.id.maoni_screenshot);
            
                    final TextView touchToPreviewTextView =
            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 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 start has 104 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void start(@Nullable final Activity callerActivity) {
            
                    if (mUsed.getAndSet(true)) {
                        this.clear();
                        throw new UnsupportedOperationException(
            Severity: Major
            Found in maoni/src/main/java/org/rm3l/maoni/Maoni.java - About 4 hrs to fix

              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;
              Severity: Major
              Found in maoni/src/main/java/org/rm3l/maoni/ui/MaoniActivity.java - About 2 hrs to fix

                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;
                Severity: Minor
                Found in maoni/src/main/java/org/rm3l/maoni/utils/LogcatUtils.java - About 1 hr to fix

                  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);
                    Severity: Minor
                    Found in maoni/src/main/java/org/rm3l/maoni/ui/MaoniActivity.java - About 1 hr 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 getLogsAsString has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static String getLogsAsString() {
                    
                            final StringBuilder builder = new StringBuilder();
                    
                            InputStreamReader in = null;
                    Severity: Minor
                    Found in maoni/src/main/java/org/rm3l/maoni/utils/LogcatUtils.java - About 1 hr to fix

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

                          @Override
                          protected void onCreate(Bundle savedInstanceState) {
                              super.onCreate(savedInstanceState);
                              PreferenceManager.setDefaultValues(this, R.xml.maoni_sample_preferences, false);
                              setContentView(R.layout.activity_maoni_sample_main);

                        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;
                        Severity: Minor
                        Found in maoni/src/main/java/org/rm3l/maoni/utils/LogcatUtils.java - About 55 mins 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 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);
                        Severity: Minor
                        Found in maoni/src/main/java/org/rm3l/maoni/ui/AppBarStateChangeListener.java - About 55 mins 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 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) {
                        Severity: Minor
                        Found in maoni/src/main/java/org/rm3l/maoni/Maoni.java - About 55 mins 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 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;
                        Severity: Minor
                        Found in maoni/src/main/java/org/rm3l/maoni/utils/LogcatUtils.java - About 45 mins 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

                        Severity
                        Category
                        Status
                        Source
                        Language