HITGIF/TextFieldBoxes

View on GitHub

Showing 17 of 30 total issues

File TextFieldBoxes.java has 890 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package studio.carbonylgroup.textfieldboxes;

import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;

    TextFieldBoxes has 89 methods (exceeds 20 allowed). Consider refactoring.
    Open

    @SuppressWarnings("unused")
    public class TextFieldBoxes extends FrameLayout {
    
        /**
         * all the default colors to be used on light or dark themes.

      Method updateCounterText has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

          protected void updateCounterText(boolean performValidation) {
      
              /* Show clear button if there is anything */
              if (hasClearButton) {
                  if (this.editText.getText().toString().length() == 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 updateClearAndEndIconLayout has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          private void updateClearAndEndIconLayout() {
      
              if ((endIconImageButton != null && endIconImageButton.getDrawable() != null) || hasClearButton) {
      
                  int clearButtonW = hasClearButton ? clearButton.getMeasuredWidth() : 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 updateDimens has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected void updateDimens(boolean useDenseSpacing) {
      
              final Resources res = getContext().getResources();
      
              /* Floating Label */

        Method initOnClick has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void initOnClick() {
        
                final FrameLayout mainBody = this;
        
                this.panel.setOnClickListener(new OnClickListener() {

          Method updateCounterText has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected void updateCounterText(boolean performValidation) {
          
                  /* Show clear button if there is anything */
                  if (hasClearButton) {
                      if (this.editText.getText().toString().length() == 0) {

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

                @Override
                protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            
                    int widthMode = MeasureSpec.getMode(widthMeasureSpec);
                    int heightMode = MeasureSpec.getMode(heightMeasureSpec);

              Method initViews has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void initViews() {
              
                      this.editText = findEditTextChild();
                      if (editText == null) return;
                      this.addView(LayoutInflater.from(getContext()).inflate(rtl ?

                Method handleAttributes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected void handleAttributes(Context context, AttributeSet attrs) {
                
                        try {
                
                            TypedArray styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.TextFieldBoxes);

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

                      public void setEnabled(boolean enabled) {
                  
                          this.enabled = enabled;
                          if (this.enabled) {
                              this.editText.setEnabled(true);

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

                        private void updateClearAndEndIconLayout() {
                    
                            if ((endIconImageButton != null && endIconImageButton.getDrawable() != null) || hasClearButton) {
                    
                                int clearButtonW = hasClearButton ? clearButton.getMeasuredWidth() : 0;

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

                          protected void activate(boolean animated) {
                      
                              this.editText.setAlpha(1);
                      
                              if (this.editText.getText().toString().isEmpty() && !isActivated()) {

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

                            public void setEnabled(boolean enabled) {
                        
                                this.enabled = enabled;
                                if (this.enabled) {
                                    this.editText.setEnabled(true);

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

                            public void setHasFocus(boolean hasFocus) {
                        
                                this.hasFocus = hasFocus;
                                if (this.hasFocus) {
                                    activate(true);

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

                            protected void deactivate() {
                        
                                if (this.editText.getText().toString().isEmpty()) {
                        
                                    if (this.alwaysShowHint && !this.editText.getHint().toString().isEmpty()) {

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

                            protected void activate(boolean animated) {
                        
                                this.editText.setAlpha(1);
                        
                                if (this.editText.getText().toString().isEmpty() && !isActivated()) {

                        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