AppStateESS/homestead

View on GitHub

Showing 1,397 of 1,397 total issues

Method process has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process()
    {
        // Set headers to allow Cross-origin scripting
        $rh = getallheaders();
        header('Allow: GET,HEAD,POST,PUT,DELETE,OPTIONS');
Severity: Minor
Found in class/AjaxHMS.php - About 1 hr to fix

Method get_all_free_beds has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function get_all_free_beds($term, $gender, $randomize = FALSE, $banner = FALSE)
    {
        // Only get free beds
        // Join other tables so we can do the other 'assignable' checks
        // Make sure everything is online and nothing is reserved
Severity: Minor
Found in class/Bed.php - About 1 hr to fix

Method execute has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function execute()
    {
        $this->data = array();

        $query = "SELECT hms_assignment.id, hms_assignment.banner_id, hms_assignment.asu_username, hms_new_application.cell_phone, hms_room.room_number, hms_floor.floor_number, hms_residence_hall.hall_name FROM hms_assignment LEFT JOIN (SELECT username, MAX(term) AS mterm FROM hms_new_application GROUP BY username) AS a ON hms_assignment.asu_username = a.username LEFT JOIN hms_new_application ON a.username = hms_new_application.username AND a.mterm = hms_new_application.term LEFT JOIN hms_bed ON hms_assignment.bed_id = hms_bed.id LEFT JOIN hms_room ON hms_bed.room_id = hms_room.id LEFT JOIN hms_floor ON hms_room.floor_id = hms_floor.id LEFT JOIN hms_residence_hall ON hms_floor.residence_hall_id = hms_residence_hall.id WHERE ( hms_assignment.term = $this->term) ORDER BY hms_residence_hall.id ASC";
Severity: Minor
Found in class/Report/PackageDeskExport/PackageDeskExport.php - About 1 hr to fix

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

        if($reg->requiresEndDate()) {
            $form->addText('end_date');
            if(!is_null($f->getEndDate())) {
                $form->setValue('end_date', strftime('%m/%d/%Y', $f->getEndDate()));
            }
Severity: Major
Found in class/ApplicationFeatureSettingsView.php and 1 other location - About 1 hr to fix
class/ApplicationFeatureSettingsView.php on lines 48..56

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

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

        if($reg->requiresEditDate()) {
            $form->addText('edit_date');
            if(!is_null($f->getEditDate())) {
                $form->setValue('edit_date', strftime('%m/%d/%Y', $f->getEditDate()));
            }
Severity: Major
Found in class/ApplicationFeatureSettingsView.php and 1 other location - About 1 hr to fix
class/ApplicationFeatureSettingsView.php on lines 58..66

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

Function parseSwitchStatement has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function parseSwitchStatement() {
        var discriminant, cases, clause, oldInSwitch, defaultFound, marker = markerCreate();

        expectKeyword('switch');

Severity: Minor
Found in javascript/react/build/JSXTransformer.js - About 1 hr to fix

Function uint8ToBase64 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function uint8ToBase64 (uint8) {
        var i,
            extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
            output = "",
            temp, length
Severity: Minor
Found in javascript/react/build/JSXTransformer.js - About 1 hr to fix

Function relative has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.relative = function(from, to) {
  from = exports.resolve(from).substr(1);
  to = exports.resolve(to).substr(1);

  function trim(arr) {
Severity: Minor
Found in javascript/react/build/JSXTransformer.js - About 1 hr to fix

Function scanJSXText has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function scanJSXText(stopChars) {
        var ch, str = '', start;
        start = index;
        while (index < length) {
            ch = source[index];
Severity: Minor
Found in javascript/react/build/JSXTransformer.js - About 1 hr to fix

Method execute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

        $errorCmd = CommandFactory::getCommand('LotteryShowDenyRoommateRequest');
Severity: Minor
Found in class/Command/LotteryDenyRoommateRequestCommand.php - About 1 hr to fix

Method execute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function execute(CommandContext $context)
    {
        if (!UserStatus::isAdmin() || !\Current_User::allow('hms', 'assignment_maintenance')) {
            throw new PermissionException('You do not have permission to assign students.');
        }
Severity: Minor
Found in class/Command/ShowAssignStudentCommand.php - About 1 hr to fix

Method execute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Method setRoommateVar has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function setRoommateVar($roomie, $status, $status_extra=null)
    {
        $roomLink = $this->getRoommateRoomLink($roomie->getUsername());
        if(is_null($roomLink)){
            $roomLink = "";
Severity: Minor
Found in class/StudentProfile.php - About 1 hr to fix

Method execute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function execute(CommandContext $context)
    {
        if(!UserStatus::isAdmin() || !\Current_User::allow('hms', 'view_activity_log')){
            throw new PermissionException('You do not have permission to view the activity log.');
        }
Severity: Minor
Found in class/Command/ShowActivityLogCommand.php - About 1 hr to fix

Method countRemainingApplicationsByClassGender has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function countRemainingApplicationsByClassGender($term, $class, $gender = null)
    {
        $query = "SELECT count(*) FROM hms_new_application JOIN hms_lottery_application ON hms_new_application.id = hms_lottery_application.id
                    LEFT OUTER JOIN (SELECT asu_username FROM hms_assignment WHERE hms_assignment.term=$term) as foo ON hms_new_application.username = foo.asu_username
                    WHERE foo.asu_username IS NULL AND hms_lottery_application.invited_on IS NULL
Severity: Minor
Found in class/LotteryProcess.php - About 1 hr to fix

Method getRoomChangesNeedsApproval has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getRoomChangesNeedsApproval($term, Array $floorList)
    {
        $db = PdoFactory::getPdoInstance();

        $floorPlaceholders = array();
Severity: Minor
Found in class/RoomChangeRequestFactory.php - About 1 hr to fix

Method getApplicationById has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getApplicationById($id)
    {
        $application = new HousingApplication();
        $db = new \PHPWS_DB('hms_new_application');
        $db->addWhere('id', $id);
Severity: Minor
Found in class/HousingApplicationFactory.php - About 1 hr to fix

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

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

        $submitCmd = CommandFactory::getCommand('SendLotteryInvites');
Severity: Minor
Found in class/SendLotteryInvitesView.php - About 1 hr to fix

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

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

        if($this->halls == NULL){
Severity: Minor
Found in class/SelectBedView.php - About 1 hr to fix

Method getCheckinsOrderedByRoom has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getCheckinsOrderedByRoom($term)
    {
        $db = PdoFactory::getPdoInstance();

        // NB: Must be specific about the columns we want (can't select *) because
Severity: Minor
Found in class/CheckinFactory.php - About 1 hr to fix
Severity
Category
Status
Source
Language