Showing 160 of 174 total issues

Function postLoad has a Cognitive Complexity of 21 (exceeds 7 allowed). Consider refactoring.
Open

  public static function postLoad(EntityStorageInterface $storage, array &$entities) {
    parent::postLoad($storage, $entities);

    // Build the storage operations that will be done and entity references
    $storageOps = [];
Severity: Minor
Found in tripal/src/TripalStorage/TripalEntityBase.php - 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 parseGFF3 has a Cognitive Complexity of 21 (exceeds 7 allowed). Consider refactoring.
Open

  private function parseGFF3() {
    $filesize = filesize($this->gff_file);
    $this->setTotalItems($filesize);

    // Holds a unique list of cvterms for later lookup.
Severity: Minor
Found in tripal_chado/src/Plugin/TripalImporter/GFF3Importer.php - 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 tripal_launch_job has a Cognitive Complexity of 21 (exceeds 7 allowed). Consider refactoring.
Open

function tripal_launch_job($do_parallel = 0, $job_id = NULL, $max_jobs = -1, $single = 0) {

  $messenger = \Drupal::messenger();

  // First check if any jobs are currently running if they are, don't continue,
Severity: Minor
Found in tripal/src/api/tripal.jobs.api.php - 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 buildForm has a Cognitive Complexity of 21 (exceeds 7 allowed). Consider refactoring.
Open

  public function buildForm(array $form, FormStateInterface $form_state, $mview_id = null) {

    $chado = \Drupal::service('tripal_chado.database');

    if (!$mview_id) {
Severity: Minor
Found in tripal_chado/src/Form/ChadoMviewForm.php - 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 oboEbiLookup has a Cognitive Complexity of 21 (exceeds 7 allowed). Consider refactoring.
Open

  private function oboEbiLookup($accession, $type_of_search, $found_iri = NULL, $found_ontology = NULL) {
    // Grab just the ontology from the $accession.
    $parts = explode(':', $accession);
    $ontology = strtolower($parts[0]);
    $ontology = preg_replace('/\s+/', '', $ontology);
Severity: Minor
Found in tripal_chado/src/Plugin/TripalImporter/OBOImporter.php - 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 insertFeatureParents has a Cognitive Complexity of 20 (exceeds 7 allowed). Consider refactoring.
Open

  private function insertFeatureParents(){
    $chado = $this->getChadoConnection();
    $batch_size = 100;
    $num_parents = count(array_keys($this->parent_lookup));
    $num_batches = (int) ($num_parents / $batch_size) + 1;
Severity: Minor
Found in tripal_chado/src/Plugin/TripalImporter/GFF3Importer.php - 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

Consider simplifying this complex logical expression.
Open

        if ($tablename == 'cvterm_dbxref' || $tablename == 'cvterm_relationship' ||
          $tablename == 'cvtermpath' || $tablename == 'cvtermprop' || $tablename == 'chadoprop' ||
          $tablename == 'cvtermsynonym' || preg_match('/_relationship$/', $tablename) ||
          preg_match('/_cvterm$/', $tablename) ||
          // Ignore prop tables
Severity: Critical
Found in tripal_chado/src/Database/ChadoSchema.php - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

            if ($tablename == 'cvterm_dbxref' || $tablename == 'cvterm_relationship' ||
              $tablename == 'cvtermpath' || $tablename == 'cvtermprop' || $tablename == 'chadoprop' ||
              $tablename == 'cvtermsynonym' || preg_match('/_relationship$/', $tablename) ||
              preg_match('/_cvterm$/', $tablename) ||
              // Ignore prop tables
    Severity: Critical
    Found in tripal_chado/src/api/ChadoSchema.php - About 2 hrs to fix

      Function findMissingProteins has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
      Open

        private function findMissingProteins() {
          $this->setItemsHandled(0);
          $this->setTotalItems(count(array_keys($this->features)));
      
          // Don't do anything if the user wants to skip creation of non listed
      Severity: Minor
      Found in tripal_chado/src/Plugin/TripalImporter/GFF3Importer.php - 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 run has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
      Open

        public function run() {
          $chado = $this->getChadoConnection();
      
          $arguments = $this->arguments['run_args'];
          $this->gff_file = $this->arguments['files'][0]['file_path'];
      Severity: Minor
      Found in tripal_chado/src/Plugin/TripalImporter/GFF3Importer.php - 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 prepareFeature has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
      Open

        private function prepareFeature($gff_feature, &$feature_cvterms, &$featureprop_cvterms) {
      
          // Add the landmark if it doesn't exist in the landmark list.
          if (!array_key_exists($gff_feature['landmark'], $this->landmarks)) {
            $this->landmarks[$gff_feature['landmark']] = FALSE;
      Severity: Minor
      Found in tripal_chado/src/Plugin/TripalImporter/GFF3Importer.php - 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 getTerm has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
      Open

        public function getTerm($accession, $options = []) {
      
          if (!$this->is_valid) {
            return NULL;
          }
      Severity: Minor
      Found in tripal_chado/src/Plugin/TripalIdSpace/ChadoIdSpace.php - 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 getTableDef has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
      Open

        public function getTableDef(string $table, array $parameters) :array {
          static $table_structures = [];
      
          $source = $parameters['source'] ?? 'file';
          $format = strtolower($parameters['format'] ?? '');
      Severity: Minor
      Found in tripal/src/TripalDBX/TripalDbxSchema.php - 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 fieldSettingsForm has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
      Open

        public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
          $elements = [];
      
          $is_open = FALSE;
          $term = NULL;
      Severity: Minor
      Found in tripal/src/TripalField/TripalFieldItemBase.php - 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 validateParameters has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
      Open

        public function validateParameters() :void {
          try {
            // Select a default version if needed.
            if (empty($this->parameters['version'])) {
              $this->parameters['version'] = static::DEFAULT_CHADO_VERSION;
      Severity: Minor
      Found in tripal_chado/src/Task/ChadoUpgrader.php - 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 prepareUpgradeTypes has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
      Open

        protected function prepareUpgradeTypes() {
          $chado_schema = $this->outputSchemas[0];
          $ref_schema = $this->inputSchemas[0];
      
          // Get database types.
      Severity: Minor
      Found in tripal_chado/src/Task/ChadoUpgrader.php - 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 buildMainForm has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
      Open

        public function buildMainForm(array $form, FormStateInterface $form_state) {
      
          $tripal_dbx = \Drupal::service('tripal.dbx');
          $chado = new ChadoConnection();
      
      
      Severity: Minor
      Found in tripal_chado/src/Form/ChadoManagerForm.php - 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 validateForm has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
      Open

        public function validateForm(array &$form, FormStateInterface $form_state) {
          if ($form_state->isSubmitted()) {
            $mail_pi = $form_state->getValue('principal_investigator_email');
            $mail_sa = $form_state->getValue('tripal_reg_site_admin_email');
            if ($form_state->getValue('disable_tripal_reporting') != TRUE) {
      Severity: Minor
      Found in tripal/src/Form/Register.php - 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 prepareUpgradeSequences has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
      Open

        protected function prepareUpgradeSequences() {
          $chado_schema = $this->outputSchemas[0];
          $ref_schema = $this->inputSchemas[0];
      
          // Get sequences.
      Severity: Minor
      Found in tripal_chado/src/Task/ChadoUpgrader.php - 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 findVersion has a Cognitive Complexity of 18 (exceeds 7 allowed). Consider refactoring.
      Open

        public function findVersion(
          ?string $schema_name = NULL,
          bool $exact_version = FALSE
        ) :string {
          // By default, we don't know the version.
      Severity: Minor
      Found in tripal_chado/src/Database/ChadoConnection.php - 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

      Severity
      Category
      Status
      Source
      Language