patrickfav/under-the-hood

View on GitHub

Showing 71 of 108 total issues

Method setContent has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        @Override
        public void setContent(final Map.Entry<CharSequence, KeyValueEntry.Value<String>> entry, @NonNull final View view) {
            ((TextView) view.findViewById(R.id.key)).setText(entry.getKey());
            TextView tvValue = view.findViewById(R.id.value);

    Method createSectionAppVersionInfoFromBuildConfig has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static Section.HeaderSection createSectionAppVersionInfoFromBuildConfig(Class<?> buildConfig) {
            Section.ModifiableHeaderSection section = Hood.ext().createSection("App Version");
            Field[] declaredFields = buildConfig.getDeclaredFields();
            for (Field field : declaredFields) {
                if (Modifier.isStatic(field.getModifiers())) {

      Method createPages has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public Pages createPages() {
              Pages pages = Hood.get().createPages(Config.newBuilder().setShowHighlightContent(false).build());
              Page firstPage = pages.addNewPage("Debug Info");
              firstPage.add(DefaultProperties.createSectionAppVersionInfoFromBuildConfig(at.favre.lib.hood.BuildConfig.class));
              firstPage.add(DefaultProperties.createSectionBasicDeviceInfo());
      Severity: Minor
      Found in app/src/main/java/at/favre/app/hood/demo/DebugDrawerActivity.java - About 1 hr to fix

        Method onTouch has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (onClickListener == null) {
                    return false;
                }

          Method registerShakeToOpenDebugActivity has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                  @Override
                  public ManagerControl registerShakeToOpenDebugActivity(final Context ctx, final Intent intent) {
                      final SensorManager sensorManager = (SensorManager) ctx.getSystemService(Context.SENSOR_SERVICE);
                      return new ManagerControl() {
                          private boolean isSupported = true;
          Severity: Minor
          Found in hood-core/src/release/java/at/favre/lib/hood/HoodFactory.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 registerShakeToOpenDebugActivity has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  @Override
                  public ManagerControl registerShakeToOpenDebugActivity(final Context ctx, final Intent intent) {
                      final SensorManager sensorManager = (SensorManager) ctx.getSystemService(Context.SENSOR_SERVICE);
                      return new ManagerControl() {
                          private boolean isSupported = true;
          Severity: Minor
          Found in hood-core/src/release/java/at/favre/lib/hood/HoodFactory.java - About 1 hr to fix

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

                @NonNull
                @Override
                public Pages getPageData(@NonNull Pages pages) {
                    final Random random = new Random();
            
            

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

                @Override
                protected void onCreate(@Nullable Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    if (Hood.isLibEnabled()) {
                        if (getIntent().getBooleanExtra(KEY_HEADLESS, false)) {

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

                  @Override
                  protected void onCreate(@Nullable Bundle savedInstanceState) {
                      super.onCreate(savedInstanceState);
                      final ActivityMoreBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_more);
              
              
              Severity: Minor
              Found in app/src/main/java/at/favre/app/hood/demo/MoreActivity.java - About 1 hr to fix

                Method onTouch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    public boolean onTouch(View v, MotionEvent event) {
                        if (onClickListener == null) {
                            return false;
                        }

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

                    public static List<PageEntry<?>> createStaticFieldsInfo(Class<?> clazz) {
                        List<PageEntry<?>> entries = new ArrayList<>();
                
                        Field[] declaredFields = clazz.getDeclaredFields();
                        for (Field field : declaredFields) {

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

                    @NonNull
                    @Override
                    public Pages getPageData(@NonNull Pages pages) {
                        final Random random = new Random(getIntent().getLongExtra(KEY_SEED, 0));
                
                

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

                    @Override
                    protected void onCreate(@Nullable Bundle savedInstanceState) {
                        super.onCreate(savedInstanceState);
                        if (Hood.isLibEnabled()) {
                            if (getIntent().getBooleanExtra(KEY_HEADLESS, false)) {

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

                    @NonNull
                    @Override
                    public Pages getPageData(@NonNull Pages pages) {
                        Page firstPage = pages.addNewPage();
                
                

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

                      @Test
                      public void multiTabsActivityTest() {
                          ViewInteraction appCompatButton = onView(
                                  allOf(withId(R.id.btn_start_dark_multi_page), withText("Start Multi Page")));
                          appCompatButton.perform(scrollTo(), click());

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

                        public static ConnectionState getNetworkConnectivityState(@NonNull Context context) {
                            if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_NETWORK_STATE) == PackageManager.PERMISSION_GRANTED) {
                                ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
                                NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
                    
                    

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

                          public static String millisToDaysHoursMinString(long millis) {
                              if (millis < 0) {
                                  throw new IllegalArgumentException("Duration must be greater than zero!");
                              }
                      
                      
                      Severity: Minor
                      Found in hood-core/src/main/java/at/favre/lib/hood/util/HoodUtil.java - About 1 hr to fix

                        Method equals has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @Override
                            public boolean equals(Object o) {
                                if (this == o) return true;
                                if (o == null || getClass() != o.getClass()) return false;
                        
                        

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

                            @Override
                            public boolean equals(Object o) {
                                if (this == o) return true;
                                if (o == null || getClass() != o.getClass()) return false;
                        
                        
                        Severity: Minor
                        Found in hood-core/src/release/java/at/favre/lib/hood/internal/DebugPages.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 equals has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @Override
                            public boolean equals(Object o) {
                                if (this == o) return true;
                                if (o == null || getClass() != o.getClass()) return false;
                        
                        
                        Severity: Minor
                        Found in hood-core/src/release/java/at/favre/lib/hood/internal/DebugPage.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

                        Severity
                        Category
                        Status
                        Source
                        Language