sgammon/canteen

View on GitHub

Showing 200 of 1,384 total issues

Avoid deeply nested control flow statements.
Open

            if index in _metadata and (path, value) in _metadata[index]:
              _metadata[index][(path, value)].remove(target)

              # if there's no keys left in the index, trim it
              if len(_metadata[index][(path, value)]) == 0:
Severity: Major
Found in canteen/model/adapter/inmemory.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if index in _metadata and path in _metadata[index]:
              _metadata[index][path].remove(target)

              # if there's no keys left in the entry, trim it
              if len(_metadata[index][path]) == 0:
Severity: Major
Found in canteen/model/adapter/inmemory.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

              if isinstance(value, messages.Message):
                _packed[field.name] = _walk_struct(value)
              else:
                _packed[field.name] = value
          return _packed
Severity: Major
Found in canteen/rpc/protocol/msgpack.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            with open(source_name, 'rb') as staticread:
              staticwrite.write(staticread.read())

Severity: Major
Found in canteen/logic/template.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if subquery.sub_operator is query.OR:
              _or_filters.append(subquery)

        # double-filters
        if len(_filters[prop]) == 2:
Severity: Major
Found in canteen/model/adapter/redis.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            for target in entity.target:

              if isinstance(target, Key) and not (
                  isinstance(target, VertexKey)):  # pragma: no cover
                # @TODO(sgammon): unambiguous graph keys
Severity: Major
Found in canteen/model/adapter/abstract.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            for target in entity['peers']:
              if origin == target: continue
              _graph['neighbors']['undirected'][origin].add(target)
              _graph['edges']['undirected'][origin].add(entity.key)
              _graph['edges']['undirected'][target].add(entity.key)
Severity: Major
Found in canteen/model/adapter/inmemory.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if _f.tails is None:  # undirected query
              _target_edge_index = (
                _graph[_graph_base]['undirected'].get(_filter_val, set()))

            else:  # directed queries
Severity: Major
Found in canteen/model/adapter/inmemory.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if isinstance(_val, model.Key):  # pragma: no cover
              raise RuntimeError('Cannot reference embedded submodel'
                                 ' by key "%s".' % repr(_val))
            _bundle.append(_val.to_dict() if convert_models else _val)
Severity: Major
Found in canteen/model/adapter/core.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if low_bound and not high_bound:
              evaluate = lambda bundle: (low_bound < bundle[0])

            elif low_bound and high_bound:
              evaluate = lambda bundle: (low_bound < bundle[0] < high_bound)
Severity: Major
Found in canteen/model/adapter/inmemory.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if _fblock.operator in frozenset((query.EQUALS,
                                              query.CONTAINS,
                                              query.KEY_KIND,
                                              query.KEY_ANCESTOR)):

Severity: Major
Found in canteen/model/adapter/inmemory.py - About 45 mins to fix

Function compile_dir has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def compile_dir(self, source, destination,
Severity: Minor
Found in canteen/logic/template.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if _index_key in _metadata[cls._index_prefix]:
              _unsorted_indexes.append((
                False, (_f, _metadata[cls._index_prefix][_index_key])))

Severity: Major
Found in canteen/model/adapter/inmemory.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if config_item in config.config['TemplateAPI']['haml']:
              setattr(*(
                environment,
                target_attr,
                config.config['TemplateAPI']['haml'][config_item]))
Severity: Major
Found in canteen/logic/template.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

              if isinstance(bundle[-1], dict):
                positional, _config = bundle[0:-1], bundle[-1]
                _arguments.append((_add_argument, positional, _config))

        # is it a subtool?
Severity: Major
Found in canteen/util/cli.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if (isinstance(_path, dict) and 'source' in _path or (
                  isinstance(_path, basestring))):
              choices.append(FileLoader(_path['source'] if (
                             isinstance(_path, dict)) else _path))

Severity: Major
Found in canteen/logic/template.py - About 45 mins to fix

Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def __init__(self, environ=None,
Severity: Minor
Found in canteen/base/handler.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if (query.LESS_THAN in _operators) or (
                  query.LESS_THAN_EQUAL_TO in _operators):

              # range value query over sorted index
              greater, lesser = max(_values), min(_values)
Severity: Major
Found in canteen/model/adapter/redis.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if isinstance(_val, model.Model) and not (
                  _val.key):  # pragma: no cover
              raise RuntimeError('Cannot reference non-embedded submodel'
                                 ' "%s" with empty key.' % repr(_val))

Severity: Major
Found in canteen/model/adapter/core.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            for o, source in enumerate(entity.peers):

              if isinstance(source, Key) and not (
                  isinstance(source, VertexKey)):  # pragma: no cover
                # @TODO(sgammon): unambiguous graph keys
Severity: Major
Found in canteen/model/adapter/abstract.py - About 45 mins to fix
Severity
Category
Status
Source
Language