theQRL/block-explorer

View on GitHub

Showing 157 of 157 total issues

File index.js has 1081 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint no-console: 0, max-len: 0 */
/* global _ */

// server-side startup
import grpc from '@grpc/grpc-js'
Severity: Major
Found in imports/startup/server/index.js - About 2 days to fix

    File address.js has 924 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint no-console: 0 */
    /* ^^^ remove once testing complete
     */
    import JSONFormatter from 'json-formatter-js'
    import qrlAddressValidator from '@theqrl/validate-qrl-address'
    Severity: Major
    Found in imports/ui/components/address/address.js - About 2 days to fix

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

            if (symbol.slice(0, 8) === '00ff00ff') {
              const nftBytes = Buffer.concat([
                Buffer.from(txEdited.tx.token.symbol),
                Buffer.from(txEdited.tx.token.name),
              ])
      Severity: Major
      Found in imports/startup/server/index.js and 1 other location - About 7 hrs to fix
      imports/startup/server/index.js on lines 374..386

      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 193.

      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

            if (symbol.slice(0, 8) === '00ff00ff') {
              const nftBytes = Buffer.concat([
                Buffer.from(txEdited.tx.transfer_token.symbol),
                Buffer.from(txEdited.tx.transfer_token.name),
              ])
      Severity: Major
      Found in imports/startup/server/index.js and 1 other location - About 7 hrs to fix
      imports/startup/server/index.js on lines 347..359

      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 193.

      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

      `` has 55 functions (exceeds 20 allowed). Consider refactoring.
      Open

      Template.address.helpers({
        bech32() {
          return Session.equals('addressFormat', 'bech32')
        },
        address() {
      Severity: Major
      Found in imports/ui/components/address/address.js - About 7 hrs to fix

        File tx.js has 486 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* eslint no-console: 0 */
        import JSONFormatter from 'json-formatter-js'
        import './tx.html'
        import CryptoJS from 'crypto-js'
        import sha256 from 'sha256'
        Severity: Minor
        Found in imports/ui/components/tx/tx.js - About 7 hrs to fix

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

                  } else if (output.transaction.explorer.type === 'KEYBASE') {
                    thisTxn = {
                      type: output.transaction.explorer.type,
                      txhash: arr.txhash,
                      amount: 0,
          Severity: Major
          Found in imports/startup/server/index.js and 4 other locations - About 7 hrs to fix
          imports/startup/server/index.js on lines 1000..1070
          imports/startup/server/index.js on lines 1014..1070
          imports/startup/server/index.js on lines 1028..1070
          imports/startup/server/index.js on lines 1056..1070

          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 175.

          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 5 locations. Consider refactoring.
          Open

                  } else if (output.transaction.explorer.type === 'DOCUMENT_NOTARISATION') {
                    thisTxn = {
                      type: output.transaction.explorer.type,
                      txhash: arr.txhash,
                      amount: 0,
          Severity: Major
          Found in imports/startup/server/index.js and 4 other locations - About 7 hrs to fix
          imports/startup/server/index.js on lines 1000..1070
          imports/startup/server/index.js on lines 1014..1070
          imports/startup/server/index.js on lines 1028..1070
          imports/startup/server/index.js on lines 1042..1070

          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 175.

          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 5 locations. Consider refactoring.
          Open

                  } else if (output.transaction.tx.transactionType === 'latticePK') {
                    thisTxn = {
                      type: output.transaction.tx.transactionType,
                      txhash: arr.txhash,
                      amount: 0,
          Severity: Major
          Found in imports/startup/server/index.js and 4 other locations - About 7 hrs to fix
          imports/startup/server/index.js on lines 1000..1070
          imports/startup/server/index.js on lines 1028..1070
          imports/startup/server/index.js on lines 1042..1070
          imports/startup/server/index.js on lines 1056..1070

          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 175.

          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 5 locations. Consider refactoring.
          Open

                  } else if (output.transaction.tx.transactionType === 'slave') {
                    thisTxn = {
                      type: output.transaction.tx.transactionType,
                      txhash: arr.txhash,
                      amount: 0,
          Severity: Major
          Found in imports/startup/server/index.js and 4 other locations - About 7 hrs to fix
          imports/startup/server/index.js on lines 1014..1070
          imports/startup/server/index.js on lines 1028..1070
          imports/startup/server/index.js on lines 1042..1070
          imports/startup/server/index.js on lines 1056..1070

          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 175.

          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 5 locations. Consider refactoring.
          Open

                  } else if (output.transaction.explorer.type === 'MESSAGE') {
                    thisTxn = {
                      type: output.transaction.explorer.type,
                      txhash: arr.txhash,
                      amount: 0,
          Severity: Major
          Found in imports/startup/server/index.js and 4 other locations - About 7 hrs to fix
          imports/startup/server/index.js on lines 1000..1070
          imports/startup/server/index.js on lines 1014..1070
          imports/startup/server/index.js on lines 1042..1070
          imports/startup/server/index.js on lines 1056..1070

          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 175.

          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 addressTransactions has 168 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            addressTransactions(request) {
              check(request, Object)
              console.log(`addressTransactions method called for ${request.tx.length} transactions`)
              const targets = request.tx
              const result = []
          Severity: Major
          Found in imports/startup/server/index.js - About 6 hrs to fix

            `` has 43 functions (exceeds 20 allowed). Consider refactoring.
            Open

            Template.tx.helpers({
              hasMessage() {
                try {
                  if (this.tx.transfer.message_data.length > 0) {
                    return true
            Severity: Minor
            Found in imports/ui/components/tx/tx.js - About 5 hrs to fix

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

                knownProvider() {
                  const { id } = this.explorer.nft
                  const from = this.explorer.from_hex
                  let known = false
                  _.each(qrlNft.providers, (provider) => {
              Severity: Major
              Found in imports/ui/components/tx/tx.js and 1 other location - About 5 hrs to fix
              imports/ui/components/lasttx/lasttx.js on lines 77..91

              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 140.

              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

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

                knownProvider() {
                  const { id } = this.explorer.nft
                  const from = this.explorer.from_hex
                  let known = false
                  _.each(qrlNft.providers, (provider) => {
              Severity: Major
              Found in imports/ui/components/lasttx/lasttx.js and 1 other location - About 5 hrs to fix
              imports/ui/components/tx/tx.js on lines 326..340

              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 140.

              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

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

              const updateStyleSheet = (filename) => {
                const newstylesheet = `/${filename}.css`
                if ($('#dynamic_css').length === 0) {
                  $('head').append('<link>')
                  const css = $('head').children(':last')
              Severity: Major
              Found in imports/ui/mobile/mobile.js and 1 other location - About 5 hrs to fix
              imports/ui/layouts/body/body.js on lines 8..22

              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 136.

              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

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

              const updateStyleSheet = (filename) => {
                const newstylesheet = `/${filename}.css`
                if ($('#dynamic_css').length === 0) {
                  $('head').append('<link>')
                  const css = $('head').children(':last')
              Severity: Major
              Found in imports/ui/layouts/body/body.js and 1 other location - About 5 hrs to fix
              imports/ui/mobile/mobile.js on lines 5..19

              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 136.

              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

                providerURL() {
                  let id
                  if (this.token) {
                    id = this.token.nft.id
                  } else {
              Severity: Major
              Found in imports/ui/components/address/address.js and 1 other location - About 4 hrs to fix
              imports/ui/components/address/address.js on lines 444..458

              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 133.

              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

                providerName() {
                  let id
                  if (this.token) {
                    id = this.token.nft.id
                  } else {
              Severity: Major
              Found in imports/ui/components/address/address.js and 1 other location - About 4 hrs to fix
              imports/ui/components/address/address.js on lines 429..443

              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 133.

              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

              File cron.js has 355 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /* eslint max-len: 0 */
              /* global _ */
              import { HTTP } from 'meteor/http'
              import { JsonRoutes } from 'meteor/simple:json-routes'
              import { SHA512 } from 'jscrypto/es6'
              Severity: Minor
              Found in imports/startup/server/cron.js - About 4 hrs to fix
                Severity
                Category
                Status
                Source
                Language