Showing 480 of 808 total issues
File handler.py
has 2967 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
DatabaseRdbms
has 192 functions (exceeds 20 allowed). Consider refactoring. Open
class DatabaseRdbms(object):
def __init__(self, env: GNEnvironment):
self.env = env
if self.env.config.get(ConfigKeys.TESTING, False):
DatabaseRdbms.db = MockDatabase()
File __init__.py
has 1432 lines of code (exceeds 250 allowed). Consider refactoring. Open
import ast
import logging
import os
import re
import sys
DatabaseRedis
has 183 functions (exceeds 20 allowed). Consider refactoring. Open
class DatabaseRedis(object):
redis = None
def __init__(self, env: GNEnvironment, host: str, port: int = 6379, db: int = 0):
if environ.env.config.get(ConfigKeys.TESTING, False) or host == 'mock':
IDatabase
has 164 functions (exceeds 20 allowed). Consider refactoring. Open
class IDatabase(Interface):
def init_config(self) -> None:
"""
initialize the config table
File __init__.py
has 1235 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
File redis.py
has 1164 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import logging
import traceback
import random
import sys
CacheRedis
has 143 functions (exceeds 20 allowed). Consider refactoring. Open
class CacheRedis(object):
def __init__(self, env, host: str, port: int = 6379, db: int = 0):
if env.config.get(ConfigKeys.TESTING, False) or host == 'mock':
from fakeredis import FakeStrictRedis
File redis.py
has 1093 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
File routes.py
has 1024 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import os
import sys
import traceback
from functools import wraps
ICache
has 129 functions (exceeds 20 allowed). Consider refactoring. Open
class ICache(Interface):
def get_user_for_sid(self, sid: str):
"""
get the user id for a sid
File environ.py
has 858 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
File __init__.py
has 823 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Set
from zope.interface import Interface
from typing import Union, Dict, List, Optional
Function handle_disconnect
has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring. Open
def handle_disconnect(arg: tuple, is_socket_disconnect: bool=False) -> None:
"""
when a client disconnects this hook will handle the related logic
:param arg: tuple of (data, parsed_activity)
- 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 do_process
has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring. Open
def do_process(arg: tuple) -> None:
def send(_data: dict, _room: str, _json: bool=True, _broadcast: bool=True) -> None:
environ.env.emit('message', _data, json=_json, room=_room, broadcast=_broadcast)
def publish_activity() -> None:
- 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 pre_process
has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring. Open
def pre_process(validation_name, should_validate_request=True):
def factory(view_func):
@wraps(view_func)
def decorator(*a, **k):
def _pre_process(*args, **kwargs):
- 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 on_message
has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring. Open
def on_message(self, activity: Activity) -> (bool, int, str):
room_id = activity.target.id
user_id = activity.actor.id
object_type = activity.target.object_type
message = activity.object.content
- 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 request.py
has 592 lines of code (exceeds 250 allowed). Consider refactoring. Open
import sys
from activitystreams.models.activity import Activity
from activitystreams.models.defobject import DefObject
from activitystreams.models.actor import Actor
from activitystreams.models.target import Target
File jstorage.js
has 579 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ----------------------------- JSTORAGE -------------------------------------
* Simple local storage wrapper to save data on the browser side, supporting
* all major browsers - IE6+, Firefox2+, Safari4+, Chrome4+ and Opera 10.5+
*
File acl.py
has 560 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at