views/content/edit.php

Summary

Maintainability
C
1 day
Test Coverage

File edit.php has 313 lines of code (exceeds 250 allowed). Consider refactoring.
Open


<?php if ($event['deleted']): ?>
    <div class="row-fluid">
        <div class="alert">
            <strong>Heads up!</strong> This postmortem was deleted.
Severity: Minor
Found in views/content/edit.php - About 3 hrs to fix

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

            if (isset($feature['custom_js_assets'])) {
                // If we are just configured "on" then default to
                // include a js file named after the feature
                if ($feature['custom_js_assets'] === "on") {
                    $feature['custom_js_assets'] = array("{$feature_name}.js");
    Severity: Major
    Found in views/content/edit.php and 1 other location - About 3 hrs to fix
    views/content/edit.php on lines 315..336

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

    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($feature['custom_css_assets'])) {
                // If we are just configured "on" then default to
                // include a css file named after the feature
                if ($feature['custom_css_assets'] === "on") {
                    $feature['custom_css_assets'] = array("{$feature_name}.css");
    Severity: Major
    Found in views/content/edit.php and 1 other location - About 3 hrs to fix
    views/content/edit.php on lines 338..359

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

    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 (array_key_exists('incident_cause', $config)) {
              $incidentCauseConfig  = $config['incident_cause'];
              $incidentCauseTitle   = $incidentCauseConfig['title'];
              $incidentCauseList    = $incidentCauseConfig['causes'];
              ?>
    Severity: Minor
    Found in views/content/edit.php and 2 other locations - About 30 mins to fix
    views/content/edit.php on lines 113..135
    views/content/edit.php on lines 150..172

    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 (array_key_exists('problem_type', $config)) {
              $problemTypeConfig= $config['problem_type'];
              $problemTypeTitle = $problemTypeConfig['title'];
              $problemTypeList  = $problemTypeConfig['types'];
              ?>
    Severity: Minor
    Found in views/content/edit.php and 2 other locations - About 30 mins to fix
    views/content/edit.php on lines 150..172
    views/content/edit.php on lines 174..196

    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 (array_key_exists('impact_type', $config)) {
              $impactTypeConfig = $config['impact_type'];
              $impactTypeTitle  = $impactTypeConfig['title'];
              $impactTypeList   = $impactTypeConfig['types'];
              ?>
    Severity: Minor
    Found in views/content/edit.php and 2 other locations - About 30 mins to fix
    views/content/edit.php on lines 113..135
    views/content/edit.php on lines 174..196

    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

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /*
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 10
    Open

              $problemTypeTitle = $problemTypeConfig['title'];
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 28 spaces, found 26
    Open

                              <?php
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 10
    Open

              <?php
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 0 spaces, found 8
    Open

            foreach ($edit_page_features as $feature_name) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 2
    Open

      <?php if ($event['deleted']): ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 0 spaces, found 4
    Open

        }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 28 spaces, found 26
    Open

                              ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 28 spaces, found 26
    Open

                              ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 10
    Open

              $problemTypeList  = $problemTypeConfig['types'];
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 10
    Open

              $impactTypeConfig = $config['impact_type'];
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 10
    Open

              <?php
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 11
    Open

               if (isset($config['severity']) && isset($config['severity']['tooltip_title'])) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 6
    Open

          if (array_key_exists('incident_cause', $config)) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 28 spaces, found 26
    Open

                              $selected = ($problem_type == $problemType) ? " selected " : "";
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 6
    Open

          ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Expected 1 space after closing parenthesis; found 0
    Open

      <?php if ($event['deleted']): ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 6
    Open

          <?php
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if (!is_array($feature['custom_css_assets'])) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 0 spaces, found 4
    Open

        foreach ($edit_page_features as $feature_name) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 16
    Open

                    if (strpos($js_file, "https://") === false && strpos($js_file, "http://") === false) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 10
    Open

              $impactTypeTitle  = $impactTypeConfig['title'];
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          <?php
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          foreach ($impactTypeList as $impactType) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 6
    Open

          ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if ($feature['custom_css_assets'] === "on") {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                } else {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Closing brace indented incorrectly; expected 11 spaces, found 12
    Open

                } else {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 28 spaces, found 26
    Open

                              <?php
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 10
    Open

              <?php
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 2
    Open

      <?php else: ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Expected 1 space after closing parenthesis; found 0
    Open

        <?php if ($edit_status === Postmortem::EDIT_LOCKED): ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Expected 1 space after ELSE keyword; 0 found
    Open

      <?php else: ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 6
    Open

          }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 10
    Open

              $impactTypeList   = $impactTypeConfig['types'];
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 6
    Open

          }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 12
    Open

                }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 0 spaces, found 8
    Open

            }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 16
    Open

                    }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 10
    Open

              ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Expected 1 space after closing parenthesis; found 0
    Open

        <?php if ($edit_status === Postmortem::EDIT_UNLOCKED): ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 6
    Open

          <?php
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          foreach ($problemTypeList as $problemType) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 28 spaces, found 26
    Open

                              <?php
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 10
    Open

              ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 16
    Open

                    if (strpos($css_file, "https://") === false && strpos($css_file, "http://") === false) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if (!is_array($feature['custom_js_assets'])) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 16
    Open

                    } else {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          <?php
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 10
    Open

              $incidentCauseTitle   = $incidentCauseConfig['title'];
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 28 spaces, found 26
    Open

                              $selected = ($incident_cause == $incidentCause) ? " selected " : "";
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 16
    Open

                    }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                } else {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 16
    Open

                    }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Expected 1 space after closing parenthesis; found 0
    Open

    <?php if ($event['deleted']): ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 10
    Open

              ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 10
    Open

              $incidentCauseConfig  = $config['incident_cause'];
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 6
    Open

          }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 12
    Open

                if ($feature['enabled'] == "on") {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            if (isset($feature['custom_css_assets'])) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Expected 1 space after closing parenthesis; found 0
    Open

        <?php if ($edit_status === Postmortem::EDIT_CLOSED): ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                } else {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 6
    Open

          if (array_key_exists('problem_type', $config)) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          <?php
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 24 spaces, found 22
    Open

                          foreach ($incidentCauseList as $incidentCause) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 16
    Open

                    if ($view_path_exists) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 2
    Open

      <?php endif; ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            if (isset($feature['custom_js_assets'])) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 6
    Open

          if (array_key_exists('impact_type', $config)) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 28 spaces, found 26
    Open

                              $selected = ($impact_type == $impactType) ? " selected " : "";
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if ($feature['custom_js_assets'] === "on") {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 12 spaces, found 16
    Open

                    } else {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 10
    Open

              $problemTypeConfig= $config['problem_type'];
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 28 spaces, found 26
    Open

                              ?>
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected at least 12 spaces, found 10
    Open

              $incidentCauseList    = $incidentCauseConfig['causes'];
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 16
    Open

                    } else {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                foreach ($css_assets as $css_file) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                foreach ($js_assets as $js_file) {
    Severity: Minor
    Found in views/content/edit.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status