Showing 3,654 of 3,654 total issues
Function link
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
link: function(scope) {
api('roles')
.query()
.then((result) => {
scope.roles = $filter('sortByName')(result._items);
Function createPatchObject
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createPatchObject() {
var p = {};
_.each(orig, (val, key) => {
if (key === 'dateline:located') {
Function ItemRendition
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function ItemRendition() {
return {
templateUrl: 'scripts/apps/archive/views/item-rendition.html',
scope: {
item: '=',
Function openAuthoring
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.open = function openAuthoring(_id, readOnly, repo, action, state) {
let endpoint = 'archive';
if ($location.$$path !== '/multiedit') {
superdeskFlags.flags.authoring = true;
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
if (this.props.action === 'view' && typeof this.state.articleOriginal === 'undefined') {
return null; // fetching article from the server
}
Function link
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
link: function(scope, elem, attrs, dropdown) {
scope.$watch(dropdown.isOpen, (isOpen) => {
if (isOpen) {
_.defer(() => {
var keyboardOptions = {inputDisabled: false, propagate: false};
Function initCarousel
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function initCarousel() {
let updated = false;
carousel = elem.find(carouselContainerSelector).owlCarousel({
items: 1,
Function selectLocator
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
scope.selectLocator = function(locator) {
var updates = {};
let loc = locator;
if (!loc && scope.$ctrl.selectedTerm) {
Function spikeItems
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function spikeItems(): void {
const spikeMultiple = () => {
Promise.all(
getSelectedItems().map((item) => sdApi.article.doSpike(item)),
).then(() => {
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
this.props.total > 0 ?
this.props.items.map((item, key) => (
<li className="content-item" key={key}>
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const classes = classNames(
'plain-text-editor',
this.props.classes,
{focus: this.state.hasFocus},
Function getComponent
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getComponent = (val, index, _row) => {
const indexReadOnly = isIndexReadOnly(index);
return _row ?
(
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<Modal
visible
zIndex={1050}
Function generateFilterForServer
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function generateFilterForServer(type: FormFieldType, value: any): any {
switch (type) {
case FormFieldType.plainText:
return {
$regex: value,
Function fetch
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private fetch(priority: RequestPriority = RequestPriority.LOW) {
const requestParams = this.requestFactory();
if (requestParams.endpoint[0] !== '/') {
requestParams.endpoint = '/' + requestParams.endpoint;
Function startListeners
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private startListeners() {
this.listeners.push(addWebsocketEventListener(
'resource:created',
(event: IWebsocketMessage<IResourceCreatedEvent>) => {
const specs = this.listenTo[event.extra.resource];
Function link
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
link: function(scope, elem, attrs) {
var UP = -1,
DOWN = 1;
scope.chooser = activityChooser;
Function handleContentChanges
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleContentChanges(changes: Array<IResourceChange>) {
const {data} = this.state;
const dataInitialized = data != null;
if (this.updatingRequestInProgress || dataInitialized !== true) {
Function getFilters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
function getFilters(filters: IRundownFilters | undefined): ILogicalOperator | undefined {
const queryFilters: IAndOperator['$and'] = [];
if (filters?.show != null) {
queryFilters.push({show: {$eq: filters.show}});
- 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 SubscribersDirective
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
notify, api, subscribersService, adminPublishSettingsService,
modal, contentFilters, $q, $filter, products, $rootScope,