BikBikBikBikBik/blocke

View on GitHub

Showing 5 of 5 total issues

File command-line-arg-data-source.js has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module.exports = {
    currencies: {
        aeon: {
            api: 'chainradar',
            currencyName: 'Aeon',
Severity: Minor
Found in lib/command-line-arg-data-source.js - About 2 hrs to fix

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

        generateDefinitions(includeAccount) {
            let definitions = [
                {
                    name: 'block',
                    alias: 'b',
    Severity: Minor
    Found in lib/command-line-arg-data-usage-generator.js - About 1 hr to fix

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

          generateUsage(options, includeAccount) {
              let usage = [
                  {
                      header: `blocke ${options.command}`,
                      content: `Query the ${options.currencyName} blockchain. If no option is specified blocke will search for the right type of the value.`
      Severity: Minor
      Found in lib/command-line-arg-data-usage-generator.js - About 1 hr to fix

        Function handleIndividualRequests has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            handleIndividualRequests(inputs, apiFunction, mapperFunction, objectName, showSpinner = true, resolveOnError = true) {
                const inputsIsArray = Array.isArray(inputs);
                const inputArray = inputsIsArray ? inputs : (typeof(inputs) === 'string' ? [inputs] : []);
                
                const inputPromises = _.map(inputArray, (input) =>
        Severity: Minor
        Found in lib/option-request-handler.js - About 55 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 getApi has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function getApi(symbol) {
            if (typeof(symbol) === 'string') {
                const formattedSymbol = symbol.trim().toLowerCase();
                if (commandLineArgDataSource.currencies.hasOwnProperty(formattedSymbol)) {
                    const api = require(`./${commandLineArgDataSource.currencies[formattedSymbol].api}`);     // eslint-disable-line global-require
        Severity: Minor
        Found in lib/api/factory.js - About 25 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