CIMAC-CIDC/cidc-schemas

View on GitHub

Showing 59 of 59 total issues

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

    def merge(self, walk, base, head, schema, meta, **kwargs):
Severity: Minor
Found in cidc_schemas/prism/merger.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if cell.value == "" or not cell.value:
                                continue
    
                            # get the identifier
                            # check that it is a CIMAC PART ID
    Severity: Major
    Found in cidc_schemas/prism/extra_metadata.py - About 45 mins to fix

      Function validate_instance has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
      Open

      def validate_instance(instance: str, schema: dict, is_required=False) -> Optional[str]:
          """
          Validate a data instance against a JSON schema.
      
          Returns None if `instance` is valid, otherwise returns reason for invalidity.
      Severity: Minor
      Found in cidc_schemas/json_validation.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

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

          def process_field_value(
      Severity: Minor
      Found in cidc_schemas/template.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if cimac_partid_regex.match(str(cell.value)):
                                    ids.add(cell.value)
        
        
        Severity: Major
        Found in cidc_schemas/prism/extra_metadata.py - About 45 mins to fix

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

              def merge(self, walk, base, head, schema, meta, **kwargs):
          Severity: Minor
          Found in cidc_schemas/prism/merger.py - About 45 mins to fix

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

            def write_wes_analysis_template(
            Severity: Minor
            Found in cidc_schemas/utils/template_generator.py - About 35 mins to fix

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

              def _set_val(
              Severity: Minor
              Found in cidc_schemas/prism/core.py - About 35 mins to fix

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

                def nested_set(
                Severity: Minor
                Found in docs/utils.py - About 35 mins to fix

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

                  def write_wes_analysis_batch(
                  Severity: Minor
                  Found in cidc_schemas/utils/template_generator.py - About 35 mins to fix

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

                        def _write_legend_item(cls, ws, row_n, name, theme, prop_schema):
                    Severity: Minor
                    Found in cidc_schemas/template_writer.py - About 35 mins to fix

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

                      def _make_file(
                      Severity: Minor
                      Found in docs/generate_docs.py - About 35 mins to fix

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

                            def _make_validation_error(
                        Severity: Minor
                        Found in cidc_schemas/template_reader.py - About 35 mins to fix

                          Function parse_elisa has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
                          Open

                          def parse_elisa(xlsx: BinaryIO) -> dict:
                              """
                              Parses the given ELISA grand serology results file to extract a list of sample IDs.
                              If the file is not valid NPX but still xlsx the function will
                              return a dict containing an empty list. Sample IDs not conforming to the CIMAC ID
                          Severity: Minor
                          Found in cidc_schemas/prism/extra_metadata.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

                          Function _olink_derivation has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
                          Open

                          def _olink_derivation(context: DeriveFilesContext) -> DeriveFilesResult:
                              """Generate a single analysis-ready NPX file across the entire trial for only samples/analytes"""
                              olink = context.trial_metadata.get("assays", {}).get("olink", {})
                          
                              def download_and_parse_npx(npx_url: str) -> Optional[pd.DataFrame]:
                          Severity: Minor
                          Found in cidc_schemas/unprism.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

                          Avoid too many return statements within this function.
                          Open

                                  return None
                          Severity: Major
                          Found in cidc_schemas/template_writer.py - About 30 mins to fix

                            Function _write_worksheet has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
                            Open

                                def _write_worksheet(self, name, schema, workbook, write_title=False):
                                    """Write content to the given worksheet"""
                                    assert self.workbook, "_write_worksheet called without an initialized workbook"
                                    assert self.template, "_write_worksheet called without an initialized template"
                            
                            Severity: Minor
                            Found in cidc_schemas/template_writer.py - About 25 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

                            Function __jpointer_insert_next_thing has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
                            Open

                            def __jpointer_insert_next_thing(doc, jpoint, part, next_thing):
                                """
                                Puts next_thing into a doc (that is being `jsonpointer.walk`ed)
                                by *part* "address". *jpoint* is Jsonpointer that is walked.
                                """
                            Severity: Minor
                            Found in cidc_schemas/prism/core.py - About 25 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

                            Function generate_docs has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
                            Open

                            def generate_docs(out_directory: str = HTML_DIR):
                                """
                                Generate documentation based on the schemas found in `SCHEMA_DIR`.
                                """
                            
                            
                            Severity: Minor
                            Found in docs/generate_docs.py - About 25 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