DataEasy/slack-cutter

View on GitHub

Showing 22 of 22 total issues

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

        describe('CI', () => {
            describe('GET /slashCommands/ci', () => {
                it('should be passed at least one argument', done => {
                    api.get('/slashCommands/ci')
                        .query({
Severity: Major
Found in test/api-test.js and 1 other location - About 1 day to fix
test/api-test.js on lines 76..108

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

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

        describe('Extension Numbers', () => {
            describe('GET /slashCommands/ext', () => {
                it('should return all extension numbers when invoked with no args', done => {
                    api.get('/slashCommands/ext')
                        .query({
Severity: Major
Found in test/api-test.js and 1 other location - About 1 day to fix
test/api-test.js on lines 110..142

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

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

    it('should use custom formatters if present', done => {
        const formatterSpy = sandbox.spy(CustomFormatter, 'docflow');

        const dummyReq = (options, callback) => {
            callback(null, {}, sampleGithubResponse);
Severity: Major
Found in test/slash-commands/prs-test.js and 1 other location - About 3 hrs to fix
test/slash-commands/prs-test.js on lines 63..76

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

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

    it('should use the default formatter if no custom formatter for that repo', done => {
        const formatterSpy = sandbox.spy(CustomFormatter, 'defaultFormatter');

        const dummyReq = (options, callback) => {
            callback(null, {}, sampleGithubResponse);
Severity: Major
Found in test/slash-commands/prs-test.js and 1 other location - About 3 hrs to fix
test/slash-commands/prs-test.js on lines 78..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 112.

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

        extCommand.find(result => {
            const lineBreaksMatch = result.match(/\n/g);
            expect(lineBreaksMatch)
            .to.be.an('array')
            .and.to.have.length(Object.keys(parsedJsonExtensions.extensions).length + 1);
Severity: Major
Found in test/slash-commands/ext-test.js and 1 other location - About 2 hrs to fix
test/slash-commands/ext-test.js on lines 64..71

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

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

        extCommand.find('  \t', result => {
            const lineBreaksMatch = result.match(/\n/g);
            expect(lineBreaksMatch)
                .to.be.an('array')
                .and.to.have.length(Object.keys(parsedJsonExtensions.extensions).length + 1);
Severity: Major
Found in test/slash-commands/ext-test.js and 1 other location - About 2 hrs to fix
test/slash-commands/ext-test.js on lines 53..60

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

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

        it('should bork on an unknown job name', done => {
            ciCommand.runTask(['unknown-job', 'myProduct', '4.8.0'], err => {
                expect(err).not.to.be.null;
                expect(err.message).to.equal('Unknown job for `myProduct`: `unknown-job`');

Severity: Major
Found in test/slash-commands/ci-test.js and 1 other location - About 2 hrs to fix
test/slash-commands/ci-test.js on lines 133..140

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

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

        it('should bork on an unknown product name', done => {
            ciCommand.runTask(['release', 'unknown-app', '4.8.0'], err => {
                expect(err).not.to.be.null;
                expect(err.message).to.equal('Unknown product: `unknown-app`');

Severity: Major
Found in test/slash-commands/ci-test.js and 1 other location - About 2 hrs to fix
test/slash-commands/ci-test.js on lines 142..149

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

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

    it('should list all open PRs by default', done => {
        const dummyReq = options => {
            expect(options.url).to.contain('state=open');
            done();
        };
Severity: Major
Found in test/slash-commands/prs-test.js and 1 other location - About 2 hrs to fix
test/slash-commands/prs-test.js on lines 103..111

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

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

    it('should query github\'s URL based on the first argument', done => {
        const dummyReq = options => {
            expect(options.url).to.contain('github.com/repos/dataeasy/docflow/');
            done();
        };
Severity: Major
Found in test/slash-commands/prs-test.js and 1 other location - About 2 hrs to fix
test/slash-commands/prs-test.js on lines 93..101

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

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

    parseArgs(args) {
        if (!args || !args.length || args.length === 0) {
            return new Error('At least one argument is necessary');
        }
        if (args.length > 3 || args.length === 2) {
Severity: Minor
Found in lib/slash-commands/ci/ci.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 listPrs has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    listPrs(repository, callback) {
        if (arguments.length <= 1) {
            throw new Error('At least one argument must be passed');
        }

Severity: Minor
Found in lib/slash-commands/prs/prs.js - About 1 hr to fix

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

                ciCommand.runTask(['http://my-ci-server.com?my-custom-args=true'], err => {
                    expect(err).to.be.null;
                    expect(sendSimpleMessageStub).to.have.been.called;
    
                    done();
    Severity: Major
    Found in test/slash-commands/ci-test.js and 1 other location - About 1 hr to fix
    test/slash-commands/ci-test.js on lines 81..86

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

    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

                ciCommand.runTask(['http://my-ci-server.com?my-custom-args=true'], err => {
                    expect(err).to.be.null;
                    expect(httpGetStub).to.have.been.calledOnce;
    
                    done();
    Severity: Major
    Found in test/slash-commands/ci-test.js and 1 other location - About 1 hr to fix
    test/slash-commands/ci-test.js on lines 101..106

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

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

    const formatLabels = prLabels => {
        const okMark = ':white_check_mark:';
        const notOkMark = ':x:';
        let out = '';
    
    
    Severity: Minor
    Found in lib/slash-commands/prs/custom-formatter.js - About 1 hr to fix

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

          parseArgs(args) {
              if (!args || !args.length || args.length === 0) {
                  return new Error('At least one argument is necessary');
              }
              if (args.length > 3 || args.length === 2) {
      Severity: Minor
      Found in lib/slash-commands/ci/ci.js - About 1 hr to fix

        Function formatLabels has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        const formatLabels = prLabels => {
            const okMark = ':white_check_mark:';
            const notOkMark = ':x:';
            let out = '';
        
        
        Severity: Minor
        Found in lib/slash-commands/prs/custom-formatter.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

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

            it('should find items through aliases', done => {
                extCommand.find('gardenio', result => {
                    expect(result).to.contain('rodrigues');
        
                    done();
        Severity: Major
        Found in test/slash-commands/ext-test.js and 1 other location - About 1 hr to fix
        test/slash-commands/ext-test.js on lines 74..80

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

        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

            it('should return "[Nenhum ramal encontrado]" for when no results are found', done => {
                extCommand.find('jacksonfive', result => {
                    expect(result).to.contain('[Nenhum ramal encontrado]');
        
                    done();
        Severity: Major
        Found in test/slash-commands/ext-test.js and 1 other location - About 1 hr to fix
        test/slash-commands/ext-test.js on lines 82..88

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

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

            find() {
                let searchString;
                let callback = arguments[0];
        
                if (arguments.length === 2) {
        Severity: Minor
        Found in lib/slash-commands/ext/ext.js - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language