berkeley-cocosci/Wallace

View on GitHub

Showing 89 of 222 total issues

File models.py has 1315 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Define Wallace's core models."""

from datetime import datetime

from .db import Base
Severity: Major
Found in wallace/models.py - About 3 days to fix

    Function test_run_rogers has a Cognitive Complexity of 128 (exceeds 5 allowed). Consider refactoring.
    Open

            def test_run_rogers(self):
    
                """
                SIMULATE ROGERS
                """
    Severity: Minor
    Found in examples/rogers/tests/tests.py - About 2 days 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

    File custom.py has 947 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Import custom routes into the experiment server."""
    
    from flask import (
        Blueprint,
        request,
    Severity: Major
    Found in wallace/custom.py - About 2 days to fix

      File command_line.py has 668 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/python
      # -*- coding: utf-8 -*-
      
      """The Wallace command-line utility."""
      
      
      Severity: Major
      Found in wallace/command_line.py - About 1 day to fix

        Function worker_function has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

        def worker_function(event_type, assignment_id, participant_id):
            """Process the notification."""
            db.logger.debug("rq: worker_function working on job id: %s",
                            get_current_job().id)
            db.logger.debug('rq: Received Queue Length: %d (%s)', len(q),
        Severity: Minor
        Found in wallace/custom.py - About 6 hrs 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

        File test_models.py has 432 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """Test the classes in models.py."""
        
        from __future__ import print_function
        import sys
        from datetime import datetime
        Severity: Minor
        Found in tests/test_models.py - About 6 hrs to fix

          File tests.py has 388 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """Test Rogers demo."""
          
          from __future__ import print_function
          
          import sys
          Severity: Minor
          Found in examples/rogers/tests/tests.py - About 5 hrs to fix

            Experiment has 31 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Experiment(object):
                """Define the structure of an experiment."""
            
                def __init__(self, session):
                    """Create the experiment class. Sets the default value of attributes."""
            Severity: Minor
            Found in wallace/experiments.py - About 3 hrs to fix

              Function check_db_for_missing_notifications has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              def check_db_for_missing_notifications():
                  """Check the database for missing notifications."""
                  aws_access_key_id = os.environ['aws_access_key_id']
                  aws_secret_access_key = os.environ['aws_secret_access_key']
                  if config.getboolean('Shell Parameters', 'launch_in_sandbox_mode'):
              Severity: Minor
              Found in wallace/heroku/clock.py - About 3 hrs 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

              Function transmit has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  def transmit(self, what=None, to_whom=None):
                      """Transmit one or more infos from one node to another.
              
                      "what" dictates which infos are sent, it can be:
                          (1) None (in which case the node's _what method is called).
              Severity: Minor
              Found in wallace/models.py - About 3 hrs 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

              File experiment.py has 301 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              """Replicate Rogers' paradox by simulating evolution with people."""
              
              from wallace.experiments import Experiment
              from wallace.information import Gene, Meme, State
              from wallace.nodes import Source, Agent, Environment
              Severity: Minor
              Found in examples/rogers/experiment.py - About 3 hrs to fix

                TestModels has 27 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class TestModels(object):
                
                    def setup(self):
                        self.db = db.init_db(drop_all=True)
                
                
                Severity: Minor
                Found in tests/test_models.py - About 3 hrs to fix

                  Function test_models has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def test_models(self):
                  
                          """####################
                          #### Test Network ####
                          ####################"""
                  Severity: Major
                  Found in tests/test_models.py - About 3 hrs to fix

                    Function test_run_rogers has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def test_run_rogers(self):
                    
                                """
                                SIMULATE ROGERS
                                """
                    Severity: Major
                    Found in examples/rogers/tests/tests.py - About 3 hrs to fix

                      Function is_connected has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def is_connected(self, whom, direction="to", failed=None):
                              """Check whether this node is connected [to/from] whom.
                      
                              whom can be a list of nodes or a single node.
                              direction can be "to" (default), "from", "both" or "either".
                      Severity: Minor
                      Found in wallace/models.py - About 2 hrs 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

                      Function verify_package has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def verify_package(verbose=True):
                          """Ensure the package has a config file and a valid experiment file."""
                          is_passing = True
                      
                          # Check the config file.
                      Severity: Minor
                      Found in wallace/command_line.py - About 2 hrs 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

                      TestNetworks has 24 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class TestNetworks(object):
                      
                          def setup(self):
                              self.db = db.init_db(drop_all=True)
                      
                      
                      Severity: Minor
                      Found in tests/test_networks.py - About 2 hrs to fix

                        Function node_transmit has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def node_transmit(node_id):
                            """Transmit to another node.
                        
                            The sender's node id must be specified in the url.
                        
                        
                        Severity: Minor
                        Found in wallace/custom.py - About 2 hrs 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

                        File test_networks.py has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        from wallace import networks, nodes, db, models
                        import random
                        from nose.tools import assert_raises, raises
                        
                        
                        
                        Severity: Minor
                        Found in tests/test_networks.py - About 2 hrs to fix

                          Function request_parameter has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def request_parameter(parameter, parameter_type=None, default=None,
                                                optional=False):
                              """Get a parameter from a request.
                          
                              parameter is the name of the parameter you are looking for
                          Severity: Minor
                          Found in wallace/custom.py - About 2 hrs 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