java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java

Summary

Maintainability
F
2 wks
Test Coverage
F
41%

Method run has a Cognitive Complexity of 570 (exceeds 20 allowed). Consider refactoring.
Open

    @Override
    public void run() {
        File file = getFile();
        if (file == null) {
            return;

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

Method run has 755 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public void run() {
        File file = getFile();
        if (file == null) {
            return;
Severity: Major
Found in java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java - About 3 days to fix

    File ImportCars.java has 827 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    package jmri.jmrit.operations.rollingstock.cars.tools;
    
    import java.io.*;
    
    import jmri.IdTagManager;

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

                      if (!comma) {
                          int j = 0;
                          StringBuffer name = new StringBuffer(carLocationName);
                          for (int i = base + CAR_LOCATION_TRACK_SEPARATOR; i < inputLine.length; i++) {
                              if (inputLine[i].equals(LOCATION_TRACK_SEPARATOR)) {
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 277..300

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

      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

                      try {
                          if (carRoad.split(TrainCommon.HYPHEN)[0].length() > Control.max_len_string_attibute) {
                              JmriJOptionPane.showMessageDialog(null, Bundle.getMessage("CarRoadNameTooLong",
                                      carRoad, carNumber, carRoad),
                                      Bundle.getMessage("carAttribute",
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 274..290

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

      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

                      try {
                          if (carType.split(TrainCommon.HYPHEN)[0].length() > Control.max_len_string_attibute) {
                              JmriJOptionPane.showMessageDialog(null, Bundle.getMessage("CarTypeNameTooLong",
                                      carRoad, carNumber, carType),
                                      Bundle.getMessage("carAttribute",
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 257..273

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (comma && inputLine.length > CAR_FINAL_DESTINATION) {
                          Location finalDestination =
                                  InstanceManager.getDefault(LocationManager.class)
                                          .getLocationByName(inputLine[CAR_FINAL_DESTINATION]);
      
      
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 619..629
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 635..645

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (comma && inputLine.length > CAR_RWL_DESTINATION) {
                          Location rwlDestination =
                                  InstanceManager.getDefault(LocationManager.class)
                                          .getLocationByName(inputLine[CAR_RWL_DESTINATION]);
      
      
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 619..629
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 674..684

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (comma && inputLine.length > CAR_RWE_DESTINATION) {
                          Location rweDestination =
                                  InstanceManager.getDefault(LocationManager.class)
                                          .getLocationByName(inputLine[CAR_RWE_DESTINATION]);
      
      
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 635..645
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 674..684

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

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

                      if (inputLine.length > base + CAR_OWNER) {
                          carOwner = inputLine[base + CAR_OWNER].trim();
                          if (carOwner.length() > Control.max_len_string_attibute) {
                              JmriJOptionPane.showMessageDialog(null, Bundle
                                      .getMessage("CarOwnerNameTooLong",
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 381..392
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 245..256
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 257..268

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

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

                      if (inputLine.length > base + CAR_BUILT) {
                          carBuilt = inputLine[base + CAR_BUILT].trim();
                          if (carBuilt.length() > Control.max_len_string_built_name) {
                              JmriJOptionPane.showMessageDialog(
                                      null, Bundle.getMessage("CarBuiltNameTooLong",
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 369..380
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 245..256
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 257..268

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

      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

                              if (autoCreateTracks) {
                                  if (!location.isStaging()) {
                                      log.debug("Create 1000 foot yard track ({})", carTrackName);
                                      track = location.addTrack(carTrackName, Track.YARD);
                                  } else {
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 351..360

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

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

                                          if (askAutoIncreaseTrackLength) {
                                              results = JmriJOptionPane.showConfirmDialog(null, Bundle
                                                      .getMessage("DoYouWantToAutoAdjustTrackLength"),
                                                      Bundle.getMessage("OnlyAskedOnce"),
                                                      JmriJOptionPane.YES_NO_OPTION);
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 549..558
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 801..809
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 866..875

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

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

                                          if (askAutoLocationType) {
                                              results = JmriJOptionPane.showConfirmDialog(null,
                                                      Bundle.getMessage("DoYouWantToAutoAdjustLocations"),
                                                      Bundle.getMessage("OnlyAskedOnce"), JmriJOptionPane.YES_NO_OPTION);
                                              if (results == JmriJOptionPane.YES_OPTION) {
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 549..558
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 835..844
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 866..875

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

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

                                      if (askAutoCreateTracks) {
                                          results = JmriJOptionPane.showConfirmDialog(null,
                                                  Bundle.getMessage("DoYouWantToAutoCreateTrack"),
                                                  Bundle.getMessage("OnlyAskedOnce"),
                                                  JmriJOptionPane.YES_NO_OPTION);
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 801..809
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 835..844
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 866..875

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

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

                                          if (askAutoForceCar) {
                                              results = JmriJOptionPane.showConfirmDialog(null, Bundle
                                                      .getMessage("DoYouWantToAutoForceCar"),
                                                      Bundle.getMessage("OnlyAskedOnce"),
                                                      JmriJOptionPane.YES_NO_OPTION);
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 549..558
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 801..809
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 835..844

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

      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

                              int results = JmriJOptionPane.showConfirmDialog(null, Bundle.getMessage("Car") +
                                      " (" +
                                      carRoad +
                                      " " +
                                      carNumber +
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 206..214

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              if (importOkay) {
                  JmriJOptionPane
                          .showMessageDialog(null, Bundle.getMessage("ImportCarsAdded",
                                  carsAdded), Bundle.getMessage("SuccessfulImport"),
                                  JmriJOptionPane.INFORMATION_MESSAGE);
      java/src/jmri/jmrit/operations/locations/tools/ImportLocations.java on lines 327..333
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 486..493

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                                  if (askAutoCreateTypes) {
                                      results = JmriJOptionPane.showConfirmDialog(null,
                                              Bundle.getMessage("DoYouWantToAutoAddCarTypes"),
                                              Bundle.getMessage("OnlyAskedOnce"),
                                              JmriJOptionPane.YES_NO_OPTION);
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 505..512

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (TrainCommon.splitString(carTrackName).length() > Control.max_len_string_track_name) {
                          JmriJOptionPane.showMessageDialog(null, Bundle
                                  .getMessage("CarTrackNameTooLong",
                                          carRoad, carNumber, carTrackName),
                                  Bundle.getMessage("carAttribute",
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 466..474

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                                  if (askAutoCreateLocations) {
                                      results = JmriJOptionPane.showConfirmDialog(null, Bundle
                                              .getMessage("DoYouWantToAutoCreateLoc"),
                                              Bundle.getMessage("OnlyAskedOnce"), JmriJOptionPane.YES_NO_OPTION);
                                      if (results == JmriJOptionPane.YES_OPTION) {
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 307..315

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (TrainCommon.splitString(carLocationName).length() > Control.max_len_string_location_name) {
                          JmriJOptionPane.showMessageDialog(
                                  null, Bundle.getMessage("CarLocationNameTooLong",
                                          carRoad, carNumber, carLocationName),
                                  Bundle.getMessage("carAttribute",
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 475..483

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (carType.isEmpty()) {
                          log.info("Import line {} missing car type", lineNum);
                          JmriJOptionPane.showMessageDialog(null,
                                  Bundle.getMessage("CarTypeNotSpecified", carRoad, carNumber, lineNum),
                                  Bundle.getMessage("CarTypeMissing"), JmriJOptionPane.ERROR_MESSAGE);
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 242..248

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (carLength.isEmpty()) {
                          log.info("Import line {} missing car length", lineNum);
                          JmriJOptionPane.showMessageDialog(null,
                                  Bundle.getMessage("CarLengthNotSpecified", carRoad, carNumber, lineNum),
                                  Bundle.getMessage("CarLengthMissing"), JmriJOptionPane.ERROR_MESSAGE);
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 235..241

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      try {
                          Integer.parseInt(carLength);
                      } catch (NumberFormatException e) {
                          JmriJOptionPane.showMessageDialog(
                                  null, Bundle.getMessage("CarLengthNameNotNumber",
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 230..238

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 48.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (carNumber.isEmpty()) {
                          log.info("Import line {} missing car number", lineNum);
                          JmriJOptionPane.showMessageDialog(null,
                                  Bundle.getMessage("RoadNumberNotSpecified", lineNum),
                                  Bundle.getMessage("RoadNumberMissing"), JmriJOptionPane.ERROR_MESSAGE);
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 228..234
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 152..158
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 159..165
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 166..172
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 173..179

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

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

                      if (carRoad.isEmpty()) {
                          log.info("Import line {} missing car road", lineNum);
                          JmriJOptionPane.showMessageDialog(null,
                                  Bundle.getMessage("RoadNameNotSpecified", lineNum),
                                  Bundle.getMessage("RoadNameMissing"), JmriJOptionPane.ERROR_MESSAGE);
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 221..227
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 152..158
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 159..165
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 166..172
      java/src/jmri/jmrit/operations/rollingstock/engines/tools/ImportEngines.java on lines 173..179

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (comma && inputLine.length > CAR_DIVISION) {
                          Division division = InstanceManager.getDefault(DivisionManager.class)
                                  .getDivisionByName(inputLine[CAR_DIVISION].trim());
                          car.setDivision(division);
                      }
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 656..660

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (comma && inputLine.length > CAR_TRAIN) {
                          Train train = InstanceManager.getDefault(TrainManager.class)
                                  .getTrainByName(inputLine[CAR_TRAIN].trim());
                          car.setTrain(train);
                      }
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 650..654

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

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

                      if (!InstanceManager.getDefault(CarOwners.class).containsName(carOwner)) {
                          if (autoCreateOwners) {
                              log.debug("add car owner {}", carOwner);
                              InstanceManager.getDefault(CarOwners.class).addName(carOwner);
                          }
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 701..706
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 717..722
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 725..730

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

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

                      if (!InstanceManager.getDefault(CarColors.class).containsName(carColor)) {
                          if (autoCreateColors) {
                              log.debug("add car color {}", carColor);
                              InstanceManager.getDefault(CarColors.class).addName(carColor);
                          }
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 701..706
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 717..722
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 733..738

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

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

                      if (!InstanceManager.getDefault(CarRoads.class).containsName(carRoad)) {
                          if (autoCreateRoads) {
                              log.debug("add car road {}", carRoad);
                              InstanceManager.getDefault(CarRoads.class).addName(carRoad);
                          }
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 717..722
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 725..730
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 733..738

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

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

                      if (!InstanceManager.getDefault(CarLengths.class).containsName(carLength)) {
                          if (autoCreateLengths) {
                              log.debug("add car length {}", carLength);
                              InstanceManager.getDefault(CarLengths.class).addName(carLength);
                          }
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 701..706
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 725..730
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 733..738

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (comma && inputLine.length > CAR_RWL_LOAD && !inputLine[CAR_RWL_LOAD].isBlank()) {
                          car.setReturnWhenLoadedLoadName(inputLine[CAR_RWL_LOAD].trim());
                      }
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 630..632

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                      if (comma && inputLine.length > CAR_RWE_LOAD && !inputLine[CAR_RWE_LOAD].isBlank()) {
                          car.setReturnWhenEmptyLoadName(inputLine[CAR_RWE_LOAD].trim());
                      }
      java/src/jmri/jmrit/operations/rollingstock/cars/tools/ImportCars.java on lines 646..648

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

      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

      There are no issues that match your filters.

      Category
      Status