alexzherdev/foosballtracker

View on GitHub

Showing 72 of 77 total issues

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

    it('returns opponents for 2v2', function(done) {
      request(app)
        .get(`/api/teams/${this.france.id}/opponents`)
        .end((err, res) => {
          let body = res.body;
Severity: Major
Found in src/api/spec/controllers/teamsSpec.js and 1 other location - About 6 hrs to fix
src/api/spec/controllers/teamsSpec.js on lines 31..42

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

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('returns opponents for 1v1', function(done) {
      request(app)
        .get(`/api/teams/${this.teamZidane.id}/opponents`)
        .end((err, res) => {
          let body = res.body;
Severity: Major
Found in src/api/spec/controllers/teamsSpec.js and 1 other location - About 6 hrs to fix
src/api/spec/controllers/teamsSpec.js on lines 44..55

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

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

    it('returns 1v1 stats', function(done) {
      stats.then(({ onevone }) => {
        expect(onevone.matchesPlayed).toEqual(7);
        expect(onevone.bestWinRate.rate).toEqual(1);
        expect(onevone.bestWinRate.name).toEqual(this.teamPele.get('name'));
Severity: Major
Found in src/api/spec/models/statsSpec.js and 2 other locations - About 4 hrs to fix
src/api/spec/models/statsSpec.js on lines 23..30
src/api/spec/models/statsSpec.js on lines 32..39

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

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

    it('returns overall stats', function(done) {
      stats.then(({ overall }) => {
        expect(overall.matchesPlayed).toEqual(12);
        expect(overall.bestWinRate.rate).toEqual(1);
        expect(overall.bestWinRate.name).toEqual(this.teamPele.get('name'));
Severity: Major
Found in src/api/spec/models/statsSpec.js and 2 other locations - About 4 hrs to fix
src/api/spec/models/statsSpec.js on lines 32..39
src/api/spec/models/statsSpec.js on lines 41..48

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

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

    it('returns 2v2 stats', function(done) {
      stats.then(({ twovtwo }) => {
        expect(twovtwo.matchesPlayed).toEqual(5);
        expect(twovtwo.bestWinRate.rate).toEqual(1);
        expect(twovtwo.bestWinRate.name).toEqual(this.germany.get('name'));
Severity: Major
Found in src/api/spec/models/statsSpec.js and 2 other locations - About 4 hrs to fix
src/api/spec/models/statsSpec.js on lines 23..30
src/api/spec/models/statsSpec.js on lines 41..48

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

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

  let h2h = () => {
    let teamClasses = (attr, direction) => {
      let teamValue = stats.stats[attr];
      let oppValue = h2hStats.stats[attr];
      let classes;
Severity: Major
Found in src/js/components/teamStats/headToHead.js - About 3 hrs to fix

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

    it('fetches opponents for 1v1', function(done) {
      this.teamBuffon.fetchOpponents().then((opps) => {
        verifyOpponents(opps, 8, [
          { name: 'Paolo Maldini', played: 2 },
          { name: 'Pele', played: 1 },
Severity: Major
Found in src/api/spec/models/teamSpec.js and 1 other location - About 2 hrs to fix
src/api/spec/models/teamSpec.js on lines 103..112

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

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('fetches opponents for 2v2', function(done) {
      this.france.fetchOpponents().then((opps) => {
        verifyOpponents(opps, 3, [
          { name: 'Gianluigi Buffon & Paolo Maldini', played: 3 },
          { name: 'Pele & Ronaldo', played: 1 },
Severity: Major
Found in src/api/spec/models/teamSpec.js and 1 other location - About 2 hrs to fix
src/api/spec/models/teamSpec.js on lines 92..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 94.

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

const TeamHeadToHead = ({stats, teams, onTeamSelect, h2hStats, h2hMatches}) => {
  const teamId = stats.team.id;

  let h2h = () => {
    let teamClasses = (attr, direction) => {
Severity: Minor
Found in src/js/components/teamStats/headToHead.js - About 2 hrs 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

      request(app)
        .get(`/api/stats/${this.france.id}`)
        .end((err, res) => {
          let body = res.body;
          expect(body.team).toBeDefined();
Severity: Major
Found in src/api/spec/controllers/statsSpec.js and 1 other location - About 2 hrs to fix
src/api/spec/controllers/statsSpec.js on lines 30..38

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

      request(app)
        .get('/api/stats/summary')
        .end((err, res) => {
          let body = res.body;
          expect(body.overall).toBeDefined();
Severity: Major
Found in src/api/spec/controllers/statsSpec.js and 1 other location - About 2 hrs to fix
src/api/spec/controllers/statsSpec.js on lines 44..52

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

            <tr>
              <td>Won</td>
              <td className={classes[0]}>{won}</td>
              <td className={classes[1]}>{lost}</td>
            </tr>
Severity: Major
Found in src/js/components/teamStats/headToHead.js and 1 other location - About 2 hrs to fix
src/js/components/teamStats/headToHead.js on lines 79..83

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

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

            <tr>
              <td>Lost</td>
              <td className={classes[0]}>{lost}</td>
              <td className={classes[1]}>{won}</td>
            </tr>
Severity: Major
Found in src/js/components/teamStats/headToHead.js and 1 other location - About 2 hrs to fix
src/js/components/teamStats/headToHead.js on lines 74..78

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

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

  getScores() {
    request.get(`${this.baseUrl()}/matches`)
      .end((err, res) => {
        handleResponse(err, res, (err, res) => {
          ScoreActions.loadScoresResponse(res);
Severity: Major
Found in src/js/apiClient.js and 1 other location - About 2 hrs to fix
src/js/apiClient.js on lines 73..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 77.

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

  getTeams() {
    request.get(`${this.baseUrl()}/teams`)
      .end((err, res) => {
        handleResponse(err, res, (err, res) => {
          TeamActions.loadTeamsResponse(res);
Severity: Major
Found in src/js/apiClient.js and 1 other location - About 2 hrs to fix
src/js/apiClient.js on lines 43..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 77.

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

let _getTeamStats = (teamId) => {
  let extractCurrentStreak = (form) => {
    let match = form.match(/^W+/)
    if (match) {
      return { wins: match[0].length };
Severity: Minor
Found in src/api/models/stats.js - About 1 hr to fix

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

          <div role="tabpanel" className="tab-pane" id="onevone">
            <StatsDetails stats={this.props.stats && this.props.stats.onevone} />
          </div>
Severity: Major
Found in src/js/containers/StatsContainer.js and 4 other locations - About 1 hr to fix
src/js/containers/HomeContainer.js on lines 31..33
src/js/containers/HomeContainer.js on lines 34..36
src/js/containers/HomeContainer.js on lines 37..39
src/js/containers/StatsContainer.js on lines 30..32

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

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

          <div role="tabpanel" className="tab-pane" id="overall">
            <StatsSummary stats={this.props.statsSummary && this.props.statsSummary.overall} />
          </div>
Severity: Major
Found in src/js/containers/HomeContainer.js and 4 other locations - About 1 hr to fix
src/js/containers/HomeContainer.js on lines 31..33
src/js/containers/HomeContainer.js on lines 34..36
src/js/containers/StatsContainer.js on lines 30..32
src/js/containers/StatsContainer.js on lines 33..35

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

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

          <div role="tabpanel" className="tab-pane active" id="twovtwo">
            <StatsDetails stats={this.props.stats && this.props.stats.twovtwo} />
          </div>
Severity: Major
Found in src/js/containers/StatsContainer.js and 4 other locations - About 1 hr to fix
src/js/containers/HomeContainer.js on lines 31..33
src/js/containers/HomeContainer.js on lines 34..36
src/js/containers/HomeContainer.js on lines 37..39
src/js/containers/StatsContainer.js on lines 33..35

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

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

          <div role="tabpanel" className="tab-pane active" id="twovtwo">
            <StatsSummary stats={this.props.statsSummary && this.props.statsSummary.twovtwo} />
          </div>
Severity: Major
Found in src/js/containers/HomeContainer.js and 4 other locations - About 1 hr to fix
src/js/containers/HomeContainer.js on lines 34..36
src/js/containers/HomeContainer.js on lines 37..39
src/js/containers/StatsContainer.js on lines 30..32
src/js/containers/StatsContainer.js on lines 33..35

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

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