fluidtrends/carmel

View on GitHub

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;
Severity: Minor
Found in core/lib/Data.js - About 4 hrs to fix

    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 
    Severity: Minor
    Found in core/src/Data.ts - About 4 hrs to fix

      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
      Severity: Minor
      Found in core/src/Session.ts - About 3 hrs to fix

        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');
        Severity: Minor
        Found in core/lib/Session.js - About 3 hrs to fix

          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 {
          Severity: Major
          Found in web/sdk/hooks/auth.tsx - About 2 hrs to fix

            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({
            Severity: Minor
            Found in web/sdk/config/libp2p.ts - About 1 hr to fix

              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;
                      }
              Severity: Minor
              Found in core/lib/Gateway.js - About 1 hr to fix

                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')
                Severity: Minor
                Found in relay/src/Server.ts - About 1 hr to fix

                  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');
                  Severity: Minor
                  Found in relay/lib/Server.js - About 1 hr to fix

                    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 
                            }
                    Severity: Minor
                    Found in core/src/Gateway.ts - About 1 hr to fix

                      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 
                              }
                      Severity: Minor
                      Found in core/src/Gateway.ts - About 1 hr to fix

                      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;
                              }
                      Severity: Minor
                      Found in core/lib/Gateway.js - About 1 hr to fix

                      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()]
                      Severity: Minor
                      Found in sentinel/src/config/libp2p.ts - About 1 hr to fix

                        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) => {
                        Severity: Minor
                        Found in web/sdk/hooks/net.tsx - About 1 hr to fix

                          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)
                          Severity: Minor
                          Found in core/src/Channel.ts - About 35 mins to fix

                          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) {
                          Severity: Minor
                          Found in core/lib/Channel.js - About 35 mins to fix

                          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]; } };
                          Severity: Minor
                          Found in relay/lib/index.js - About 35 mins to fix

                          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) {
                          Severity: Minor
                          Found in web/components/docs/sidebar.tsx - About 25 mins to fix

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language