scripts/core/editor3/directive.tsx
Function initialize
has 274 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
initialize($element, editor3, $scope, $rootScope) {
if (this.item == null) {
throw new Error(
'Item must be provided in order to be able to save editor_state on it',
);
File directive.tsx
has 429 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable react/no-multi-comp */
/* eslint-disable complexity */
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
Function renderEditor3
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderEditor3 = () => {
const element = $element.get(0);
ReactDOM.unmountComponentAtNode(element);
Function generateHtml
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function generateHtml(
store: Store<IEditorStore, AnyAction>,
item: IArticle,
pathToValue: string,
) {
Function constructor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor() {
this.scope = {};
this.controllerAs = 'vm';
this.controller = [
'$element',
Function getTemplateForHeader
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getTemplateForHeader = () => {
return (
<div style={{display: 'flex'}} className="sd-input-style">
<div className="authoring-header__item-label">
{fieldName}
Function generateHtml
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
function generateHtml(
store: Store<IEditorStore, AnyAction>,
item: IArticle,
pathToValue: string,
) {
- 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"