atsid/gcal-leave-scraper

View on GitHub

Showing 74 of 82 total issues

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

  renderDateSelector() {
    return (
        <DropDownMenu
          value={this.state.selectedRange}
          style={{margin: '5px', left: '25px'}}
Severity: Major
Found in client/components/timeline/TimelineToolbar.js and 1 other location - About 2 hrs to fix
client/components/timeline/TimelineToolbar.js on lines 233..242

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

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

  renderFilter() {
    return (
        <DropDownMenu
          value={this.state.selectedFilter}
          style={{margin: '5px', left: '25px'}}
Severity: Major
Found in client/components/timeline/TimelineToolbar.js and 1 other location - About 2 hrs to fix
client/components/timeline/TimelineToolbar.js on lines 244..253

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

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 utils.uniqueUsersInLeaveEventSet([createEvent(user1Id)]).then((result) => {
        expect(result.length).to.equal(1);
        expect(result[0].userId).to.equal('dummy1user1');
        expect(result[0].email).to.equal('dummy1.user1@example.com');
      });
server/components/CalendarUtils.uniqueUsersInLeaveEventSet.spec.js on lines 85..89

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

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 utils.uniqueUsersInLeaveEventSet([createEvent(user1Id), createEvent(user1Id)]).then((result) => {
        expect(result.length).to.equal(1);
        expect(result[0].userId).to.equal('dummy1user1');
        expect(result[0].email).to.equal('dummy1.user1@example.com');
      });
server/components/CalendarUtils.uniqueUsersInLeaveEventSet.spec.js on lines 77..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 85.

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

        <div
          className={this.props.events ? '' : 'loading'}
          style={this.getStyles()}>
          {this.renderTimelineMonths()}
          {this.renderTimelineToday()}
Severity: Major
Found in client/components/timeline/Heatmap.js and 1 other location - About 2 hrs to fix
client/components/timeline/EventView.js on lines 165..171

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

      <div
        className={this.state.events ? '' : 'loading'}
        style={this.getStyles()}>
        {this.renderTimelineMonths()}
        {this.renderTimelineToday()}
Severity: Major
Found in client/components/timeline/EventView.js and 1 other location - About 2 hrs to fix
client/components/timeline/Heatmap.js on lines 130..136

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

    it('range contains a weekend', (done) => {
      // Target month is December (zero-based).  12/10-12/15 === Thursday-Tuesday
      const result = utils.findWorkdaysInRange(createStartDate(2015, 12, 10), createEndDate(2015, 12, 15), utils.createMonthRange(11, 2015));

      expect(result).to.equal(4);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

    it('range starts and ends outside of the month', (done) => {
      // Target month is November (zero-based). Range starts in October and runs into December
      const result = utils.findWorkdaysInRange(createStartDate(2015, 10, 15), createEndDate(2015, 12, 5), utils.createMonthRange(10, 2015));

      expect(result).to.equal(21);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

    it('range is Saturday through Sunday', (done) => {
      // Target month is December (zero-based).  12/19 is Saturday, 12/20 is Sunday
      const result = utils.findWorkdaysInRange(createStartDate(2015, 12, 19), createEndDate(2015, 12, 20), utils.createMonthRange(11, 2015));

      expect(result).to.equal(0);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

    it('short range contains a weekend', (done) => {
      // Target month is December (zero-based).  12/11-12/14 === Friday-Monday
      const result = utils.findWorkdaysInRange(createStartDate(2015, 12, 11), createEndDate(2015, 12, 14), utils.createMonthRange(11, 2015));

      expect(result).to.equal(2);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

    it('range starts outside the month', (done) => {
      // Target month is November (zero-based).  Starts in October and ends in early November
      const result = utils.findWorkdaysInRange(createStartDate(2015, 10, 31), createEndDate(2015, 11, 3), utils.createMonthRange(10, 2015));

      expect(result).to.equal(2);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

    it('returns zero when the range is outside the target expected month', (done) => {
      // Target month is November (zero-based).  Date range is outside the target month
      const result = utils.findWorkdaysInRange(createStartDate(2015, 12, 14), createEndDate(2015, 12, 17), utils.createMonthRange(10, 2015));

      expect(result).to.equal(0);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

    it('range is one working day', (done) => {
      // Target month is December (zero-based).
      const result = utils.findWorkdaysInRange(createStartDate(2015, 12, 10), createEndDate(2015, 12, 10), utils.createMonthRange(11, 2015));

      expect(result).to.equal(1);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

    it('range is one Saturday', (done) => {
      // Target month is December (zero-based).  12/19 is Saturday
      const result = utils.findWorkdaysInRange(createStartDate(2015, 12, 19), createEndDate(2015, 12, 19), utils.createMonthRange(11, 2015));

      expect(result).to.equal(0);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

    it('range is the entire month', (done) => {
      // Target month is November (zero-based). 11/1 is Sunday and 11/30 is Monday
      const result = utils.findWorkdaysInRange(createStartDate(2015, 11, 1), createEndDate(2015, 11, 30), utils.createMonthRange(10, 2015));

      expect(result).to.equal(21);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

    it('range is one Sunday', (done) => {
      // Target month is December (zero-based).  12/20 is Sunday
      const result = utils.findWorkdaysInRange(createStartDate(2015, 12, 20), createEndDate(2015, 12, 20), utils.createMonthRange(11, 2015));

      expect(result).to.equal(0);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

    it('range is 15 days / 11 working days', (done) => {
      // Target month is December (zero-based).  12/1 and 12/15 are Tuesdays
      const result = utils.findWorkdaysInRange(createStartDate(2015, 12, 1), createEndDate(2015, 12, 15), utils.createMonthRange(11, 2015));

      expect(result).to.equal(11);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

    it('range ends outside the month', (done) => {
      // Target month is November (zero-based). Starts in late November and ends in September
      const result = utils.findWorkdaysInRange(createStartDate(2015, 11, 26), createEndDate(2015, 12, 3), utils.createMonthRange(10, 2015));

      expect(result).to.equal(3);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 88..95
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131

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

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

    it('range is 8 days / 6 working days', (done) => {
      // Target month is December (zero-based).
      const result = utils.findWorkdaysInRange(createStartDate(2015, 12, 15), createEndDate(2015, 12, 22), utils.createMonthRange(11, 2015));

      expect(result).to.equal(6);
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 25..32
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 34..41
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 43..50
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 52..59
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 61..68
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 70..77
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 79..86
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 97..104
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 106..113
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 115..122
server/components/CalendarUtils.findWorkdaysInRange.spec.js on lines 124..131
server/components/CalendarUtils.findWorkdaysInRange.spec.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 79.

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

  renderTimelineToday() {
    let styles;
    styles = this.getEventStyles(0, new Date().getDate() - 1, 'rgb(243, 164, 164)');
    styles.zIndex = '100';
    return (<div
Severity: Major
Found in client/components/timeline/Heatmap.js and 1 other location - About 2 hrs to fix
client/components/timeline/EventView.js on lines 151..158

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

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

Severity
Category
Status
Source
Language