justaddcoffee/kg-emerging-viruses

View on GitHub

Showing 217 of 237 total issues

Avoid deeply nested control flow statements.
Open

                        if not item:
                            continue  # not xrefs, skip
                        item = item.strip('"')  # remove quotes around each item
Severity: Major
Found in kg_covid_19/transform_utils/pharmgkb/pharmgkb.py - About 45 mins to fix

    Function transform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def transform(
        input_dir: str, output_dir: str, sources: Optional[List[str]] = None
    ) -> None:
        """Call scripts in kg_covid_19/transform/[source name]/ to transform data.
    
    
    Severity: Minor
    Found in kg_covid_19/transform.py - About 45 mins 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

    Avoid deeply nested control flow statements.
    Open

                            if self.key_parsed_ids not in dat:
                                dat[self.key_parsed_ids] = dict()
                            dat[self.key_parsed_ids][key] = value
    Severity: Major
    Found in kg_covid_19/transform_utils/pharmgkb/pharmgkb.py - About 45 mins to fix

      Consider simplifying this complex logical expression.
      Open

                  if ( matcher[ expando ] ) {
      
                      // Find the next relative operator (if any) for proper handling
                      j = ++i;
                      for ( ; j < len; j++ ) {
      Severity: Major
      Found in docs/_static/jquery-3.5.1.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
                    context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
        
                    context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
                        .replace( runescape, funescape ), context ) || [] )[ 0 ];
        Severity: Major
        Found in docs/_static/jquery-3.5.1.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                      if ( support.qsa &&
                          !nonnativeSelectorCache[ selector + " " ] &&
                          ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
          
                          // Support: IE 8 only
          Severity: Major
          Found in docs/_static/jquery-3.5.1.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

            if ( !support.focusin ) {
                jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
            
                    // Attach a single capturing handler on the document while someone wants focusin/focusout
                    var handler = function( event ) {
            Severity: Major
            Found in docs/_static/jquery-3.5.1.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      if (terms[excluded[i]] == file ||
                          titleterms[excluded[i]] == file ||
                          $u.contains(terms[excluded[i]] || [], file) ||
                          $u.contains(titleterms[excluded[i]] || [], file)) {
                        valid = false;
              Severity: Major
              Found in docs/_static/searchtools.js - About 40 mins to fix

                Function condense has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function condense( unmatched, map, filter, context, xml ) {
                Severity: Minor
                Found in docs/_static/jquery-3.5.1.js - About 35 mins to fix

                  Function remove has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      remove: function( elem, types, handler, selector, mappedTypes ) {
                  Severity: Minor
                  Found in docs/_static/jquery-3.5.1.js - About 35 mins to fix

                    Function CHILD has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            "CHILD": function( type, what, _argument, first, last ) {
                    Severity: Minor
                    Found in docs/_static/jquery-3.5.1.js - About 35 mins to fix

                      Function add has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          add: function( elem, types, handler, data, selector ) {
                      Severity: Minor
                      Found in docs/_static/jquery-3.5.1.js - About 35 mins to fix

                        Function Tween has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function Tween( elem, options, prop, end, easing ) {
                        Severity: Minor
                        Found in docs/_static/jquery-3.5.1.js - About 35 mins to fix

                          Function superMatcher has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  superMatcher = function( seed, context, xml, results, outermost ) {
                          Severity: Minor
                          Found in docs/_static/jquery-3.5.1.js - About 35 mins to fix

                            Function buildFragment has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            function buildFragment( elems, context, scripts, selection, ignored ) {
                            Severity: Minor
                            Found in docs/_static/jquery-3.5.1.js - About 35 mins to fix

                              Function query has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              def query(
                              Severity: Minor
                              Found in run.py - About 35 mins to fix

                                Function make_pharmgkb_chemical_node has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def make_pharmgkb_chemical_node(
                                Severity: Minor
                                Found in kg_covid_19/transform_utils/pharmgkb/pharmgkb.py - About 35 mins to fix

                                  Function _generate_negative_edges has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  def _generate_negative_edges(
                                  Severity: Minor
                                  Found in kg_covid_19/make_holdouts.py - About 35 mins to fix

                                    Function parse_annotations has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        def parse_annotations(
                                    Severity: Minor
                                    Found in kg_covid_19/transform_utils/scibite_cord/scibite_cord.py - About 35 mins to fix

                                      Function load_country_code has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def load_country_code(self, input_dir: str, output_dir: str) -> None:
                                              """Load Wikidata country codes."""
                                              file_path = os.path.join(input_dir, "wikidata_country_codes.tsv")
                                              if os.path.exists(file_path):
                                                  with open(file_path, "r") as filehandler:
                                      Severity: Minor
                                      Found in kg_covid_19/transform_utils/scibite_cord/scibite_cord.py - About 35 mins 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