Showing 160 of 174 total issues
Function tripal_file_upload_merge
has a Cognitive Complexity of 34 (exceeds 7 allowed). Consider refactoring. Open
function tripal_file_upload_merge($filename, $type, $user_dir) {
$uid = \Drupal::currentUser()->id();
$db = \Drupal::database();
$module = $_GET['module'];
- Read upRead up
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 updateValues
has a Cognitive Complexity of 34 (exceeds 7 allowed). Consider refactoring. Open
public function updateValues(&$values) : bool {
$chado = $this->getChadoConnection();
$logger = \Drupal::service('tripal.logger');
$build = $this->buildChadoRecords($values, TRUE);
- Read upRead up
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 7 allowed). Consider refactoring. Open
protected function processUpgradeQueries() {
// Setup DB object upgrade priority according to Chado version.
$priorities = [];
switch ($this->parameters['version']) {
- Read upRead up
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_report_error
has a Cognitive Complexity of 29 (exceeds 7 allowed). Consider refactoring. Open
function tripal_report_error($type, $severity, $message, $variables = [], $options = []) {
$logger = \Drupal::service('tripal.logger');
$logger->warning("DEPRECATED: the '@function' function will be removed from the API in " .
"a future release. Please use the TripalLogger service for logging.",
- Read upRead up
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 create
has a Cognitive Complexity of 28 (exceeds 7 allowed). Consider refactoring. Open
public function create($details) {
// Set some defaults
if (!array_key_exists('prority', $details)) {
$details['priority'] = 10;
- Read upRead up
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 setRecordIds
has a Cognitive Complexity of 27 (exceeds 7 allowed). Consider refactoring. Open
protected function setRecordIds(&$values, $records) {
$chado = $this->getChadoConnection();
$schema = $chado->schema();
// Iterate through the value objects.
- Read upRead up
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 findSynonyms
has a Cognitive Complexity of 26 (exceeds 7 allowed). Consider refactoring. Open
private function findSynonyms() {
$chado = $this->getChadoConnection();
$batch_size = 1000;
$num_features = count(array_keys($this->features));
$num_batches = (int) ($num_features / $batch_size) + 1;
- Read upRead up
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 installTerms
has a Cognitive Complexity of 25 (exceeds 7 allowed). Consider refactoring. Open
public function installTerms() {
$config_factory = \Drupal::service('config.factory');
$config = $config_factory->get('tripal.tripal_content_terms.chado_content_terms');
$vocabs = $config->get('vocabularies');
foreach ($vocabs as $vocab_info) {
- Read upRead up
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 replaceTokens
has a Cognitive Complexity of 24 (exceeds 7 allowed). Consider refactoring. Open
public function replaceTokens($string, $cache = []) {
// Pull any items out of the cache.
if (isset($cache['bundle'])) {
$bundle_entity = $cache['bundle'];
- Read upRead up
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 getDefaultTitleFormat
has a Cognitive Complexity of 24 (exceeds 7 allowed). Consider refactoring. Open
public function getDefaultTitleFormat() {
// Retrieve all available tokens.
$tokens = $this->getTokens([
'include id' => FALSE,
- Read upRead up
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 addMissingProteins
has a Cognitive Complexity of 24 (exceeds 7 allowed). Consider refactoring. Open
private function addMissingProteins() {
$this->setItemsHandled(0);
$this->setTotalItems(count(array_keys($this->proteins)));
// Second, iterate through the protein list and for any parents that
- Read upRead up
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 saveTermAttributes
has a Cognitive Complexity of 24 (exceeds 7 allowed). Consider refactoring. Open
protected function saveTermAttributes(TripalTerm $term, object $cvterm, array $options) : bool {
$update_parent = False;
if (array_key_exists('updateParent', $options)) {
$update_parent = $options['updateParent'];
- Read upRead up
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 24 (exceeds 7 allowed). Consider refactoring. Open
public function formValidate($form, &$form_state) {
$public = \Drupal::database();
$obo_id = $form_state->getValue('obo_id');
$obo_name = trim($form_state->getValue('obo_name'));
- Read upRead up
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 getMainTables
has a Cognitive Complexity of 23 (exceeds 7 allowed). Consider refactoring. Open
public function getMainTables() {
// Initialize the base tables with those tables that are missing a type.
// Ideally they should have a type, but that's for a future version of Chado.
$base_tables = [
- Read upRead up
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 saveTerm
has a Cognitive Complexity of 23 (exceeds 7 allowed). Consider refactoring. Open
private function saveTerm($stanza, $is_relationship = FALSE) {
$chado = $this->getChadoConnection();
// Get the term ID.
$id = $stanza['id'][0];
- Read upRead up
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_tripal_cron_notification
has a Cognitive Complexity of 23 (exceeds 7 allowed). Consider refactoring. Open
function tripal_tripal_cron_notification() {
$num_created = 0;
// Get all bundle names to cycle through.
$all_bundles = db_select('tripal_bundle', 'tb')
- Read upRead up
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 setDefaults
has a Cognitive Complexity of 23 (exceeds 7 allowed). Consider refactoring. Open
private function setDefaults($header) {
$short_name = '';
$namespace = '';
$idspaces = [];
- Read upRead up
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 getBaseTables
has a Cognitive Complexity of 23 (exceeds 7 allowed). Consider refactoring. Open
function getBaseTables() {
// Initialize the base tables with those tables that are missing a type.
// Ideally they should have a type, but that's for a future version of Chado.
$base_tables = [
- Read upRead up
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 23 (exceeds 7 allowed). Consider refactoring. Open
public static function postLoad(EntityStorageInterface $storage, array &$entities) {
parent::postLoad($storage, $entities);
$entity_type_id = $storage->getEntityTypeId();
$field_manager = \Drupal::service('entity_field.manager');
- Read upRead up
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 prepareFiles
has a Cognitive Complexity of 22 (exceeds 7 allowed). Consider refactoring. Open
public function prepareFiles() {
// If no file is required then just indicate that all is good to go.
if ($this->plugin_definition['file_required'] == FALSE) {
$this->is_prepared = TRUE;
- Read upRead up
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"