theQRL/block-explorer

View on GitHub

Showing 158 of 158 total issues

Function loadAddressTransactions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function loadAddressTransactions(aId, page) {
  Session.set('addressTransactions', [])
  $('#loadingTransactions').show()
  // console.log('Getting transactions for page ', page)
  const addresstx = anyAddressToRaw(aId)
Severity: Minor
Found in imports/ui/components/address/address.js - About 1 hr to fix

    Function click .pagination has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      'click .pagination': (event) => {
        let b = 0
        Session.set('addressTransactions', {})
        if (parseInt(event.target.text, 10)) {
          b = parseInt(event.target.text, 10)
    Severity: Minor
    Found in imports/ui/components/address/address.js - About 1 hr to fix

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

                    nft = {
                      type: 'TRANSFER NFT',
                      id: Buffer.from(idBytes).toString('hex'),
                      hash: Buffer.from(cryptoHashBytes).toString('hex'),
                    }
      Severity: Major
      Found in imports/startup/server/index.js and 2 other locations - About 1 hr to fix
      imports/startup/server/index.js on lines 825..829
      imports/startup/server/index.js on lines 939..943

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

      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

        blockSize() {
          try {
            const bytes = Session.get('block').block.size
            return formatBytes(bytes)
          } catch (e) {
      Severity: Major
      Found in imports/ui/components/block/block.js and 1 other location - About 1 hr to fix
      imports/ui/components/tx/tx.js on lines 121..128

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

      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

        txSize() {
          try {
            const bytes = Session.get('txhash').transaction.size
            return formatBytes(bytes)
          } catch (e) {
      Severity: Major
      Found in imports/ui/components/tx/tx.js and 1 other location - About 1 hr to fix
      imports/ui/components/block/block.js on lines 35..42

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

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

                    nft = {
                      type: 'CREATE NFT',
                      id: Buffer.from(idBytes).toString('hex'),
                      hash: Buffer.from(cryptoHashBytes).toString('hex'),
                    }
      Severity: Major
      Found in imports/startup/server/index.js and 2 other locations - About 1 hr to fix
      imports/startup/server/index.js on lines 878..882
      imports/startup/server/index.js on lines 939..943

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

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

                  nft = {
                    type: 'CREATE NFT',
                    id: Buffer.from(idBytes).toString('hex'),
                    hash: Buffer.from(cryptoHashBytes).toString('hex'),
                  }
      Severity: Major
      Found in imports/startup/server/index.js and 2 other locations - About 1 hr to fix
      imports/startup/server/index.js on lines 825..829
      imports/startup/server/index.js on lines 878..882

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

      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

              if (response.state.creation_tx_hash) {
                response.state.creation_tx_hash = Buffer.from(response.state.creation_tx_hash).toString('hex')
              }
      Severity: Major
      Found in imports/startup/server/index.js and 4 other locations - About 55 mins to fix
      imports/startup/server/index.js on lines 416..418
      imports/startup/server/index.js on lines 419..421
      imports/startup/server/index.js on lines 422..424
      imports/startup/server/index.js on lines 425..427

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

      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

          if (tx.tx.public_key) {
            txEdited.tx.public_key = Buffer.from(txEdited.tx.public_key).toString('hex')
          }
      Severity: Major
      Found in imports/startup/server/index.js and 4 other locations - About 55 mins to fix
      imports/startup/server/index.js on lines 416..418
      imports/startup/server/index.js on lines 419..421
      imports/startup/server/index.js on lines 425..427
      imports/startup/server/index.js on lines 520..522

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

      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

          if (tx.tx.transaction_hash) {
            txEdited.tx.transaction_hash = Buffer.from(txEdited.tx.transaction_hash).toString('hex')
          }
      Severity: Major
      Found in imports/startup/server/index.js and 4 other locations - About 55 mins to fix
      imports/startup/server/index.js on lines 419..421
      imports/startup/server/index.js on lines 422..424
      imports/startup/server/index.js on lines 425..427
      imports/startup/server/index.js on lines 520..522

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

      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

        isCreateNFT() {
          try {
            if (this.token.nft.type === 'CREATE NFT') {
              return true
            }
      Severity: Minor
      Found in imports/ui/components/address/address.js and 1 other location - About 55 mins to fix
      imports/ui/components/address/address.js on lines 381..390

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

      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

        isNFTTransfer() {
          try {
            if (this.transfer_token.nft.type === 'TRANSFER NFT') {
              return true
            }
      Severity: Minor
      Found in imports/ui/components/address/address.js and 1 other location - About 55 mins to fix
      imports/ui/components/address/address.js on lines 365..374

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

      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

          Meteor.call('QRLvalue', (err, res) => {
            if (err) {
              Session.set('qrl', 'Error getting value from API')
            } else {
              Session.set('qrl', res)
      Severity: Minor
      Found in imports/ui/components/tx/tx.js and 1 other location - About 55 mins to fix
      imports/ui/components/address/address.js on lines 333..339

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

      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

          if (tx.tx.master_addr) {
            txEdited.tx.master_addr = Buffer.from(txEdited.tx.master_addr).toString('hex')
          }
      Severity: Major
      Found in imports/startup/server/index.js and 4 other locations - About 55 mins to fix
      imports/startup/server/index.js on lines 416..418
      imports/startup/server/index.js on lines 422..424
      imports/startup/server/index.js on lines 425..427
      imports/startup/server/index.js on lines 520..522

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

      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

        Meteor.call('QRLvalue', (err, res) => {
          if (err) {
            Session.set('qrl', 'Error getting value from API')
          } else {
            Session.set('qrl', res)
      Severity: Minor
      Found in imports/ui/components/address/address.js and 1 other location - About 55 mins to fix
      imports/ui/components/tx/tx.js on lines 29..35

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

      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

          if (tx.tx.signature) {
            txEdited.tx.signature = Buffer.from(txEdited.tx.signature).toString('hex')
          }
      Severity: Major
      Found in imports/startup/server/index.js and 4 other locations - About 55 mins to fix
      imports/startup/server/index.js on lines 416..418
      imports/startup/server/index.js on lines 419..421
      imports/startup/server/index.js on lines 422..424
      imports/startup/server/index.js on lines 520..522

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

      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 pages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        pages() {
          let ret = []
          const active = Session.get('active')
          if (Session.get('pages').length > 0) {
            ret = Session.get('pages')
      Severity: Minor
      Found in imports/ui/components/address/address.js - 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 getAddressState has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const getAddressState = (request, callback) => {
        try {
          qrlApi('GetOptimizedAddressState', request, (error, response) => {
            if (error || response.state === null) {
              const myError = errorCallback(
      Severity: Minor
      Found in imports/startup/server/index.js - 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

      Avoid deeply nested control flow statements.
      Open

                      if (symbol.slice(0, 8) === '00ff00ff') {
                        const nftBytes = Buffer.concat([
                          Buffer.from(tokenDetails.symbol),
                          Buffer.from(tokenDetails.name),
                        ])
      Severity: Major
      Found in imports/ui/components/address/address.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if (parseInt(res.state.txcount, 10) === 0 && parseInt(res.state.nonce, 10) === 0) {
                      res.state.empty_warning = true
                    } else {
                      res.state.empty_warning = false
                    }
        Severity: Major
        Found in imports/ui/components/address/address.js - About 45 mins to fix
          Severity
          Category
          Status
          Source
          Language