fonoster/routr

View on GitHub

Showing 133 of 133 total issues

Function cancelTransaction has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  cancelTransaction (transaction) {
    const storage = this.getStorage()
    const iterator = storage.iterator()

    while (iterator.hasNext()) {
Severity: Major
Found in mod/core/context_storage.js - About 2 hrs to fix

    Function createFromFile has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static createFromFile (req, api) {
        if (
          !isEmpty(req.contentType()) &&
          req.contentType().indexOf('multipart/form-data') !== -1
        ) {
    Severity: Major
    Found in mod/rest/utils.js - About 2 hrs to fix

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

      module.exports = config => {
        const Properties = Java.type('java.util.Properties')
        const FileInputStream = Java.type('java.io.FileInputStream')
        const properties = new Properties()
        // for more options see:
      Severity: Major
      Found in mod/core/server_properties.js - About 2 hrs to fix

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

        module.exports = (
          gateway,
          contactAddr,
          viaAddr,
          callId,
        Severity: Major
        Found in mod/registry/request_builder.js - About 2 hrs to fix

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

            resourceConstraintValidation () {
              // Ensure GW for gwRef
              let response = this.withCollection('numbers').find()
          
              if (response.status === Status.OK) {
          Severity: Minor
          Found in mod/data_api/files_datasource.js - About 1 hr to fix

            Function createFromFile has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              static createFromFile (req, api) {
                if (
                  !isEmpty(req.contentType()) &&
                  req.contentType().indexOf('multipart/form-data') !== -1
                ) {
            Severity: Minor
            Found in mod/rest/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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  expect(defaults)
                    .to.have.property('spec')
                    .to.have.property('dataSource')
                    .to.have.property('provider')
                    .to.be.equal('files_data_provider')
            Severity: Major
            Found in mod/core/config.unit.test.js and 1 other location - About 1 hr to fix
            mod/core/config.unit.test.js on lines 95..99

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 71.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  expect(defaults)
                    .to.have.property('spec')
                    .to.have.property('grpcService')
                    .to.have.property('bind')
                    .to.be.equal('127.0.0.1')
            Severity: Major
            Found in mod/core/config.unit.test.js and 1 other location - About 1 hr to fix
            mod/core/config.unit.test.js on lines 109..113

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 71.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Method runCommand has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                override fun runCommand(req: CommandRequest, responseObserver: StreamObserver<CommandReply>) {
                  val reply = CommandReply.newBuilder().setMessage(req.name).build()
                  val context = context
                  when (req.name) {
                    "stop-server" -> {
            Severity: Minor
            Found in src/main/kotlin/io/routr/core/GRPCServer.kt - About 1 hr to fix

              Function buildSipProvider has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                buildSipProvider (sipStack, transport) {
                  let sipProvider
              
                  for (const key in transport) {
                    const curTransport = transport[key]
              Severity: Minor
              Found in mod/core/server.js - About 1 hr to fix

                Function generateAors has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  static generateAors (request, user) {
                    const contactHeader = request.getHeader(ContactHeader.NAME)
                    const contactURI = contactHeader.getAddress().getURI()
                    const aors = []
                
                
                Severity: Minor
                Found in mod/registrar/utils.js - About 1 hr to fix

                  Function register has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    async register (gateway, received, rport) {
                      const gatewayCopy = gateway
                      if (
                        gatewayCopy &&
                        gatewayCopy.spec &&
                  Severity: Minor
                  Found in mod/registry/registry.js - About 1 hr to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      it('ingress thru a aorLink', () => {
                        locator.addEndpoint(agentEndpoint.aor, agentEndpoint.route)
                        const response = locator.findEndpoint('tel:0000000000')
                        assert.equal(response.status, Status.OK)
                      })
                    Severity: Major
                    Found in mod/location/test.js and 1 other location - About 1 hr to fix
                    mod/location/test.js on lines 78..82

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 67.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    deleteLocation = config => (_, res) => {
                      const store = new StoreAPI(SDSelector.getDriver(config))
                      const grpcClient = new GRPCClient(
                        'localhost',
                        parseInt(config.spec.grpcService.port)
                    Severity: Major
                    Found in mod/rest/rest.js and 1 other location - About 1 hr to fix
                    mod/rest/rest.js on lines 115..122

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 67.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      it('ingress thru a aorLink', () => {
                        locator.addEndpoint(agentEndpoint.aor, agentEndpoint.route)
                        const response = locator.findEndpoint('sip:0000000000@192.168.1.2')
                        assert.equal(response.status, Status.OK)
                      })
                    Severity: Major
                    Found in mod/location/test.js and 1 other location - About 1 hr to fix
                    mod/location/test.js on lines 72..76

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 67.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    getLocation = config => req => {
                      const store = new StoreAPI(SDSelector.getDriver(config))
                      const grpcClient = new GRPCClient(
                        'localhost',
                        parseInt(config.spec.grpcService.port)
                    Severity: Major
                    Found in mod/rest/rest.js and 1 other location - About 1 hr to fix
                    mod/rest/rest.js on lines 124..131

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 67.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Function connectionException has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports.connectionException = (e, host, transaction, route) => {
                      const { sendResponse } = require('@routr/core/processor/processor_utils')
                      let isInternal = false
                      if (
                        e instanceof Java.type('javax.sip.TransactionUnavailableException') ||
                    Severity: Minor
                    Found in mod/utils/exception_helpers.js - About 1 hr to fix

                      Function sendResponse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        async sendResponse (event) {
                          LOG.debug(
                            `core.processor.ResponseProcessor.sendResponse [Inconming response <=]`
                          )
                          LOG.debug(event.getResponse())
                      Severity: Minor
                      Found in mod/core/processor/response_processor.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

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                          this.jedisPool = new JedisPool(
                            this.buildPoolConfig(),
                            this.parameters.host,
                            parseInt(this.parameters.port),
                            parseInt(this.parameters.timeout),
                      Severity: Major
                      Found in mod/data_api/redis_datasource.js and 1 other location - About 1 hr to fix
                      mod/data_api/redis_store.js on lines 24..30

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 66.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              "stop-server" -> {
                                val timer = Timer()
                                timer.schedule(
                                    object : TimerTask() {
                                      override fun run() {
                      Severity: Major
                      Found in src/main/kotlin/io/routr/core/GRPCServer.kt and 1 other location - About 1 hr to fix
                      src/main/kotlin/io/routr/core/GRPCServer.kt on lines 70..81

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 123.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language