ChrisBAshton/smartresolution

View on GitHub

Showing 82 of 82 total issues

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

                if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
                    options.allowTimes = $.extend(true, [], _options.allowTimes);
                }
Severity: Major
Found in webapp/core/view/js/jquery.datetimepicker.js and 2 other locations - About 1 hr to fix
webapp/core/view/js/jquery.datetimepicker.js on lines 830..832
webapp/core/view/js/jquery.datetimepicker.js on lines 834..836

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

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

    function rrmdir($dir) {
        if (is_dir($dir)) {
            $objects = scandir($dir);
            foreach ($objects as $object) {
                if ($object != "." && $object != "..") {
Severity: Minor
Found in webapp/core/controller/AdminController.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method dispute has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function dispute($details) {
        $lawFirmA = (int) Utils::instance()->getValue($details, 'law_firm_a');
        $type     = Utils::instance()->getValue($details, 'type');
        $title    = Utils::instance()->getValue($details, 'title');
        $agentA   = isset($details['agent_a']) ? $details['agent_a'] : NULL;
Severity: Minor
Found in webapp/core/db/DBCreate.php - About 1 hr to fix

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

                        _this.currentTime.setDate(
                            Math.min(
                                new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
                                _this.currentTime.getDate()
                            )
    Severity: Major
    Found in webapp/core/view/js/jquery.datetimepicker.js and 1 other location - About 1 hr to fix
    webapp/core/view/js/jquery.datetimepicker.js on lines 1150..1155

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

    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

                        _this.currentTime.setDate(
                            Math.min(
                                new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
                                _this.currentTime.getDate()
                            )
    Severity: Major
    Found in webapp/core/view/js/jquery.datetimepicker.js and 1 other location - About 1 hr to fix
    webapp/core/view/js/jquery.datetimepicker.js on lines 1181..1186

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

    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 (options.maxDate &&  /^\+(.*)$/.test(options.maxDate)) {
                        options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat(options.formatDate);
                    }
    Severity: Major
    Found in webapp/core/view/js/jquery.datetimepicker.js and 1 other location - About 1 hr to fix
    webapp/core/view/js/jquery.datetimepicker.js on lines 882..884

    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

                    if (options.minDate && /^-(.*)$/.test(options.minDate)) {
                        options.minDate = _xdsoft_datetime.strToDateTime(options.minDate).dateFormat(options.formatDate);
                    }
    Severity: Major
    Found in webapp/core/view/js/jquery.datetimepicker.js and 1 other location - About 1 hr to fix
    webapp/core/view/js/jquery.datetimepicker.js on lines 886..888

    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

                        if (options.onClose && $.isFunction(options.onClose)) {
                            onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
                        }
    Severity: Major
    Found in webapp/core/view/js/jquery.datetimepicker.js and 1 other location - About 1 hr to fix
    webapp/core/view/js/jquery.datetimepicker.js on lines 1714..1716

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

    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 (options.onShow && $.isFunction(options.onShow)) {
                            onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
                        }
    Severity: Major
    Found in webapp/core/view/js/jquery.datetimepicker.js and 1 other location - About 1 hr to fix
    webapp/core/view/js/jquery.datetimepicker.js on lines 1738..1740

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

    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

    Method upload has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function upload ($f3, $params) {
            $account = mustBeLoggedIn();
            $dispute = setDisputeFromParams($f3, $params);
    
            if (!$dispute->getState()->canUploadDocuments()) {
    Severity: Minor
    Found in webapp/core/controller/EvidenceController.php - About 1 hr to fix

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

                              if (options.defaultTime) {
                                  time = _xdsoft_datetime.strtotime(options.defaultTime);
                                  ct.setHours(time.getHours());
                                  ct.setMinutes(time.getMinutes());
                              }
      Severity: Major
      Found in webapp/core/view/js/jquery.datetimepicker.js and 1 other location - About 1 hr to fix
      webapp/core/view/js/jquery.datetimepicker.js on lines 1106..1110

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

      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 (!norecursion && options.defaultTime) {
                              time = _this.strtotime(options.defaultTime);
                              d.setHours(time.getHours());
                              d.setMinutes(time.getMinutes());
                          }
      Severity: Major
      Found in webapp/core/view/js/jquery.datetimepicker.js and 1 other location - About 1 hr to fix
      webapp/core/view/js/jquery.datetimepicker.js on lines 1773..1777

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

      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 (isset($dataItem['mediator'])) {
              $mediatorLogin = DBQuery::instance()->emailToId($dataItem['mediator']);
              $create->mediatorOffer(array(
                  'dispute_id'  => $dispute->getDisputeId(),
                  'proposer_id' => $dispute->getPartyA()->getAgent()->getLoginId(),
      Severity: Major
      Found in data/fixtures/seed.php and 1 other location - About 1 hr to fix
      data/fixtures/seed.php on lines 146..156

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

      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 (isset($dataItem['mediation_centre'])) {
              $mediationCentreLogin = DBQuery::instance()->emailToId($dataItem['mediation_centre']);
              $create->mediationCentreOffer(array(
                  'dispute_id'  => $dispute->getDisputeId(),
                  'proposer_id' => $dispute->getPartyA()->getAgent()->getLoginId(),
      Severity: Major
      Found in data/fixtures/seed.php and 1 other location - About 1 hr to fix
      data/fixtures/seed.php on lines 158..168

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

      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

      Method calculateStateClass has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function calculateStateClass($dispute) {
              if ($dispute->getStatus() !== 'ongoing') {
                  return "DisputeClosed";
              }
      
      
      Severity: Minor
      Found in webapp/core/helpers/DisputeStateCalculator.php - About 1 hr to fix

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

                            if (options.onSelectDate &&    $.isFunction(options.onSelectDate)) {
                                options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
                            }
        Severity: Major
        Found in webapp/core/view/js/jquery.datetimepicker.js and 1 other location - About 1 hr to fix
        webapp/core/view/js/jquery.datetimepicker.js on lines 1617..1619

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 57.

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

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

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

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

        Refactorings

        Further Reading

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

                            if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
                                options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
                            }
        Severity: Major
        Found in webapp/core/view/js/jquery.datetimepicker.js and 1 other location - About 1 hr to fix
        webapp/core/view/js/jquery.datetimepicker.js on lines 1581..1583

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 57.

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

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

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

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

        Refactorings

        Further Reading

        Method disputeParty has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function disputeParty($disputeParty) {
                if (!$disputeParty->getPartyId()) {
                    $createdParty = DBCreate::instance()->disputeParty(array(
                        'organisation_id' => $disputeParty->getLawFirmID()
                    ));
        Severity: Minor
        Found in webapp/core/db/DBUpdate.php - About 1 hr to fix

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

                              if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
                                  options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
                              }
          Severity: Major
          Found in webapp/core/view/js/jquery.datetimepicker.js and 3 other locations - About 1 hr to fix
          webapp/core/view/js/jquery.datetimepicker.js on lines 814..816
          webapp/core/view/js/jquery.datetimepicker.js on lines 1188..1190
          webapp/core/view/js/jquery.datetimepicker.js on lines 1674..1676

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

          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 (options.onGenerate && $.isFunction(options.onGenerate)) {
                                  options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
                              }
          Severity: Major
          Found in webapp/core/view/js/jquery.datetimepicker.js and 3 other locations - About 1 hr to fix
          webapp/core/view/js/jquery.datetimepicker.js on lines 814..816
          webapp/core/view/js/jquery.datetimepicker.js on lines 1158..1160
          webapp/core/view/js/jquery.datetimepicker.js on lines 1188..1190

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

          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