AppStateESS/homestead

View on GitHub

Showing 1,397 of 1,397 total issues

Function parsePrimaryExpression has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function parsePrimaryExpression() {
        var marker, type, token, expr;

        type = lookahead.type;

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

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

    public function execute(CommandContext $context)
    {
        $term = $context->get('term');
        $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);

Severity: Major
Found in class/Command/SubmitRLCReapplicationPageOneCommand.php - About 2 hrs to fix

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

    public function execute(CommandContext $context)
    {
        /*
        if(!\Current_User::allow('hms', 'email_hall') && !\Current_User::allow('hms', 'email_all')){
            throw new PermissionException('You do not have permission to send messages.');
Severity: Minor
Found in class/Command/SendNotificationEmailsCommand.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

Function can_change_gender has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function can_change_gender($target_gender, $ignore_upper = false)
    {
        // Ignore upper is true, we're trying to change a hall's gender
        if($ignore_upper) {
            // If ignore upper is true and the target gender is coed, then
Severity: Minor
Found in class/Floor.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

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

    public function execute() {
        $db = new \PHPWS_DB('hms_assignment');
        $db->addColumn('hms_assignment.banner_id');
        $db->addColumn('hms_assignment.reason');
        $db->addColumn('hms_residence_hall.hall_name');
Severity: Minor
Found in class/Report/AssignedStudentData/AssignedStudentData.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

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

<?php

namespace Homestead\ApplicationFeature;

use \Homestead\ApplicationFeatureRegistration;
Severity: Major
Found in class/ApplicationFeature/RlcReapplicationRegistration.php and 1 other location - About 2 hrs to fix
class/ApplicationFeature/ReapplicationRegistration.php on lines 1..31

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

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

use \Homestead\ApplicationFeatureRegistration;
Severity: Major
Found in class/ApplicationFeature/ReapplicationRegistration.php and 1 other location - About 2 hrs to fix
class/ApplicationFeature/RlcReapplicationRegistration.php on lines 1..31

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

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

},{"../main":2,"./inline-source-map":41}],2:[function(_dereq_,module,exports){
/**
 * Copyright 2013-2015, Facebook, Inc.
 * All rights reserved.
 *
Severity: Major
Found in javascript/react/build/JSXTransformer.js - About 2 hrs to fix

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

    public function execute()
    {
        if(!\Current_User::allow('hms', 'view_rlc_members')){
            throw new PermissionException('You do not have permission to view RLC members.');
        }
Severity: Major
Found in class/Command/AjaxGetRLCMembersCommand.php - About 2 hrs to fix

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

    public function execute(CommandContext $context){

        if(!UserStatus::isAdmin() || !\Current_User::allow('hms', 'roommate_maintenance')){
            throw new PermissionException('You do not have permission to create/edit roommate groups.');
        }
Severity: Major
Found in class/Command/CreateRoommateGroupCommand.php - About 2 hrs to fix

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

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

Function utf8ToBytes has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function utf8ToBytes (string, units) {
  units = units || Infinity
  var codePoint
  var length = string.length
  var leadSurrogate = null
Severity: Major
Found in javascript/react/build/JSXTransformer.js - About 2 hrs to fix

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

    render(){
        let sentDate = null;
        let subject = null;
        let opened = null;

Severity: Major
Found in javascript/emailLogView/messageRow.jsx - About 2 hrs to fix

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

    public function execute(CommandContext $context)
    {
        session_write_close();
        session_start();

Severity: Major
Found in class/Command/SubmitRLCReapplicationPage2Command.php - About 2 hrs to fix

Function _renderClassBody has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function _renderClassBody(traverse, node, path, state) {
  var className = state.className;
  var superClass = state.superClass;

  // Set up prototype of constructor on same line as `extends` for line-number
Severity: Major
Found in javascript/react/build/JSXTransformer.js - About 2 hrs to fix

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

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

        if(!is_null($this->community)){
Severity: Major
Found in class/AddCommunityView.php - About 2 hrs to fix

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

    public function execute() {
        $db = new \PHPWS_DB('hms_new_application');
        $db->addColumn('hms_new_application.*');
        $db->addWhere('term', $this->term);
        $db->addWhere('cancelled', 0);
Severity: Major
Found in class/Report/AppliedStudentData/AppliedStudentData.php - About 2 hrs to fix

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

    public function execute()
    {
        $lotteryTerm = \PHPWS_Settings::get('hms', 'lottery_term');

        /*******************************
Severity: Major
Found in class/Report/ReapplicationOverview/ReapplicationOverview.php - About 2 hrs to fix

LotteryProcess has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class LotteryProcess {
    private $sendMagicWinners;
    private $sendReminders;
    private $inviteCounts;
    private $applicationsRemaining;
Severity: Minor
Found in class/LotteryProcess.php - About 2 hrs to fix

RoomChangeRequest has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class RoomChangeRequest {

    protected $id;

    protected $term;
Severity: Minor
Found in class/RoomChangeRequest.php - About 2 hrs to fix
Severity
Category
Status
Source
Language