Showing 160 of 174 total issues
Function validateSize
has a Cognitive Complexity of 18 (exceeds 7 allowed). Consider refactoring. Open
public function validateSize($values, $chado_table, $record_id, $record, &$violations) {
$chado = $this->getChadoConnection();
$schema = $chado->schema();
$table_def = $schema->getTableDef($chado_table, ['format' => 'drupal']);
- 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 validateFKs
has a Cognitive Complexity of 18 (exceeds 7 allowed). Consider refactoring. Open
private function validateFKs($values, $chado_table, $record_id, $record, &$violations) {
$chado = $this->getChadoConnection();
$schema = $chado->schema();
$table_def = $schema->getTableDef($chado_table, ['format' => 'drupal']);
- 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 buildForm
has a Cognitive Complexity of 17 (exceeds 7 allowed). Consider refactoring. Open
public function buildForm(array $form, FormStateInterface $form_state, $table_id = null) {
$chado = \Drupal::service('tripal_chado.database');
$custom_tables = \Drupal::service('tripal_chado.custom_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 getFeatureNames
has a Cognitive Complexity of 17 (exceeds 7 allowed). Consider refactoring. Open
private function getFeatureNames($attrs, $type, $landmark_name, $fmin, $fmax) {
$uniquename = '';
$name = '';
if (!array_key_exists('ID', $attrs) and !array_key_exists('Name', $attrs)) {
- 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 getSchemaDef
has a Cognitive Complexity of 17 (exceeds 7 allowed). Consider refactoring. Open
public function getSchemaDef(array $parameters) :array {
static $schema_structure = [];
$source = $parameters['source'] ?? 'file';
$format = strtolower($parameters['format'] ?? '');
- 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 getValuesArray
has a Cognitive Complexity of 16 (exceeds 7 allowed). Consider refactoring. Open
public static function getValuesArray($entity) {
$values = [];
$tripal_storages = [];
$fields = $entity->getFields();
- 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 selectChadoRecord
has a Cognitive Complexity of 16 (exceeds 7 allowed). Consider refactoring. Open
public function selectChadoRecord(&$records, $base_tables, $chado_table, $delta, $record) {
$chado = $this->getChadoConnection();
if (!array_key_exists('conditions', $record)) {
throw new \Exception($this->t('Cannot select record in the Chado "@table" table due to missing conditions. Record: @record',
- 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 checkColumnType
has a Cognitive Complexity of 16 (exceeds 7 allowed). Consider refactoring. Open
public function checkColumnType($table, $column, $expected_type = NULL) {
// Ensure this column exists before moving forward.
if (!$this->checkColumnExists($table, $column)) {
tripal_report_error(
- 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 storageSettingsForm
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data) {
$elements = [];
$settings = $this->getSetting('storage_plugin_settings');
// turn into selection
- 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 cacheRelationships
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
private function cacheRelationships() {
// Now that we have all of the terms parsed and loaded into the cache,
// lets run through them one more time cache any terms in relationships
// as well.
- 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 prefixTables
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
public function prefixTables($sql) {
// Make sure there is no extra "{number:" in the query.
$matches = [];
if (preg_match_all('/\{(\d+):/', $sql, $matches)) {
- 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 validateRequired
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
private function validateRequired($values, $chado_table, $record_id, $record, &$violations) {
$chado = $this->getChadoConnection();
$schema = $chado->schema();
$table_def = $schema->getTableDef($chado_table, ['format' => 'drupal']);
$pkey = $table_def['primary key'];
- 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 setTableSchema
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
public function setTableSchema($table_schema, $force = False) {
$logger = \Drupal::service('tripal.logger');
if (!$this->table_id) {
$logger->error('Cannot set the schema for the custom table. Please, first run the init() function.');
- 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 insertFeatureProps
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
private function insertFeatureProps(){
$chado = $this->getChadoConnection();
$batch_size = 100;
$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 propertyDefinitions
has a Cognitive Complexity of 14 (exceeds 7 allowed). Consider refactoring. Open
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties = [];
foreach (get_called_class()::tripalTypes($field_definition) as $type) {
if ($type instanceof IntStoragePropertyType) {
- 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 form
has a Cognitive Complexity of 14 (exceeds 7 allowed). Consider refactoring. Open
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$chado_tables = $this->entity->getTableNames();
$chado_table = $form_state->hasValue('chado_table') ? $form_state->getValue('chado_table') : 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 validateForm
has a Cognitive Complexity of 14 (exceeds 7 allowed). Consider refactoring. Open
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
$values = $form_state->getValues();
$tripal_entity_type = $this->entity;
- 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 setPrefix
has a Cognitive Complexity of 14 (exceeds 7 allowed). Consider refactoring. Open
protected function setPrefix($prefix) {
if (is_array($prefix)) {
$this->prefixes = $prefix + [
'default' => '',
];
- 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 getAvailableInstances
has a Cognitive Complexity of 14 (exceeds 7 allowed). Consider refactoring. Open
public function getAvailableInstances() :array {
$chado_schemas = [];
// Get test schema prefix. If none set, we use '0' so we can test the prefix
// and avoid false-positive since no schema name is allowed to start by a
- 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 buildForm
has a Cognitive Complexity of 14 (exceeds 7 allowed). Consider refactoring. Open
public function buildForm(array $form, FormStateInterface $form_state, $plugin_id = NULL) {
if (!$plugin_id) {
return $form;
}
- 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"