Showing 18 of 74 total issues
Data
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
export class Data {
constructor(session, slice) {
this._session = session;
this._id = nanoid();
this._slice = slice;
Data
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
export class Data {
private _content: any
private _session: Session
private _id: string
private _slice: string
Session
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
export class Session {
private _id: string
private _revision: string
private _data: any
private _isBrowser: boolean
Session
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
export class Session {
constructor(config, dispatch = undefined) {
this._config = config || {};
this._dispatch = dispatch;
this._isBrowser = (typeof window !== 'undefined');
Function useCarmelAuth
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useCarmelAuth = (carmelNet: any) => {
const [isLoading, setIsLoading] = useState(false);
const status = () => {
return {
Function libp2pConfig
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const libp2pConfig = () => {
const star = webRTCStar()
const transports = [star.transport, webSockets()]
const peerDiscovery = [star.discovery, bootstrap({
Function _sync
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _sync() {
if (this.session.config.isOperator && !this.session.isConnected) {
this.session.setStatus(SESSION_STATUS.CONNECTED);
return;
}
Function start
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async start() {
const sio = require('socket.io')
const sioNext = require('socket.io-next')
const sior = require('socket.io-redis')
Function start
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async start() {
const sio = require('socket.io');
const sioNext = require('socket.io-next');
const sior = require('socket.io-redis');
const siorNext = require('socket.io-redis-next');
Function _sync
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _sync () {
if (this.session.config.isOperator && !this.session.isConnected) {
this.session.setStatus(SESSION_STATUS.CONNECTED)
return
}
Function _sync
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async _sync () {
if (this.session.config.isOperator && !this.session.isConnected) {
this.session.setStatus(SESSION_STATUS.CONNECTED)
return
}
- 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 _sync
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async _sync() {
if (this.session.config.isOperator && !this.session.isConnected) {
this.session.setStatus(SESSION_STATUS.CONNECTED);
return;
}
- 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 libp2pConfig
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const libp2pConfig = () => {
const star = webRTCStar({ wrtc })
const transports = [star.transport, webSockets(), tcp(), webRTCDirect()]
const peerDiscovery = [star.discovery, mdns()]
Function useCarmelNet
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useCarmelNet = () => {
const [session, setSession] = useState<any>(null);
const [isConnected, setIsConnected] = useState(false);
// const loadFile = async (ipfs: any, hash: string) => {
Function onEvent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async onEvent (id: string, data: any, type: string, from: string) {
const log = debug(`carmel:event:${this.id}:${id}`)
log(`<- received [${id}] event (${type})`)
const handler = this._eventHandler(id)
- 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 onEvent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async onEvent(id, data, type, from) {
const log = debug(`carmel:event:${this.id}:${id}`);
log(`<- received [${id}] event (${type})`);
const handler = this._eventHandler(id);
if (!handler) {
- 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 __createBinding
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
- 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 MobileSidebar
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function MobileSidebar({ section, sections, sideBar, setSideBar, onMobileItemSelect }: any) {
if (!sections || !section || !sections.data) return <div/>
const NavItem = (item: any) => {
if (!item.sections || item.sections.length === 0) {
- 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"