tripal/tripal

View on GitHub

Showing 124 of 124 total issues

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

Function setFieldDefDefaults has a Cognitive Complexity of 45 (exceeds 25 allowed). Consider refactoring.
Open

  public function setFieldDefDefaults(array $field_def = []) : array {
    $new_defs = [];

    $new_defs['name'] = 'tripal_entity.change.me';
    if (array_key_exists('name', $field_def) and !empty($field_def['name'])) {
Severity: Minor
Found in tripal/src/Services/TripalFieldCollection.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

Function __construct has a Cognitive Complexity of 43 (exceeds 25 allowed). Consider refactoring.
Open

  public function __construct(array $details = NULL) {

    // Instantiate the TripalLogger.
    $this->messageLogger = \Drupal::service('tripal.logger');

Severity: Minor
Found in tripal/src/TripalVocabTerms/TripalTerm.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

Function findEBITerm has a Cognitive Complexity of 42 (exceeds 25 allowed). Consider refactoring.
Open

  private function findEBITerm($id) {

    // Warn the user if we're looking up terms in EBI as this will slow the
    // loader if there are many lookups.
    if ($this->ebi_warned == FALSE) {
Severity: Minor
Found in tripal_chado/src/Plugin/TripalImporter/OBOImporter.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

Function buildChadoRecords has a Cognitive Complexity of 41 (exceeds 25 allowed). Consider refactoring.
Open

  protected function buildChadoRecords($values, bool $is_find = FALSE) {

    $this->field_debugger->reportValues($values, 'The values submitted to ChadoStorage');

    // Iterate through the value objects.
Severity: Minor
Found in tripal_chado/src/Plugin/TripalStorage/ChadoStorage.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 processTerm has a Cognitive Complexity of 39 (exceeds 25 allowed). Consider refactoring.
Open

  private function processTerm($stanza, $is_relationship = 0) {

    $chado = $this->getChadoConnection();

    //
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 parseTableDdl has a Cognitive Complexity of 38 (exceeds 25 allowed). Consider refactoring.
Open

  public function parseTableDdl(string $table_ddl) :array {
    $table_definition = [
      'columns' => [],
      'constraints' => [],
      'indexes' => [],
Severity: Minor
Found in tripal/src/TripalDBX/TripalDbx.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 formValidate has a Cognitive Complexity of 38 (exceeds 25 allowed). Consider refactoring.
Open

  public function formValidate($form, &$form_state) {

    $obo_id = $form_state->getValue('obo_id');
    $obo_name = trim($form_state->getValue('obo_name') ?? '');
    $obo_url = trim($form_state->getValue('obo_url') ?? '');
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 cacheTermStanza has a Cognitive Complexity of 38 (exceeds 25 allowed). Consider refactoring.
Open

  private function cacheTermStanza($stanza, $type) {

    // Make sure we have defaults.
    if (!$this->default_namespace) {
      throw new \Exception('Cannot cache terms without a default CV.' . print_r($stanza, TRUE));
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 pmidParseBookDocument has a Cognitive Complexity of 37 (exceeds 25 allowed). Consider refactoring.
Open

  private function pmidParseBookDocument($xml, &$pub) {

    while ($xml->read()) {
      // get this element name
      $element = $xml->name;
Severity: Minor
Found in tripal/src/Plugin/TripalPubLibrary/TripalPubLibraryPubMed.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 chado_query has a Cognitive Complexity of 36 (exceeds 25 allowed). Consider refactoring.
Open

function chado_query($sql, $args = [], $options = [], $chado_schema_name = NULL) {
  $results = NULL;

  // Check if Chado is within the same database as Drupal (i.e. local).
  $is_local = chado_is_local(FALSE, $chado_schema_name);
Severity: Minor
Found in tripal_chado/src/api/tripal_chado.query.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 findFeatures has a Cognitive Complexity of 36 (exceeds 25 allowed). Consider refactoring.
Open

  private function findFeatures() {
    $chado = $this->getChadoConnection();
    $batch_size = 1000;
    $num_features = count(array_keys($this->features));
    $num_batches = (int) ($num_features / $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

Function pmidParseAuthorlist has a Cognitive Complexity of 36 (exceeds 25 allowed). Consider refactoring.
Open

  private function pmidParseAuthorlist($xml, &$pub) {
    $num_authors = 0;
  
    while ($xml->read()) {
      $element = $xml->name;
Severity: Minor
Found in tripal/src/Plugin/TripalPubLibrary/TripalPubLibraryPubMed.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 chado_insert_property has a Cognitive Complexity of 35 (exceeds 25 allowed). Consider refactoring.
Open

function chado_insert_property($record, $property, $options = [], $schema_name = 'chado') {

  $base_table = array_key_exists('table', $record) ? $record['table'] : '';
  $base_id = array_key_exists('id', $record) ? $record['id'] : '';

Severity: Minor
Found in tripal_chado/src/api/tripal_chado.property.api.php - 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 selectRecords has a Cognitive Complexity of 35 (exceeds 25 allowed). Consider refactoring.
Open

  public function selectRecords(string $base_table, string $table_alias) : int {

    // Indicates the number of records that were found for this table.
    // We need to return the number found because even if no records are found
    // the `values` array of $this->records will still have the values that were
Severity: Minor
Found in tripal_chado/src/TripalStorage/ChadoRecords.php - 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 tripal_file_upload_merge has a Cognitive Complexity of 34 (exceeds 25 allowed). Consider refactoring.
Open

function tripal_file_upload_merge($filename, $type, $user_dir) {
  $uid = \Drupal::currentUser()->id();
  $db = \Drupal::database();

  $module = $_GET['module'];
Severity: Minor
Found in tripal/src/api/tripal.upload.api.php - 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 processUpgradeQueries has a Cognitive Complexity of 34 (exceeds 25 allowed). Consider refactoring.
Open

  protected function processUpgradeQueries() {

    // Setup DB object upgrade priority according to Chado version.
    $priorities = [];
    switch ($this->parameters['version']) {
Severity: Minor
Found in tripal_chado/src/Task/ChadoUpgrader.php - 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 chado_delete_record has a Cognitive Complexity of 31 (exceeds 25 allowed). Consider refactoring.
Open

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

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

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

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


    // IF we are doing a listing of content types there is no way in Drupal 10
Severity: Minor
Found in tripal/src/Entity/TripalEntity.php - 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 rebuildTree has a Cognitive Complexity of 31 (exceeds 25 allowed). Consider refactoring.
Open

  private function rebuildTree($root_taxon = NULL) {
    $chado = $this->getChadoConnection();
    $lineage_nodes[] = [];

    // Get the "rank" cvterm. It requires that the TAXRANK vocabulary is loaded.
Severity: Minor
Found in tripal_chado/src/Plugin/TripalImporter/TaxonomyImporter.php - 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

Severity
Category
Status
Source
Language