AppStateESS/homestead

View on GitHub

Showing 1,397 of 1,397 total issues

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

    public function execute()
    {
        $db = PdoFactory::getInstance()->getPdo();

        $query = "select hall_name, room_number, hms_checkin.banner_id, to_timestamp(checkout_date), checkout_by, improper_checkout_note from hms_checkin JOIN hms_bed ON (hms_checkin.bed_persistent_id = hms_bed.persistent_id AND hms_checkin.term = hms_bed.term) JOIN hms_room ON hms_bed.room_id = hms_room.id JOIN hms_floor ON hms_room.floor_id = hms_floor.id JOIN hms_residence_hall ON hms_floor.residence_hall_id = hms_residence_hall.id WHERE hms_checkin.term = :term and improper_checkout = 1 ORDER BY checkout_date";
Severity: Major
Found in class/Report/ImproperCheckouts/ImproperCheckouts.php and 3 other locations - About 5 hrs to fix
class/Report/DamagesAssessed/DamagesAssessed.php on lines 34..62
class/Report/KeysNotReturned/KeysNotReturned.php on lines 34..62
class/Report/RaReport/RaReport.php on lines 33..61

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

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

    public function show()
    {
        $tpl = array();

        // Student info
Severity: Minor
Found in class/RoomChangeParticipantView.php - About 5 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 37 (exceeds 5 allowed). Consider refactoring.
Open

    public function show(){
        $tpl = array();

        $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
        $tpl['STATUS'] = "";
Severity: Minor
Found in class/RlcReapplicationMenuBlockView.php - About 5 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

File roomDamage.jsx has 396 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import ReactDOM from 'react-dom';
import classNames from 'classnames';
import $ from 'jquery';

Severity: Minor
Found in javascript/StudentAddRoomDamages/roomDamage.jsx - About 5 hrs to fix

Bed has 41 functions (exceeds 20 allowed). Consider refactoring.
Open

class Bed extends HMS_Item {

    public $id;
    public $term;
    public $room_id = 0;
Severity: Minor
Found in class/Bed.php - About 5 hrs to fix

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

<?php

namespace Homestead;

class CheckoutDocumentView extends View {
Severity: Major
Found in class/CheckoutDocumentView.php and 1 other location - About 5 hrs to fix
class/CheckinDocumentView.php on lines 1..33

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

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;

class CheckinDocumentView extends View {
Severity: Major
Found in class/CheckinDocumentView.php and 1 other location - About 5 hrs to fix
class/CheckoutDocumentView.php on lines 1..33

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

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 36 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute(CommandContext $context){

        // Cmd to redirect to when we're done or upon error.
        $formCmd = CommandFactory::getCommand('ShowRoomChangeRequestForm');
        $menuCmd = CommandFactory::getCommand('ShowStudentMenu');
Severity: Minor
Found in class/Command/SubmitRoomChangeRequestCommand.php - About 5 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

File HMS_RLC_Application.php has 391 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Homestead;

use \Homestead\Exception\StudentNotFoundException;
Severity: Minor
Found in class/HMS_RLC_Application.php - About 5 hrs to fix

Function 19 has 134 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./source-map-generator":17,"./util":19,"amdefine":20}],19:[function(_dereq_,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
 * Copyright 2011 Mozilla Foundation and contributors
 * Licensed under the New BSD license. See LICENSE or:
Severity: Major
Found in javascript/react/build/JSXTransformer.js - About 5 hrs to fix

HMS_Learning_Community has 40 functions (exceeds 20 allowed). Consider refactoring.
Open

class HMS_Learning_Community extends HMS_Item
{
    public $id=NULL;
    public $community_name=NULL;
    public $abbreviation;
Severity: Minor
Found in class/HMS_Learning_Community.php - About 5 hrs to fix

ResidenceHall has 40 functions (exceeds 20 allowed). Consider refactoring.
Open

class ResidenceHall extends HMS_Item {

    public $hall_name = NULL;
    public $term;
    public $banner_building_code = NULL;
Severity: Minor
Found in class/ResidenceHall.php - About 5 hrs to fix

Function _timePicker has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  $._timePicker = function(elm, settings) {

    var tpOver = false;
    var keyDown = false;
    var startTime = timeToDate(settings.startTime, settings);
Severity: Major
Found in javascript/timePicker/jquery.timePicker.js - About 5 hrs to fix

Function visitReactTag has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function visitReactTag(traverse, object, path, state) {
  var openingElement = object.openingElement;
  var nameObject = openingElement.name;
  var attributesObject = openingElement.attributes;

Severity: Major
Found in javascript/react/build/JSXTransformer.js - About 5 hrs to fix

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

<?php

namespace Homestead\Command;

use \Homestead\HMS_Role;
Severity: Major
Found in class/Command/RoleAddPermissionCommand.php and 1 other location - About 5 hrs to fix
class/Command/RoleRemovePermissionCommand.php on lines 1..35

Duplicated Code

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

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

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

Tuning

This issue has a mass of 187.

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\Command;

use \Homestead\HMS_Role;
Severity: Major
Found in class/Command/RoleRemovePermissionCommand.php and 1 other location - About 5 hrs to fix
class/Command/RoleAddPermissionCommand.php on lines 1..35

Duplicated Code

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

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

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

Tuning

This issue has a mass of 187.

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

    public function show()
    {
        /*** Header Info ***/
        $tpl = array();
        $tpl['ROOM_PERSISTENT_ID'] = $this->room->getPersistentId();
Severity: Major
Found in class/RoomView.php - About 5 hrs to fix

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

    public function show()
    {
        $tpl = array();

        $roommate = HMS_Roommate::get_confirmed_roommate(UserStatus::getUsername(), $this->term);
Severity: Minor
Found in class/RoommateSelectionMenuBlockView.php - About 5 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

File rlcMembersList.jsx has 375 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import ReactDOM from 'react-dom';
import classNames from 'classnames';
import $ from 'jquery';

Severity: Minor
Found in javascript/rlcMembersList/rlcMembersList.jsx - About 5 hrs to fix

Method process_username_change has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process_username_change()
    {
        if(!UserStatus::isAdmin() || !\Current_User::allow('hms', 'username_change')){
            $tpl = array();
            return \PHPWS_Template::process($tpl, 'hms', 'admin/permission_denied.tpl');
Severity: Major
Found in class/HMS_Admin.php - About 5 hrs to fix
Severity
Category
Status
Source
Language