Showing 3,654 of 3,654 total issues
Function replaceHighlight
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
const replaceHighlight = (state, txt, all = false) => {
const {index, pattern, caseSensitive, diff} = state.searchTerm;
const es = state.editorState;
let contentChanged = 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 constructor
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
constructor() {
this.send = send;
this.setListView = function(noNavigate) {
if (noNavigate === undefined || !noNavigate) {
- 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 render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {item, page, getId, index} = this.props;
return (
<ListItem key={index} onClick={() => page.openPreview(getId(item))}>
Function storeValue
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
storeValue: (value, fieldId, rundownItem, config, fieldType) => {
if (fieldType === 'editor3') {
const editor3Config = config as IEditor3Config;
const rawState = (value as IEditor3ValueStorage).rawContentState;
Function activate
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
activate: (superdesk: ISuperdesk) => {
const {httpRequestJsonLocal} = superdesk;
const {dateToServerString} = superdesk.utilities;
superdesk.session.getCurrentUser().then((user) => {
Function getActionsInitialize
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function getActionsInitialize(superdesk: ISuperdesk) {
const {gettext} = superdesk.localization;
return function getActions(article: IArticle): Array<IAuthoringAction> {
if (!canChangeMarkedUser(superdesk, article)) {
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const initialConfig = this.props?.config?.initial_offset_minutes;
const checkbox = (
<Switch
label={{content: ''}}
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {item, page} = this.props;
return (
<ListItem onClick={() => page.openPreview(item._id)}>
Function saveEntity
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
saveEntity: (current, original) => {
const adapter = getArticleAdapter();
return authoringApiCommon.saveBefore(current, original).then((_current) => {
const id = original._id;
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
widget,
pinned,
pinWidget,
Function updateSearchQuery
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.updateSearchQuery = function updateSearchQuery(search) {
var where = [];
function prepareDate(val, timeSuffix) {
var local = moment(val, appConfig.view.dateformat).format('YYYY-MM-DD') + timeSuffix +
Function updateScopeData
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function updateScopeData(helperData, userPrefs) {
// If the planning module is installed we save a list of the available agendas
if (scope.features.agenda) {
scope.agendas = helperData.agendas;
}
Function saveCrops
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
$scope.saveCrops = function() {
/* Throw an exception if PoI is outside of a crop */
function poiIsInsideEachCrop() {
const originalImage = $scope.data.metadata.renditions.original;
Function ItemActionsByIntentDirective
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function ItemActionsByIntentDirective(superdesk, activityService, workflowService) {
return {
templateUrl: 'scripts/apps/authoring/views/item-actions-by-intent.html',
link: function($scope, elem, attrs) {
function getMenuGroups() {
Function AuthoringContainerDirective
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function AuthoringContainerDirective(authoringWorkspace: AuthoringWorkspaceService) {
function AuthoringContainerController() {
var self = this;
this.state = {};
Function MetaTargetedPublishingDirective
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function MetaTargetedPublishingDirective() {
return {
scope: {
list: '=',
disabled: '=ngDisabled',
Function getHistoryItems
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function getHistoryItems(item: IArticle): Promise<Array<IHistoryItem>> {
let historyItemsResult = [];
const archiveService = ng.get('archiveService');
const desks = ng.get('desks');
Function positionPopup
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function positionPopup(target, zIndex = 1000) {
const node: any = menuHolderElem().firstChild;
if (node == null) { // when loading
return;
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {loading} = this.state;
const {children} = this.props;
const style: CSSProperties = loading
? {position: 'absolute', insetInlineStart: -9999, insetBlockStart: -9999, visibility: 'hidden'}
Function EditTimeInterval
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function EditTimeInterval() {
return {
scope: {
initialValue: '=',
onChange: '=',