AppStateESS/homestead

View on GitHub

Showing 1,397 of 1,397 total issues

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

        if(isset($this->cell_phone) && !is_null($this->cell_phone) && $this->cell_phone != ''){
            $tags['PHONE']      = '('.substr($this->cell_phone, 0, 3).')';
            $tags['PHONE']      .= substr($this->cell_phone, 3, 3);
            $tags['PHONE']      .= '-'.substr($this->cell_phone, 6, 4);
        }
Severity: Major
Found in class/LotteryApplication.php and 3 other locations - About 2 hrs to fix
class/LotteryApplication.php on lines 327..331
class/WaitingListApplication.php on lines 132..136
class/WaitingListApplication.php on lines 170..174

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

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 4 locations. Consider refactoring.
Open

        if(isset($this->cell_phone) && !is_null($this->cell_phone) && $this->cell_phone != ''){
            $tags['PHONE']      = '('.substr($this->cell_phone, 0, 3).')';
            $tags['PHONE']      .= substr($this->cell_phone, 3, 3);
            $tags['PHONE']      .= '-'.substr($this->cell_phone, 6, 4);
        }
Severity: Major
Found in class/WaitingListApplication.php and 3 other locations - About 2 hrs to fix
class/LotteryApplication.php on lines 292..296
class/LotteryApplication.php on lines 327..331
class/WaitingListApplication.php on lines 132..136

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

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 4 locations. Consider refactoring.
Open

        if(isset($this->cell_phone) && !is_null($this->cell_phone) && $this->cell_phone != ''){
            $tags['PHONE']      = '('.substr($this->cell_phone, 0, 3).')';
            $tags['PHONE']      .= substr($this->cell_phone, 3, 3);
            $tags['PHONE']      .= '-'.substr($this->cell_phone, 6, 4);
        }
Severity: Major
Found in class/LotteryApplication.php and 3 other locations - About 2 hrs to fix
class/LotteryApplication.php on lines 292..296
class/WaitingListApplication.php on lines 132..136
class/WaitingListApplication.php on lines 170..174

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

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 __construct has 17 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct($id = 0, $term = NULL, $banner_id = NULL, $username = NULL, $gender = NULL, $student_type = NULL, $application_term = NULL, $cell_phone = NULL, $meal_plan = NULL, $international = NULL, $specialInterest = NULL, $magicWinner = 0, $sororityPref = NULL, $wgPref = NULL, $honorsPref = NULL, $rlcInterest = NULL, $earlyRelease = NULL)
Severity: Major
Found in class/LotteryApplication.php - About 2 hrs to fix

Function parseFunctionSourceElements has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function parseFunctionSourceElements() {
        var sourceElement, sourceElements = [], token, directive, firstRestricted,
            oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesizedCount,
            marker = markerCreate();

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

Function write has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Buffer.prototype.write = function write (string, offset, length, encoding) {
  // Support both (string, offset, length, encoding)
  // and the legacy (string, encoding, offset, length)
  if (isFinite(offset)) {
    if (!isFinite(length)) {
Severity: Major
Found in javascript/react/build/JSXTransformer.js - About 2 hrs to fix

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

    public function execute(CommandContext $context)
    {
        $newrows = array();
        $pdo = PdoFactory::getPdoInstance();
        $floor_id = (int) $context->get('floorId');
Severity: Major
Found in class/Command/JSONGetRoomsCommand.php - About 2 hrs to fix

Method get_row_edit has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get_row_edit() {
        javascript('jquery');
        $tpl = array();
        $tpl['ID']           = $this->id;
        $tpl['ROOM_NUMBER']  = \PHPWS_Text::secureLink($this->room_number, 'hms', array('action'=>'EditRoomView', 'room'=>$this->id));
Severity: Major
Found in class/Room.php - About 2 hrs to fix

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

    public function process()
    {
        // This hack is the most awful hack ever.  Fix phpWebSite so that
        // user logins are logged separately.
        if(\Current_User::isLogged() && !isset($_SESSION['HMS_LOGGED_THE_LOGIN'])) {
Severity: Major
Found in class/HMS.php - About 2 hrs to fix

Method unassignStudent has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function unassignStudent(Student $student, $term, $notes = "", $reason, $refund)
    {
        if (!UserStatus::isAdmin() || !\Current_User::allow('hms', 'assignment_maintenance')) {
            throw new PermissionException('You do not have permission to unassign students.');
        }
Severity: Major
Found in class/HMS_Assignment.php - About 2 hrs to fix

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

    public function show()
    {
        $excess_limit = 3; // Number of rows to show by default

        $count = 0;
Severity: Major
Found in class/StudentAssignmentHistoryView.php - About 2 hrs to fix

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

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

        $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
Severity: Major
Found in class/ReapplicationMenuBlockView.php - About 2 hrs to fix

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

    public function execute()
    {
        $semester = Term::getTermSem(Term::getSelectedTerm());

        if($semester != TERM_FALL && $semester != TERM_SPRING){
Severity: Major
Found in class/Report/SingleGenderVsCoedPref/SingleGenderVsCoedPref.php - About 2 hrs to fix

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

$.fn.selectedTexts = function()
{
    var t = [];
    this.selectedOptions().each(
        function()
Severity: Major
Found in javascript/jquery.selectboxes.js and 1 other location - About 2 hrs to fix
javascript/jquery.selectboxes.js on lines 479..489

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

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

$.fn.selectedValues = function()
{
    var v = [];
    this.selectedOptions().each(
        function()
Severity: Major
Found in javascript/jquery.selectboxes.js and 1 other location - About 2 hrs to fix
javascript/jquery.selectboxes.js on lines 500..510

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

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 execute(CommandContext $context)
    {
        // Load the checkin object
        $checkinId = $context->Get('checkinId');

Severity: Major
Found in class/Command/ShowCheckinDocumentCommand.php and 1 other location - About 2 hrs to fix
class/Command/ShowCheckoutDocumentCommand.php on lines 31..47

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 execute(CommandContext $context)
    {
        // Load the checkin object
        $checkinId = $context->Get('checkinId');

Severity: Major
Found in class/Command/ShowCheckoutDocumentCommand.php and 1 other location - About 2 hrs to fix
class/Command/ShowCheckinDocumentCommand.php on lines 35..51

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

Function dispatch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    dispatch: function (data, isError) {
        if (!isError) {
            for (var cb in this.validators) {
                if (!this.validators[cb](data)) {
                    isError = true;
Severity: Minor
Found in javascript/checkinStart/CardReader.js - About 2 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 dispatch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    dispatch: function (data, isError) {
        if (!isError) {
            for (var cb in this.validators) {
                if (!this.validators[cb](data)) {
                    isError = true;
Severity: Minor
Found in javascript/appCardSwipe/CardReader.js - About 2 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute(CommandContext $context)
    {
        $docusignUsername = \PHPWS_Settings::get('hms', 'docusign_username');
        if ($docusignUsername === null || $docusignUsername == '') {
            throw new InvalidConfigurationException('Missing docusign username.');
Severity: Minor
Found in class/Command/BeginDocusignCommand.php - About 2 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