coding-blocks/DigitalOceanApp

View on GitHub

Showing 29 of 1,612 total issues

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

    @Override
    public void onCheckedChanged(CompoundButton buttonView, final boolean isChecked) {
        switch (buttonView.getId()) {
            case R.id.switch_ipv6:
                if (isChecked) {

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

    public void selectImage(int position, ViewHolder holder) {
        int selectorImage = 0;
        switch (imageList.get(position).getDistribution()) {
            case "CoreOS":
                selectorImage = R.drawable.coreos_selected;

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

        private void addFragment(int count) {
            FragmentManager fragmentManager = getSupportFragmentManager();
            android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            switch (count) {
    
    

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

                  @Field("name") String name,
                  @Field("region") String region,
                  @Field("size") String size,
                  @Field("image") String image,
                  @Field("backups") Boolean backups,

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

                    public boolean matchesSafely(View view) {
        
                        this.resources = view.getResources();
        
                        if (childView == null) {

        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

                return super.onOptionsItemSelected(item);

          Avoid too many return statements within this method.
          Open

                      return true;

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

                @SuppressWarnings("StatementWithEmptyBody")
                @Override
                public boolean onNavigationItemSelected(MenuItem item) {
                    // Handle navigation view item clicks here.
                    int id = item.getItemId();

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

                @Override
                public boolean onOptionsItemSelected(MenuItem item) {
                    int id = item.getItemId();
                    if (id == R.id.delete_droplet) {
            
            

            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