YuntechNet/AtomicP2P

View on GitHub

Showing 177 of 209 total issues

Function select_handler has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def select_handler(self, pkt_type: str) -> Union[None, "Handler"]:
        """select a handler with given packet handler type.
        If current class's pkt_handlers is not match, will iterate each va-
        riable which inherits HandleableMixin class. Also it will prevent 
        circular interact in case a instance that passing parent instance.
Severity: Minor
Found in atomic_p2p/mixin/handleable.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 remove has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    remove: function( elem, types, handler, selector, mappedTypes ) {

        var j, origCount, tmp,
            events, t, handleObj,
            special, handlers, type, namespaces, origType,
Severity: Major
Found in docs/_static/jquery-3.2.1.js - About 2 hrs to fix

    Function performObjectSearch has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      performObjectSearch : function(object, otherterms) {
        var filenames = this._index.filenames;
        var docnames = this._index.docnames;
        var objects = this._index.objects;
        var objnames = this._index.objnames;
    Severity: Major
    Found in docs/_static/searchtools.js - About 2 hrs to fix

      Function buildFragment has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function buildFragment( elems, context, scripts, selection, ignored ) {
          var elem, tmp, tag, wrap, contains, j,
              fragment = context.createDocumentFragment(),
              nodes = [],
              i = 0,
      Severity: Major
      Found in docs/_static/jquery-3.2.1.js - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                        if ( ( mappedTypes || origType === handleObj.origType ) &&
                            ( !handler || handler.guid === handleObj.guid ) &&
                            ( !tmp || tmp.test( handleObj.namespace ) ) &&
                            ( !selector || selector === handleObj.selector ||
                                selector === "**" && handleObj.selector ) ) {
        Severity: Critical
        Found in docs/_static/jquery-3.2.1.js - About 2 hrs to fix

          Function highlightText has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          jQuery.fn.highlightText = function(text, className) {
            function highlight(node, addItems) {
              if (node.nodeType === 3) {
                var val = node.nodeValue;
                var pos = val.toLowerCase().indexOf(text);
          Severity: Minor
          Found in docs/_static/doctools.js - About 1 hr to fix

            Function sync_from_DNS has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def sync_from_DNS(
                    self, current_host: Tuple[str, int], domain: str
                ) -> List["PeerInfo"]:
                    """Query from DNS fetch all records and put in pool
                    Hard-code with global.[domain] will send to DNS for query. Durring pro-
            Severity: Minor
            Found in atomic_p2p/utils/dns_resolver.py - About 1 hr 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 matcherFromTokens has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function matcherFromTokens( tokens ) {
                var checkContext, matcher, j,
                    len = tokens.length,
                    leadingRelative = Expr.relative[ tokens[0].type ],
                    implicitRelative = leadingRelative || Expr.relative[" "],
            Severity: Minor
            Found in docs/_static/jquery-3.2.1.js - About 1 hr to fix

              Function select has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              select = Sizzle.select = function( selector, context, results, seed ) {
                  var i, tokens, token, type, find,
                      compiled = typeof selector === "function" && selector,
                      match = !seed && tokenize( (selector = compiled.selector || selector) );
              
              
              Severity: Minor
              Found in docs/_static/jquery-3.2.1.js - About 1 hr to fix

                Function tokenize has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
                    var matched, match, tokens, type,
                        soFar, groups, preFilters,
                        cached = tokenCache[ selector + " " ];
                
                
                Severity: Minor
                Found in docs/_static/jquery-3.2.1.js - About 1 hr to fix

                  Function addCombinator has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function addCombinator( matcher, combinator, base ) {
                      var dir = combinator.dir,
                          skip = combinator.next,
                          key = skip || dir,
                          checkNonElements = base && key === "parentNode",
                  Severity: Minor
                  Found in docs/_static/jquery-3.2.1.js - About 1 hr to fix

                    Function val has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        val: function( value ) {
                            var hooks, ret, isFunction,
                                elem = this[ 0 ];
                    
                            if ( !arguments.length ) {
                    Severity: Minor
                    Found in docs/_static/jquery-3.2.1.js - About 1 hr to fix

                      Function data has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          data: function( key, value ) {
                              var i, name, data,
                                  elem = this[ 0 ],
                                  attrs = elem && elem.attributes;
                      
                      
                      Severity: Minor
                      Found in docs/_static/jquery-3.2.1.js - About 1 hr to fix

                        Function getLogger has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def getLogger(name=None, level=DEBUG, add_monitor_pass=None):
                            if name is None:
                                logger = get_logger()
                            else:
                                logger = get_logger(name)
                        Severity: Minor
                        Found in atomic_p2p/logging/__init__.py - About 1 hr 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

                        Consider simplifying this complex logical expression.
                        Open

                        if (!jQuery.browser) {
                          jQuery.uaMatch = function(ua) {
                            ua = ua.toLowerCase();
                        
                            var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
                        Severity: Critical
                        Found in docs/_static/doctools.js - About 1 hr to fix

                          Function stop has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              stop: function( type, clearQueue, gotoEnd ) {
                                  var stopQueue = function( hooks ) {
                                      var stop = hooks.stop;
                                      delete hooks.stop;
                                      stop( gotoEnd );
                          Severity: Minor
                          Found in docs/_static/jquery-3.2.1.js - About 1 hr to fix

                            Function extend has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            jQuery.extend = jQuery.fn.extend = function() {
                                var options, name, src, copy, copyIsArray, clone,
                                    target = arguments[ 0 ] || {},
                                    i = 1,
                                    length = arguments.length,
                            Severity: Minor
                            Found in docs/_static/jquery-3.2.1.js - About 1 hr to fix

                              Function style has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  style: function( elem, name, value, extra ) {
                              
                                      // Don't set styles on text and comment nodes
                                      if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
                                          return;
                              Severity: Minor
                              Found in docs/_static/jquery-3.2.1.js - About 1 hr to fix

                                Function access has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
                                    var i = 0,
                                        len = elems.length,
                                        bulk = key == null;
                                
                                
                                Severity: Minor
                                Found in docs/_static/jquery-3.2.1.js - About 1 hr to fix

                                  Function on has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function on( elem, types, selector, data, fn, one ) {
                                      var origFn, type;
                                  
                                      // Types can be a map of types/handlers
                                      if ( typeof types === "object" ) {
                                  Severity: Minor
                                  Found in docs/_static/jquery-3.2.1.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language