jumaallan/AndelaCryptoApp

View on GitHub

Showing 36 of 56 total issues

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

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

        int desiredHeight = getDesiredHeight();
        int height;

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

        @Nullable
        @Override
        public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
            View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_actions, container, false);
            Country country = getArguments().getParcelable(COUNTRY);

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

          @Override
          public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
              if (isAttachedToWindow) {
                  float fraction = positionOffset;
                  int currentPosition = pageChanging ? previousPage : currentPage;

      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 setDrawable has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private static void setDrawable(TextView textView, Object editor, Field field, @ColorInt int color,
                                          @DrawableRes int drawableRes) throws IllegalAccessException {
      Severity: Minor
      Found in app/src/main/java/com/androidstudy/andelatrackchallenge/utils/Easel.java - About 35 mins to fix

        Method getUnselectedPath has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private Path getUnselectedPath(int page,
                                           float centerX,
                                           float nextCenterX,
                                           float joiningFraction,
                                           float dotRevealFraction) {

          Method draw has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public void draw(@NonNull Canvas canvas) {
                  super.draw(canvas);
          
                  int width = getWidth();

          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

          Avoid too many return statements within this method.
          Open

                  if (country.ethStatus != ethStatus) return false;

            Avoid too many return statements within this method.
            Open

                    return code.equals(country.code);

              Avoid too many return statements within this method.
              Open

                      if (country.btcStatus != btcStatus) return false;

                Avoid too many return statements within this method.
                Open

                        if (refreshedAt != country.refreshedAt) return false;

                  Avoid too many return statements within this method.
                  Open

                          if (Float.compare(country.eth, eth) != 0) return false;

                    Avoid too many return statements within this method.
                    Open

                            if (!name.equals(country.name)) return false;

                      Avoid too many return statements within this method.
                      Open

                              if (!country.isFavorite == isFavorite) return false;

                        Avoid too many return statements within this method.
                        Open

                                if (!currency.equals(country.currency)) return false;

                          Method updateTaskDescription has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private void updateTaskDescription(int position) {
                                  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                                      String title = getTitle().toString();
                                      Drawable iconDrawable = getApplicationInfo().loadIcon(getPackageManager());
                                      Bitmap icon = iconDrawable instanceof BitmapDrawable

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

                              @TargetApi(21)
                              public static boolean tintEdgeEffect(@NonNull View scrollableView, @ColorInt int color) {
                                  //http://stackoverflow.com/questions/27104521/android-lollipop-scrollview-edge-effect-color
                                  boolean outcome = false;
                                  final String[] edgeGlows = {"mEdgeGlowTop", "mEdgeGlowBottom", "mEdgeGlowLeft", "mEdgeGlowRight"};
                          Severity: Minor
                          Found in app/src/main/java/com/androidstudy/andelatrackchallenge/utils/Easel.java - About 25 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