theQRL/block-explorer

View on GitHub

Showing 51 of 158 total issues

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

  txhash(txId) {
    check(txId, String)
    console.log(`txhash method called for: ${txId}`)
    // avoid blocking other method calls from same client - *may need to remove for production*
    this.unblock()
Severity: Minor
Found in imports/startup/server/index.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 refreshBlocks has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const refreshBlocks = () => {
  const request = { filter: 'BLOCKHEADERS', offset: 0, quantity: 10 }
  const response = Meteor.wrapAsync(getLatestData)(request)

  // identify miner and calculate total transacted in block
Severity: Minor
Found in imports/startup/server/cron.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 refreshLasttx has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function refreshLasttx() {
  // First get confirmed transactions
  const confirmed = Meteor.wrapAsync(getLatestData)({ filter: 'TRANSACTIONS', offset: 0, quantity: 10 })

  // Now get unconfirmed transactions
Severity: Minor
Found in imports/startup/server/cron.js - About 1 hr to fix

    Function getMultiSigAddressState has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const getMultiSigAddressState = (request, callback) => {
      try {
        qrlApi('GetMultiSigAddressState', request, (error, response) => {
          if (error) {
            const myError = errorCallback(error, 'Cannot access API/GetMultiSigAddressState', '**ERROR/getMultiSigAddressState** ')
    Severity: Minor
    Found in imports/startup/server/index.js - About 1 hr to fix

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

        addressTransactions() {
          try {
            const transactions = []
            const thisAddress = rawAddressToB32Address(
              Session.get('address').state.address
      Severity: Minor
      Found in imports/ui/components/address/address.js - About 1 hr to fix

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

        const loadGrpcClient = (endpoint, callback) => {
          // Load qrlbase.proto and fetch current qrl.proto from node
          const options = {
            keepCase: true,
            longs: String,
        Severity: Minor
        Found in imports/startup/server/index.js - About 1 hr to fix

          Function renderTxBlock has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const renderTxBlock = () => {
            const txId = FlowRouter.getParam('txId')
            if (txId) {
              Meteor.call('txhash', txId, (err, res) => {
                if (err) {
          Severity: Minor
          Found in imports/ui/components/tx/tx.js - About 1 hr to fix

            Function click .themeToggle has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              'click .themeToggle': () => {
                try {
                  const x = LocalStore.get('theme')
                  if (x === 'dark') {
                    LocalStore.set('theme', 'light')
            Severity: Minor
            Found in imports/ui/layouts/body/body.js - About 1 hr to fix

              Function txhash has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                txhash(txId) {
                  check(txId, String)
                  console.log(`txhash method called for: ${txId}`)
                  // avoid blocking other method calls from same client - *may need to remove for production*
                  this.unblock()
              Severity: Minor
              Found in imports/startup/server/index.js - About 1 hr to fix

                Function click .pagination has a Cognitive Complexity of 10 (exceeds 5 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

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

                    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

                        Avoid deeply nested control flow statements.
                        Open

                                      while (pages.length !== numPages) {
                                        pages.push({
                                          number: pages.length + 1,
                                          from: ((pages.length + 1) * 10) + 1,
                                          to: ((pages.length + 1) * 10) + 10,
                        Severity: Major
                        Found in imports/ui/components/address/address.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                      if (!(res.state.address)) {
                                        res.state.address = aId
                                      }
                          Severity: Major
                          Found in imports/ui/components/address/address.js - About 45 mins to fix

                            Function getFullAddressState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const getFullAddressState = (request, callback) => {
                              try {
                                qrlApi('GetAddressState', request, (error, response) => {
                                  if (error) {
                                    const myError = errorCallback(error, 'Cannot access API/GetOptimizedAddressState', '**ERROR/getAddressState** ')
                            Severity: Minor
                            Found in imports/startup/server/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 renderAddressBlock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const renderAddressBlock = () => {
                              const aId = upperCaseFirst(FlowRouter.getParam('aId'))
                              let tPage = FlowRouter.getParam('tPage')
                              tPage = parseInt(tPage, 10)
                              if (!tPage) { tPage = 1 }
                            Severity: Minor
                            Found in imports/ui/components/address/address.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

                            Severity
                            Category
                            Status
                            Source
                            Language