TiagoMSSantos/MobileRT

View on GitHub

Showing 666 of 666 total issues

Method getPathFromFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    @NonNull
    private String getPathFromFile(@NonNull final Uri uri) {
        logger.info("Parsing path:" + Arrays.toString(uri.getPathSegments().toArray()));
        validatePathIsAccessible(uri);

Severity: Minor
Found in app/src/main/java/puscas/mobilertapp/MainActivity.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 setUp has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Before
    @CallSuper
    public void setUp() {
        final String methodName = Thread.currentThread().getStackTrace()[2].getMethodName();
        logger.info(methodName + ": " + this.testName.getMethodName());
Severity: Minor
Found in app/src/androidTest/java/puscas/mobilertapp/AbstractTest.java - About 1 hr to fix

    Method perform has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public void perform(@NonNull final UiController uiController, @NonNull final View view) {
            final String methodName = Thread.currentThread().getStackTrace()[2].getMethodName();
            logger.info(methodName);
    
    
    Severity: Minor
    Found in app/src/androidTest/java/puscas/mobilertapp/ViewActionButton.java - About 1 hr to fix

      Method renderScene has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          synchronized void renderScene(@NonNull final Config config) {
              logger.info(ConstantsMethods.RENDER_SCENE);
      
              MainActivity.resetErrno();
              stopDrawing();
      Severity: Minor
      Found in app/src/main/java/puscas/mobilertapp/DrawView.java - About 1 hr to fix

        Method initializePickerResolutions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void initializePickerResolutions(final int pickerSizes) {
                logger.info("initializePickerResolutions start");
                final int maxSizes = 9;
                this.pickerResolutions.setMinValue(1);
                this.pickerResolutions.setMaxValue(maxSizes - 1);
        Severity: Minor
        Found in app/src/main/java/puscas/mobilertapp/MainActivity.java - About 1 hr to fix

          Method setupRenderer has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void setupRenderer(final TextView textView, final Button renderButton) {
                  logger.info("setupRenderer start");
          
                  this.drawView.setVisibility(View.INVISIBLE);
                  this.drawView.setEGLContextClientVersion(MyEglContextFactory.EGL_CONTEXT_CLIENT_VERSION);
          Severity: Minor
          Found in app/src/main/java/puscas/mobilertapp/MainActivity.java - About 1 hr to fix

            Method loadShader has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @VisibleForTesting
                public static int loadShader(final int shaderType,
                                             @NonNull final String source) {
                    logger.info("loadShader");
                    final int shader = UtilsGL.run(() -> GLES20.glCreateShader(shaderType));
            Severity: Minor
            Found in app/src/main/java/puscas/mobilertapp/utils/UtilsShader.java - About 1 hr to fix

              Method getPathFromFile has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @NonNull
                  private String getPathFromFile(@NonNull final Uri uri) {
                      logger.info("Parsing path:" + Arrays.toString(uri.getPathSegments().toArray()));
                      validatePathIsAccessible(uri);
              
              
              Severity: Minor
              Found in app/src/main/java/puscas/mobilertapp/MainActivity.java - About 1 hr to fix

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

                    @NonNull
                    private Config createConfigFromUI(@NonNull final String scenePath) {
                        final Pair<Integer, Integer> resolution =
                            Utils.getResolutionFromPicker(this.pickerResolutions);
                
                
                Severity: Minor
                Found in app/src/main/java/puscas/mobilertapp/MainActivity.java - About 1 hr to fix

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

                      private void readFile(@NonNull final Uri uri) {
                          logger.info("readFile");
                          final List<String> allowedPaths = List.of(UtilsContext.getSdCardPath(this), UtilsContext.getInternalStoragePath(this));
                          final boolean isAllowedPath;
                          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                  Severity: Minor
                  Found in app/src/main/java/puscas/mobilertapp/MainActivity.java - About 1 hr to fix

                    Method setUpAll has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @BeforeClass
                        @CallSuper
                        public static void setUpAll() {
                            final String methodName = Thread.currentThread().getStackTrace()[2].getMethodName();
                            logger.info(methodName);
                    Severity: Minor
                    Found in app/src/androidTest/java/puscas/mobilertapp/AbstractTest.java - About 1 hr to fix

                      Method getSdCardPath has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          @NonNull
                          public static String getSdCardPath(@NonNull final Context context) {
                              logger.info("Getting SD card path.");
                      
                              // The new method to get the SD card path.
                      Severity: Minor
                      Found in app/src/main/java/puscas/mobilertapp/utils/UtilsContext.java - About 1 hr to fix

                        Method computeTestMethods has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            @Override
                            protected List<FrameworkMethod> computeTestMethods() {
                                logger.info("Sorting tests execution order.");
                                final List<FrameworkMethod> originalTestsOrder = super.computeTestMethods();
                                final List<FrameworkMethod> orderedTests = new ArrayList<>(originalTestsOrder);
                        Severity: Minor
                        Found in app/src/androidTest/java/puscas/mobilertapp/OrderRunner.java - About 1 hr to fix

                          Method grantPermissions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private static void grantPermissions() {
                                  InstrumentationRegistry.getInstrumentation().waitForIdleSync();
                                  Espresso.onIdle();
                                  logger.info("Granting permissions to the MainActivity to be able to read files from an external storage.");
                                  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
                          Severity: Minor
                          Found in app/src/androidTest/java/puscas/mobilertapp/AbstractTest.java - About 1 hr to fix

                            Method createAndGetIndexOfShader has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private int createAndGetIndexOfShader(final String shaderCode, final int shaderType)
                                    throws InterruptedException {
                            
                                    final DrawView drawView = UtilsT.getPrivateField(activity, "drawView");
                                    Preconditions.checkNotNull(drawView, "drawView shouldn't be null");
                            Severity: Minor
                            Found in app/src/androidTest/java/puscas/mobilertapp/MainRendererTest.java - About 1 hr to fix

                              Method isPathReadable has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private static boolean isPathReadable(final File file) {
                                      final boolean readable = file.setReadable(true);
                                      if (!file.canRead() && !readable) {
                                          final File parentFile = file.getParentFile();
                                          if (parentFile == null) {
                              Severity: Minor
                              Found in app/src/main/java/puscas/mobilertapp/utils/UtilsContext.java - About 1 hr to fix

                                Method onDrawFrame has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    @Override
                                    public void onDrawFrame(@NonNull final GL10 gl) {
                                        logger.info("onDrawFrame");
                                
                                        // Reset OpenGL frame buffer before drawing the new frame.
                                Severity: Minor
                                Found in app/src/main/java/puscas/mobilertapp/MainRenderer.java - About 1 hr to fix

                                  Method assertRenderScene has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      protected void assertRenderScene(final Scene scene,
                                                                       final Shader shader,
                                                                       final Accelerator accelerator,
                                                                       final int spp,
                                                                       final int spl,
                                  Severity: Major
                                  Found in app/src/androidTest/java/puscas/mobilertapp/AbstractTest.java - About 50 mins to fix

                                    Method cleanStoragePath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        @NonNull
                                        public static String cleanStoragePath(@NonNull final String storagePath) {
                                            String storagePathCleaned = storagePath;
                                    
                                            // Remove Android path
                                    Severity: Minor
                                    Found in app/src/main/java/puscas/mobilertapp/utils/UtilsContext.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

                                    Method isActivityRunning has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        @SuppressWarnings({"deprecation"})
                                        private static boolean isActivityRunning(@NonNull final Activity activity) {
                                            // Note that 'Activity#isDestroyed' only exists on Android API 17+.
                                            // More info: https://developer.android.com/reference/android/app/Activity#isDestroyed()
                                            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                                    Severity: Minor
                                    Found in app/src/androidTest/java/puscas/mobilertapp/AbstractTest.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