tripal/tripal

View on GitHub

Showing 124 of 124 total issues

Function chado_expand_var has a Cognitive Complexity of 171 (exceeds 25 allowed). Consider refactoring.
Open

function chado_expand_var($object, $type, $to_expand, $table_options = [], $schema_name = NULL) {

  // Set default schema.
  if (!$schema_name) {
    $schema_name = \Drupal::config('tripal_chado.settings')->get('default_schema');
Severity: Minor
Found in tripal_chado/src/api/tripal_chado.variables.api.php - About 3 days 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 chado_generate_var has a Cognitive Complexity of 121 (exceeds 25 allowed). Consider refactoring.
Open

function chado_generate_var($table, $values, $base_options = [], $schema_name = NULL) {
  // Set default schema.
  if (!$schema_name) {
    $schema_name = \Drupal::config('tripal_chado.settings')->get('default_schema');
  }
Severity: Minor
Found in tripal_chado/src/api/tripal_chado.variables.api.php - About 2 days 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 chado_select_record has a Cognitive Complexity of 118 (exceeds 25 allowed). Consider refactoring.
Open

function chado_select_record($table, $columns, $values, $options = NULL, $chado_schema_name = NULL) {
  // Set defaults for options. If we don't set defaults then
  // we get memory leaks when we try to access the elements.
  if (!is_array($options)) {
    $options = [];
Severity: Minor
Found in tripal_chado/src/api/tripal_chado.query.api.php - About 1 day 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 chado_phylogeny_import_tree has a Cognitive Complexity of 115 (exceeds 25 allowed). Consider refactoring.
Open

function chado_phylogeny_import_tree(&$tree, $phylotree, $options, $vocab = [], $parent = NULL, $schema_name = 'chado') {
  $chado = \Drupal::service('tripal_chado.database');
  $chado->setSchemaName($schema_name);

  // Used for final summary message at end of recursion.
Severity: Minor
Found in tripal_chado/src/api/tripal_chado.phylotree.api.php - About 1 day 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 parseGFF3Line has a Cognitive Complexity of 81 (exceeds 25 allowed). Consider refactoring.
Open

  private function parseGFF3Line($line) {

    // get the columns
    $cols = explode("\t", $line);
    if (sizeof($cols) != 9) {
Severity: Minor
Found in tripal_chado/src/Plugin/TripalImporter/GFF3Importer.php - About 1 day 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 chado_insert_record has a Cognitive Complexity of 79 (exceeds 25 allowed). Consider refactoring.
Open

function chado_insert_record($table, $values, $options = [], $chado_schema_name = NULL) {

  $print_errors = (isset($options['print_errors'])) ? $options['print_errors'] : FALSE;

  if (!is_array($values)) {
Severity: Minor
Found in tripal_chado/src/api/tripal_chado.query.api.php - About 1 day 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 loadFastaFeature has a Cognitive Complexity of 75 (exceeds 25 allowed). Consider refactoring.
Open

  private function loadFastaFeature($fh, $name, $uname, $db_id, $accession, $parent,
                                    $rel_type, $parent_type, $analysis_id, $organism_id, $cvterm, $source, $method, $re_name,
                                    $match_type, $parentcvterm, $relcvterm, $seq_start, $seq_end) {

    $chado = $this->getChadoConnection();
Severity: Minor
Found in tripal_chado/src/Plugin/TripalImporter/FASTAImporter.php - About 1 day 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 parseTableDdlToDrupal has a Cognitive Complexity of 67 (exceeds 25 allowed). Consider refactoring.
Open

  public function parseTableDdlToDrupal(string $table_ddl) :array {
    $tripaldbx = \Drupal::service('tripal.dbx');
    $table_structure = $tripaldbx->parseTableDdl($table_ddl);
    // Start with the name of the table.
    $table_def = [];
Severity: Minor
Found in tripal/src/TripalDBX/TripalDbx.php - About 7 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 chado_validate_phylotree has a Cognitive Complexity of 65 (exceeds 25 allowed). Consider refactoring.
Open

function chado_validate_phylotree($val_type, &$options, &$errors, &$warnings, $schema_name = 'chado') {
  $chado = \Drupal::service('tripal_chado.database');
  $chado->setSchemaName($schema_name);
  if ($val_type != 'insert' and $val_type != 'update') {
    \Drupal::service('tripal.logger')->error("The \$val_type argument to"
Severity: Minor
Found in tripal_chado/src/api/tripal_chado.phylotree.api.php - About 6 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 chado_insert_cvterm has a Cognitive Complexity of 64 (exceeds 25 allowed). Consider refactoring.
Open

function chado_insert_cvterm($term, $options = [], $schema_name = NULL) {
  // Set default schema.
  if (!$schema_name) {
    $schema_name = \Drupal::config('tripal_chado.settings')->get('default_schema');
  }
Severity: Minor
Found in tripal_chado/src/api/tripal_chado.cv.api.php - About 6 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 loadFasta has a Cognitive Complexity of 64 (exceeds 25 allowed). Consider refactoring.
Open

  private function loadFasta($file_path, $organism_id, $type, $re_name, $re_uname, $re_accession,
                             $db_id, $rel_type, $re_subject, $parent_type, $method, $analysis_id, $match_type) {

    $chado = $this->getChadoConnection();

Severity: Minor
Found in tripal_chado/src/Plugin/TripalImporter/FASTAImporter.php - About 6 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 parse has a Cognitive Complexity of 62 (exceeds 25 allowed). Consider refactoring.
Open

  private function parse($obo_file, &$header) {
    // Set to 1 if we are in the top header lines of the file.
    $in_header = TRUE;
    // Holds the full stanza for the term.
    $stanza = [];
Severity: Minor
Found in tripal_chado/src/Plugin/TripalImporter/OBOImporter.php - About 6 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 importRecord has a Cognitive Complexity of 59 (exceeds 25 allowed). Consider refactoring.
Open

  private function importRecord($taxid, $root_taxon = NULL, $organism = NULL) {
    $adds_organism = $organism ? FALSE : TRUE;

    // Get the "rank" cvterm. It requires that the TAXRANK vocabulary is loaded.
    $rank_cvterm = chado_get_cvterm([
Severity: Minor
Found in tripal_chado/src/Plugin/TripalImporter/TaxonomyImporter.php - About 5 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 chado_update_record has a Cognitive Complexity of 58 (exceeds 25 allowed). Consider refactoring.
Open

function chado_update_record($table, $match, $values, $options = NULL, $chado_schema_name = NULL) {

  $print_errors = (isset($options['print_errors'])) ? $options['print_errors'] : FALSE;

  if (!is_array($values)) {
Severity: Minor
Found in tripal_chado/src/api/tripal_chado.query.api.php - About 5 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 validateTypes has a Cognitive Complexity of 54 (exceeds 25 allowed). Consider refactoring.
Open

  protected function validateTypes($base_table, $delta, $record_id, $record) {

    $schema = $this->connection->schema();
    $table_def = $schema->getTableDef($base_table, ['format' => 'drupal']);

Severity: Minor
Found in tripal_chado/src/TripalStorage/ChadoRecords.php - About 5 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 preSave has a Cognitive Complexity of 53 (exceeds 25 allowed). Consider refactoring.
Open

  public function preSave(EntityStorageInterface $storage) {
    parent::preSave($storage);

    // Create a values array appropriate for `loadValues()`
    list($values, $tripal_storages) = TripalEntity::getValuesArray($this);
Severity: Minor
Found in tripal/src/Entity/TripalEntity.php - About 4 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 setPropValues has a Cognitive Complexity of 51 (exceeds 25 allowed). Consider refactoring.
Open

  protected function setPropValues(&$values, ChadoRecords $records) {

    $schema = $this->connection->schema();

    $replace = [];
Severity: Minor
Found in tripal_chado/src/Plugin/TripalStorage/ChadoStorage.php - About 4 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 cleanUnusedSharedLocks has a Cognitive Complexity of 50 (exceeds 25 allowed). Consider refactoring.
Open

  public function cleanUnusedSharedLocks() {
    // Acquire a state modification lock.
    if ($this->modLocker->acquire(static::STATE_KEY_SHARED)) {
      // Get shared lock status.
      $shared_locks = $this->state->get(static::STATE_KEY_SHARED, []);
Severity: Minor
Found in tripal_biodb/src/Lock/PersistentDatabaseSharedLockBackend.php - About 4 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 updateExisting has a Cognitive Complexity of 49 (exceeds 25 allowed). Consider refactoring.
Open

  private function updateExisting($root_taxon = NULL) {

    $total = count($this->all_orgs);
    $omitted_organisms = [];
    $api_key = \Drupal::state()->get('tripal_ncbi_api_key', NULL);
Severity: Minor
Found in tripal_chado/src/Plugin/TripalImporter/TaxonomyImporter.php - About 4 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 validateUnique has a Cognitive Complexity of 45 (exceeds 25 allowed). Consider refactoring.
Open

  protected function validateUnique($base_table, $delta, $record_id,  $record) {

    $schema = $this->connection->schema();
    $table_def = $schema->getTableDef($base_table, ['format' => 'drupal']);

Severity: Minor
Found in tripal_chado/src/TripalStorage/ChadoRecords.php - About 3 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