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
Function test_run_rogers
has a Cognitive Complexity of 128 (exceeds 5 allowed). Consider refactoring. Open
def test_run_rogers(self):
"""
SIMULATE ROGERS
"""
- Read upRead up
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,
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."""
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),
- Read upRead up
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
File tests.py
has 388 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Test Rogers demo."""
from __future__ import print_function
import sys
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."""
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'):
- Read upRead up
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).
- Read upRead up
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
TestModels
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class TestModels(object):
def setup(self):
self.db = db.init_db(drop_all=True)
Function test_models
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_models(self):
"""####################
#### Test Network ####
####################"""
Function test_run_rogers
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_run_rogers(self):
"""
SIMULATE ROGERS
"""
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".
- Read upRead up
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.
- Read upRead up
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)
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.
- Read upRead up
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
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
- Read upRead up
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"