TOTVSTEC/cloudbridge-cli

View on GitHub

Showing 179 of 179 total issues

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

        if (advplChoices.length > 0) {
            choices.push(this.createSeparator('AdvPL Components', line));
            choices = choices.concat(advplChoices);
        }
Severity: Major
Found in src/tasks/default/update.js and 2 other locations - About 45 mins to fix
src/tasks/default/update.js on lines 130..133
src/tasks/default/update.js on lines 135..138

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

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

        if (platformChoices.length > 0) {
            choices.push(this.createSeparator('Platforms', line));
            choices = choices.concat(platformChoices);
        }
Severity: Major
Found in src/tasks/default/update.js and 2 other locations - About 45 mins to fix
src/tasks/default/update.js on lines 135..138
src/tasks/default/update.js on lines 140..143

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

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 (!this.options.silent)
                        console.log('\nThe advpl component ' + name.bold + ' has been updated to version ' + version.bold + '!');
Severity: Minor
Found in src/tasks/default/advpl-update.js and 1 other location - About 40 mins to fix
src/tasks/default/bower-update.js on lines 33..34

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

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 (!this.options.silent)
                        console.log('\nThe bower package ' + name.bold + ' has been updated to version ' + version.bold + '!');
Severity: Minor
Found in src/tasks/default/bower-update.js and 1 other location - About 40 mins to fix
src/tasks/default/advpl-update.js on lines 80..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 49.

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

        return promise
            .then(() => {
                return checker.check_java();
            })
            .then((javaVersion) => {
Severity: Minor
Found in src/tasks/default/build-android.js and 1 other location - About 40 mins to fix
src/tasks/default/build-ios.js on lines 31..50

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

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

        return promise
            .then(() => {
                if (forceClean)
                    return this.clean();
            })
Severity: Minor
Found in src/tasks/default/build-ios.js and 1 other location - About 40 mins to fix
src/tasks/default/build-android.js on lines 36..74

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

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

Cli.printAvailableTasks = function printAvailableTasks(argv) {
    Cli.printCloudBridge();
    process.stderr.write('\nUsage: cloudbridge task args\n\n=======================\n\n');

    if (process.argv.length > 2) {
Severity: Minor
Found in src/cli.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 printAvailableTasks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    static printAvailableTasks(argv) {
        this.printBanner();

        process.stderr.write('\nUsage: cloudbridge task args\n\n=======================\n\n');

Severity: Minor
Found in src/help.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 getEngine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

Cli.getEngine = function getEngine(argv) {
    var engine = 'default',
        projectFile = path.join(this.cwd, 'cloudbridge.json');

    if (fs.existsSync(projectFile)) {
Severity: Minor
Found in src/cli.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 printInfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

Info.printInfo = function printInfo(info) {
    logging.logger.info('\nYour system information:\n'.bold);

    if (info.gulp) {
        logging.logger.info('Gulp version:', info.gulp);
Severity: Minor
Found in src/utils/info.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 modifier has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    static modifier(range) {
        if (typeof range === 'string') {
            var modifier = range.trim();

            if (modifier.length > 0) {
Severity: Minor
Found in src/utils/semver.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 constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    constructor(name, group, version) {
        if (typeof name === 'object') {
            var options = name;

            this.name = options.name;
Severity: Minor
Found in src/utils/package.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

Avoid too many return statements within this function.
Open

        return this.utils.fail(ex);
Severity: Major
Found in src/cli.js - About 30 mins to fix

    Function run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        run(cloudbridge, argv) {
            try {
                var isAddCmd = argv._.indexOf('add') !== -1;
                var isRmCmd = argv._.indexOf('rm') !== -1 || argv._.indexOf('remove') !== -1;
                var isUpdateCmd = argv._.indexOf('up') !== -1 || argv._.indexOf('update') !== -1;
    Severity: Minor
    Found in src/tasks/default/platform.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

    Function run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        run(cloudbridge, argv) {
            try {
                var isAddCmd = argv._.indexOf('add') !== -1;
                var isRmCmd = argv._.indexOf('rm') !== -1 || argv._.indexOf('remove') !== -1;
                var isUpdateCmd = argv._.indexOf('up') !== -1 || argv._.indexOf('update') !== -1;
    Severity: Minor
    Found in src/tasks/ionic/platform.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

    Function run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        run(cloudbridge, argv) {
            if (argv.list || argv.l) {
                var listTask = new StartListTask(this.options);
    
                return listTask.run(cloudbridge);
    Severity: Minor
    Found in src/tasks/default/start.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

    Function createChoices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        createChoices(packageType, longest) {
            var choices = [],
                packages = this.packages[packageType];
    
            if (!Array.isArray(packages)) {
    Severity: Minor
    Found in src/tasks/default/update.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

    Function run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        run(cloudbridge, argv) {
            try {
                var isAddCmd = argv._.indexOf('add') !== -1;
                var isRmCmd = argv._.indexOf('rm') !== -1 || argv._.indexOf('remove') !== -1;
                var isUpdateCmd = argv._.indexOf('up') !== -1 || argv._.indexOf('update') !== -1;
    Severity: Minor
    Found in src/tasks/cordova/platform.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

    Function run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        run(cloudbridge, argv) {
            let cleanFiles = [];
    
            if (argv.clean || argv.c) {
                cleanFiles = Object.keys(fileUtils.loadModifiedTime(this.projectDir, ADVPL_SRC_RELATIVE));
    Severity: Minor
    Found in src/tasks/default/advpl-compile.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