AppStateESS/homestead

View on GitHub

Showing 1,397 of 1,397 total issues

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

    getOptions(){
        $.ajax({
            url: 'index.php?module=hms&action=AjaxGetRoomDamageTypes',
            type: 'GET',
            dataType: 'json',
Severity: Major
Found in javascript/StudentAddRoomDamages/roomDamage.jsx and 1 other location - About 4 hrs to fix
javascript/RoomDamages/RoomDamages.jsx on lines 46..59

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

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

    public function getHousMealRegister($username, $term, $opt)
    {
        // Assemble the housing_app object
        $housing_app = new \stdClass();
        $housing_app->plan_code = 'HOME';
Severity: Major
Found in class/FakeSoapTable.php and 1 other location - About 4 hrs to fix
class/TestSOAP.php on lines 210..237

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

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

    public function getHousMealRegister($username, $term, $opt)
    {
        // Assemble the housing_app object
        $housing_app = new \stdClass();
        $housing_app->plan_code     = 'HOME';
Severity: Major
Found in class/TestSOAP.php and 1 other location - About 4 hrs to fix
class/FakeSoapTable.php on lines 195..222

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

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

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

Severity: Major
Found in class/Command/LotteryConfirmCommand.php - About 4 hrs to fix

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

    public function show()
    {
        require(PHPWS_SOURCE_DIR . 'mod/hms/inc/profile_options.php');

        $majors = MajorFactory::getMajorsList();
Severity: Major
Found in class/RoommateProfileView.php - About 4 hrs to fix

Function execute has a Cognitive Complexity of 29 (exceeds 5 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/AssignStudentCommand.php - About 4 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 application_term_to_class has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public static function application_term_to_class($curr_term, $application_term)
    {
        // Break up the term and year
        $yr = floor($application_term / 100);
        $sem = $application_term - ($yr * 100);
Severity: Minor
Found in class/HMS_Lottery.php - About 4 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 setRoommateVar has a Cognitive Complexity of 29 (exceeds 5 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 4 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 getComputedClass has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getComputedClass($baseTerm)
    {

        // Break up the term and year
        $yr = floor($this->application_term / 100);
Severity: Minor
Found in class/Student.php - About 4 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 PhpSOAP.php has 343 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Homestead;

use \Homestead\Exception\SOAPException;
Severity: Minor
Found in class/PhpSOAP.php - About 4 hrs to fix

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

<?php

namespace Homestead\Command;

use \Homestead\Term;
Severity: Major
Found in class/Command/ShowCheckinStartCommand.php and 1 other location - About 4 hrs to fix
class/Command/ShowCheckoutStartCommand.php on lines 1..43

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

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\Term;
Severity: Major
Found in class/Command/ShowCheckoutStartCommand.php and 1 other location - About 4 hrs to fix
class/Command/ShowCheckinStartCommand.php on lines 1..49

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

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

File jquery.selectboxes.js has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 *
 * Copyright (c) 2006-2009 Sam Collett (http://www.texotela.co.uk)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
Severity: Minor
Found in javascript/jquery.selectboxes.js - About 4 hrs to fix

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

    public function show()
    {
        $tpl = new \PHPWS_Template('hms');

        if(!$tpl->setFile('admin/reports/hall_overview.tpl')){
Severity: Major
Found in class/HallOverview.php - About 4 hrs to fix

Term has 33 functions (exceeds 20 allowed). Consider refactoring.
Open

class Term
{
    public $term;
    public $banner_queue;
    public $meal_plan_queue;
Severity: Minor
Found in class/Term.php - About 4 hrs to fix

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

    public function execute(CommandContext $context)
    {
        if(!\Current_User::allow('hms', 'assignment_notify')){
            throw new PermissionException('You do not have permission to send assignment notifications.');
        }
Severity: Major
Found in class/Command/SendAssignmentNotificationCommand.php - About 4 hrs to fix

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

        if ($contract === false) {
            // Create a new envelope and save it
            if ($under18) {
                // If student is under 18, use the template with parent signatures
                $envelope = EnvelopeFactory::createEnvelopeFromTemplate($docusignClient, $under18TemplateId, "University Housing Contract - $term", $templateRoles, 'sent', $student->getBannerId());
Severity: Major
Found in class/Command/BeginDocusignCommand.php and 1 other location - About 4 hrs to fix
contrib/sendDocusignContract.php on lines 141..157

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

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 ($contract === false) {
        // Create a new envelope and save it
        if ($under18) {
            // If student is under 18, use the template with parent signatures
            $envelope = Docusign\EnvelopeFactory::createEnvelopeFromTemplate($docusignClient, $under18TemplateId, "University Housing Contract - $term", $templateRoles, 'sent', $student->getBannerId());
Severity: Major
Found in contrib/sendDocusignContract.php and 1 other location - About 4 hrs to fix
class/Command/BeginDocusignCommand.php on lines 129..145

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

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

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

        # Check to see if a student already has a profile on file.
Severity: Minor
Found in class/Command/SubmitRoommateProfileCommand.php - About 4 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 execute has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute(CommandContext $context)
    {
        if(!\Current_User::allow('hms', 'view_rlc_applications') ){
            throw new PermissionException('You do not have permission to view rlc applications');
        }
Severity: Minor
Found in class/Command/ExportRlcAppsCommand.php - About 4 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