dstack-js/dstack

View on GitHub

Showing 13 of 22 total issues

Function exports has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = (socket, options = {}) => {
  const { sink, source } = toIterable.duplex(socket)

  // If the remote address was passed, use it - it may have the peer ID encapsulated
  const remoteAddr =
Severity: Major
Found in packages/transport/src/socket-to-conn.js - About 2 hrs to fix

    Function incommingDial has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const incommingDial = (offer) => {
          if (offer.answer || offer.err) {
            return
          }
    
    
    Severity: Minor
    Found in packages/transport/src/listener.js - About 1 hr to fix

      Function exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = ({ handler, upgrader }, WebRTCStar, options = {}) => {
        const sioOptions = {
          path: '/socket.io/',
          transports: ['websocket'],
          'force new connection': true,
      Severity: Minor
      Found in packages/transport/src/listener.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 HomepageHeader has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function HomepageHeader() {
        const { siteConfig } = useDocusaurusContext();
        return (
          <header className={clsx('hero hero--primary', styles.heroBanner)}>
            <div className="container">
      Severity: Minor
      Found in docs/src/pages/index.tsx - About 1 hr to fix

        Function exports has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = (config) => {
          nrwlConfig(config);
        
          return {
            ...config,
        Severity: Minor
        Found in webpack.config.js - About 1 hr to fix

          Function App has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const App: React.FC = () => {
            const namespace: string = localStorage['namespace'] || 'explorer'
            const [stack, setStack] = useState<Stack | null>()
          
            useEffect(() => {
          Severity: Minor
          Found in packages/explorer/src/main.tsx - About 1 hr to fix

            Function exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = (socket, options = {}) => {
              const { sink, source } = toIterable.duplex(socket)
            
              // If the remote address was passed, use it - it may have the peer ID encapsulated
              const remoteAddr =
            Severity: Minor
            Found in packages/transport/src/socket-to-conn.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 cleanUrlSIO has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function cleanUrlSIO(ma) {
              const maStrSplit = ma.toString().split('/')
              const tcpProto = ma.protos()[1].name
              const wsProto = ma.protos()[2].name
              const tcpPort = ma.stringTuples()[1][1]
            Severity: Minor
            Found in packages/transport/src/utils.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 getStack has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const getStack = async (namespace: string) => {
              let stack = cache.get(namespace)
            
              if (!stack) {
                try {
            Severity: Minor
            Found in packages/relay/src/services/stack.ts - About 1 hr to fix

              Function close has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  close() {
                    if (socket.destroyed) return
              
                    return new Promise((resolve, reject) => {
                      const start = Date.now()
              Severity: Minor
              Found in packages/transport/src/socket-to-conn.js - About 1 hr to fix

                Function constructor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  constructor(options = {}) {
                    if (!options.upgrader) {
                      throw new Error(
                        'An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.'
                      )
                Severity: Minor
                Found in packages/transport/src/index.js - About 1 hr to fix

                  Function getListenAddress has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const getListenAddress = (
                    protocol: 'http' | 'https',
                    hostname: string,
                    port: number | string
                  ) => {
                  Severity: Minor
                  Found in packages/relay/src/services/address.ts - About 45 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 setPlayground has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const setPlayground = (fastify: FastifyInstance) => {
                    fastify.get('/', (req, res) => {
                      let [host, port] = req.headers['host']
                        ? req.headers['host'].split(':')
                        : [process.env['HOST'] || '0.0.0.0', process.env['PORT'] || '13579']
                  Severity: Minor
                  Found in packages/relay/src/playgroud.ts - About 45 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