Showing 165 of 254 total issues
File conversations.js
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
//
// Copyright 2014 Ilkka Oksanen <iao@iki.fi>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
`` has 27 functions (exceeds 20 allowed). Consider refactoring. Open
export default Component.extend({
init(args) {
this._super(args);
this.content = EmberObject.create();
Function init
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.init = async function init(user, session, maxBacklogLines, cachedUpto) {
await settingsService.sendUpdateSettings(user, session.id);
await friendsService.sendUpdateFriends(user, session.id);
await friendsService.sendConfirmFriends(user, session.id);
await friendsService.informStateChange(user, 'login');
Function handleMode
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function handleMode(user, msg) {
// :ilkka9!~ilkka9@localhost.myrootshell.com MODE #sunnuntai +k foobar3
const target = msg.params[0];
if (!isChannel(target)) {
Function didInsertElement
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
didInsertElement() {
this.sendAction('register', this);
this.set('elementInserted', true);
this.$messagePanel = this.$('.window-messages');
Function RegisterModal
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export const RegisterModal: FunctionComponent<RegisterModalProps> = ({ isOpen, onClose }: RegisterModalProps) => {
const validateName = (value: string) => {
if (!value) {
return 'Name is required';
} else if (value.length < 6) {
- 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 configTransports
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function configTransports() {
const transports = [];
if (get('log:file')) {
let logDirectory = path.normalize(get('log:directory'));
- 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
File create-db.ts
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
//
// Copyright 2015 Ilkka Oksanen <iao@iki.fi>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
File MessageRenderer.tsx
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { FunctionComponent, useContext, useState, KeyboardEvent } from 'react';
import {
Button,
Box,
Flex,
Function WindowSettings
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const WindowSettings: FunctionComponent = () => {
const { windowStore } = useContext(ServerContext);
const window = windowStore.activeWindow;
const [topic, setTopic] = useState<string | null>(null);
const [requestedNotificationPermission, setRequestedNotificationPermission] = useState<boolean>(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 updateNick
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function updateNick(user, network, oldNick, newNick) {
let changed = false;
let targetUserGId = null;
const nickUser = await nicksService.getUser(oldNick, network);
File Message.js
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { computed, observable } from 'mobx';
import marked from 'marked';
import emojione from 'emojione';
import moment from 'moment';
import URI from 'urijs';
Function _dragWindowEnd
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
_dragWindowEnd(event) {
const cursor = this.cursor;
this.set('draggedWindow', false);
this.movingWindow.$().removeClass('moving').css('z-index', '');
Function constructor
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
if (!this.cookie) {
console.error(`Session cookie not found or corrupted. Exiting.`);
this._logout();
}
Function Sidebar
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const Sidebar: FunctionComponent<SidebarProps> = ({ fullScreen = false, showDesktops }: SidebarProps) => {
const { windowStore } = useContext(ServerContext);
const sortWindows = (windows: WindowModel[]) => {
return windows.sort((a, b) => {
- 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 LoginModal
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const LoginModal: FunctionComponent<LoginModalProps> = ({ isOpen, onClose }: LoginModalProps) => {
const [mode, setMode] = useState<Mode>(Mode.Login);
const googleRedirect = () => {
window.location.pathname = '/auth/google';
- 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 updateNick
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
async function updateNick(user, network, oldNick, newNick) {
let changed = false;
let targetUserGId = null;
const nickUser = await nicksService.getUser(oldNick, network);
- 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
File requests.ts
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Network, MessageRecord, AlertsRecord } from './notifications';
export interface CreateRequest {
id: 'CREATE';
name: string;
Function setup
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setup() {
if (conf.get('googleauth:enabled')) {
const GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
const jwt = require('jwt-simple');
Function introduceUsers
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function introduceUsers(user, userGIds, session, socket) {
if (session) {
// If no session is given, force broadcast userGids without remembering them
session.knownUserGIds = session.knownUserGIds || {};
}