Showing 16 of 395 total issues
Method stanford_basic_form_system_theme_settings_alter
has 197 lines of code (exceeds 25 allowed). Consider refactoring. Open
function stanford_basic_form_system_theme_settings_alter(array &$form, FormStateInterface $form_state) {
$form['options_settings'] = [
'#type' => 'fieldset',
'#title' => t('Theme Specific Settings'),
File main-menu.island.tsx
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
import styled from "styled-components";
import {useWebComponentEvents} from "./hooks/useWebComponentEvents";
import {createIslandWebComponent} from 'preact-island'
import {useState, useEffect, useRef, useCallback} from 'preact/hooks';
import {deserialize} from "./tools/deserialize";
Function onContentImport
has a Cognitive Complexity of 30 (exceeds 10 allowed). Consider refactoring. Open
public function onContentImport(ImportEvent $event): void {
/** @var \Drupal\file\FileInterface $entity */
foreach ($event->getImportedEntities() as $entity) {
if ($entity->getEntityTypeId() == 'consumer') {
$entity->set('secret', md5(random_int(0, 99999)));
- 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 fetch
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
fetch() {
try {
switch (this.what) {
case 'first':
return this.item.parentNode.firstElementChild.firstChild;
Function attach
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
attach(context, settings) {
(function ($, once) {
// Validate there is a skip link anchor for the main content. If not,
// default to #page-content.
var $mc = $('#main-content', context).length;
Function MainMenu
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const MainMenu = ({}) => {
useWebComponentEvents(islandName)
const [menuItems, setMenuItems] = useState<MenuContentItem[]>([]);
const [menuOpen, setMenuOpen] = useState<boolean>(false);
Function buildCssLayersFromEntryPoints
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const buildCssLayersFromEntryPoints = () => {
return islands.map(({ layer, elementName }) => {
return {
issuerLayer: layer,
use: [
Method runTask
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function runTask(array &$install_state) {
$this->state->set('nobots', FALSE);
$node_pages = [
'403_page' => '4b8018dc-49a6-4018-9c54-e8c3e462beee',
Method getSnowData
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getSnowData($site_name) {
$api_url = Settings::get('caw_profile_snow_api_url', self::SNOW_API);
try {
$response = $this->client->request('GET', $api_url, [
'query' => ['website_address' => $site_name],
Function exec
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exec() {
this.event.preventDefault();
// Go to the first subnav item.
let node = this.getElement('firstSubnavLink');
Method loadOverrides
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadOverrides($names) {
$overrides = [];
if (in_array('system.site', $names)) {
$overrides['system.site']['page'] = [
403 => $this->state->get('caw_profile.403_page'),
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(element, options = {}) {
// What HTML element this is bound to.
this.elem = element;
// Set some default options.
Function exec
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
exec() {
const shifted = event.shiftKey;
let firstItem = false;
let lastItem = false;
Function insert
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
insert: (styleTag) => {
var styleTarget = styleTag.dataset.styleFor
if (!styleTarget) {
console.error(
Function runTask
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
public function runTask(array &$install_state) {
$this->state->set('nobots', FALSE);
$node_pages = [
'403_page' => '4b8018dc-49a6-4018-9c54-e8c3e462beee',
- 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 loadOverrides
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
public function loadOverrides($names) {
$overrides = [];
if (in_array('system.site', $names)) {
$overrides['system.site']['page'] = [
403 => $this->state->get('caw_profile.403_page'),
- 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"