AppStateESS/homestead

View on GitHub

Showing 1,397 of 1,397 total issues

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

        if ($damageList !== null && count($damageList) > 0) {
            // Turn the font size down
            $this->pdf->setFont('Times', null, 9);

            $xOffset = 10;
Severity: Major
Found in class/InfoCardPdfView.php and 1 other location - About 3 hrs to fix
class/InfoCardPdfView.php on lines 273..286

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

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 ($checkoutDamages !== null && count($checkoutDamages) > 0) {
            // Turn the font size down
            $this->pdf->setFont('Times', null, 9);

            $xOffset = 150;
Severity: Major
Found in class/InfoCardPdfView.php and 1 other location - About 3 hrs to fix
class/InfoCardPdfView.php on lines 219..232

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

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

    public function execute(CommandContext $context)
    {
        if(!UserStatus::isAdmin() || !\Current_User::allow('hms', 'floor_attributes') ){
            throw new PermissionException('You do not have permission to edit floors.');
        }
Severity: Minor
Found in class/Command/EditFloorCommand.php - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function traverse has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function traverse(node, path, state) {
  /*jshint -W004*/
  // Create a scope stack entry if this is the first node we've encountered in
  // its local scope
  var startIndex = null;
Severity: Major
Found in javascript/react/build/JSXTransformer.js - About 3 hrs to fix

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

<?php

namespace Homestead\Report\CancelledAppsContinuingGraph;

use \Homestead\ReportHtmlView;
class/Report/FreshmenApplicationsGraph/FreshmenApplicationsGraphHtmlView.php on lines 1..23

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

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

<?php

namespace Homestead\Report\FreshmenApplicationsGraph;

use \Homestead\ReportHtmlView;
class/Report/CancelledAppsContinuingGraph/CancelledAppsContinuingGraphHtmlView.php on lines 1..23

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

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

    public function execute(CommandContext $context)
    {
        $term = $context->get('term');

        // Load the student
Severity: Major
Found in class/Command/RlcSelfSelectInviteSaveCommand.php - About 3 hrs to fix

Method show has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function show()
    {
        if(!UserStatus::isAdmin() || !\Current_User::allow('hms', 'floor_view')){
            throw new PermissionException('You are not allowed to edit or view floors.');
        }
Severity: Major
Found in class/FloorView.php - About 3 hrs to fix

Checkin has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class Checkin {

    public $id;
    public $banner_id;
    public $term;
Severity: Minor
Found in class/Checkin.php - About 3 hrs to fix

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

        if (strict) {
            if (isRestrictedWord(token.value)) {
                throwErrorTolerant(token, Messages.StrictFunctionName);
            }
        } else {
Severity: Major
Found in javascript/react/build/JSXTransformer.js and 1 other location - About 3 hrs to fix
javascript/react/build/JSXTransformer.js on lines 8300..8312

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

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 (strict) {
                    if (isRestrictedWord(token.value)) {
                        throwErrorTolerant(token, Messages.StrictFunctionName);
                    }
                } else {
Severity: Major
Found in javascript/react/build/JSXTransformer.js and 1 other location - About 3 hrs to fix
javascript/react/build/JSXTransformer.js on lines 8220..8232

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

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

function nickname($first_name)
{
    $shortened = array(
        'Abigail' => 'Abby',
        'Alexander' => 'Alex',
Severity: Major
Found in util/createfakestudents.php - About 3 hrs to fix

Method render has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function render()
    {
        parent::render();

        // term

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

    function parseIntersectionType() {
        var marker = markerCreate(), type, types;
        type = parsePrefixType();
        types = [type];
        while (match('&')) {
Severity: Major
Found in javascript/react/build/JSXTransformer.js and 1 other location - About 3 hrs to fix
javascript/react/build/JSXTransformer.js on lines 7012..7025

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

    function parseUnionType() {
        var marker = markerCreate(), type, types;
        type = parseIntersectionType();
        types = [type];
        while (match('|')) {
Severity: Major
Found in javascript/react/build/JSXTransformer.js and 1 other location - About 3 hrs to fix
javascript/react/build/JSXTransformer.js on lines 6996..7010

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

Function render has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render(){
        var options = Array({category:"Welcome", id: 0, description: "Select the type of damage"});//{id: 0, description: "Select the type of Damage"}

        var data = this.props.options;
        for(var i = 0; i < data.length; i++) {
Severity: Major
Found in javascript/StudentAddRoomDamages/roomDamage.jsx - About 3 hrs to fix

Method getActivityMapping has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getActivityMapping()
    {
        return array(
            ACTIVITY_LOGIN                          => "Logged in",
            ACTIVITY_AGREED_TO_TERMS                => "Agreed to terms & agreement",
Severity: Major
Found in class/HMS_Activity_Log.php - About 3 hrs to fix

Function execute has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute(CommandContext $context)
    {
        $term = $context->get('term');

        if (!isset($term)) {
Severity: Minor
Found in class/Command/GetRoomDamagesToAssessCommand.php - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function show has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function show()
    {
        $pct = ($this->exact == TRUE) ? '' : '%';

        if(!empty($this->actor) && !empty($this->actee) && $this->actor == $this->actee){
Severity: Minor
Found in class/ActivityLogPager.php - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function getAddress has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAddress($type = null)
    {
        $pr_address = null;
        $ps_address = null;

Severity: Minor
Found in class/Student.php - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Severity
Category
Status
Source
Language