AppStateESS/InternshipInventory

View on GitHub

Showing 6,675 of 6,675 total issues

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

                if (this.state.dropData[j].abbr === e.target.value)
                {
                    var newDropData = this.state.dropData;
                    newDropData[j].active = this.state.dropData[j].active + 1;
                    this.setState({dropData: newDropData});
Severity: Major
Found in javascript/stateList/StateList.jsx and 1 other location - About 1 hr to fix
javascript/stateList/StateList.jsx on lines 124..129

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

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

        } else {
            dropdown = <InternationalDropDown onChange={this.handleDrop} key="countries" ref={(element) => {this.countryDropDown = element}} countries={this.state.availableCountries}/>;
        }
Severity: Major
Found in javascript/createInterface/LocationBlock.jsx and 1 other location - About 1 hr to fix
javascript/createInterface/LocationBlock.jsx on lines 75..77

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

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

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.php - About 1 hr to fix

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

    render() {
        var majorsDropdown;

        if(!this.state.undergrad && !this.state.graduate) {
            majorsDropdown = <MajorsDropDown formStyle='horizontal'/>;
Severity: Minor
Found in javascript/majorSelector/MajorSelector.jsx - About 1 hr to fix

Function get has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function get() {
        $db = \phpws2\Database::newDB();
        $pdo = $db->getPDO();

        if(!isset($_REQUEST['Waiting']) && !isset($_REQUEST['Condition'])){
Severity: Minor
Found in class/Command/HostRest.php - About 1 hr 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 createTableIndex has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function createTableIndex($column, $name = null, $unique = false)
    {
        if (!DB_ALLOW_TABLE_INDEX) {
            return false;
        }
Severity: Minor
Found in class/SubselectDatabase.php - About 1 hr 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 getObjects has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getObjects($class_name)
    {
        $items = null;
        $result = $this->select();

Severity: Minor
Found in class/SubselectDatabase.php - About 1 hr 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

          case 'sortByZA':

              sorted = unsorted.sort(function (a, b) {
                  if (a.name > b.name) return -1;
                  if (a.name < b.name) return 1;
Severity: Major
Found in javascript/affiliationAgreement/AffiliateList.jsx and 1 other location - About 1 hr to fix
javascript/affiliationAgreement/AffiliateList.jsx on lines 232..239

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

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

          case 'sortByAZ':

              sorted = unsorted.sort(function (a, b) {
                  if (a.name < b.name) return -1;
                  if (a.name > b.name) return 1;
Severity: Major
Found in javascript/affiliationAgreement/AffiliateList.jsx and 1 other location - About 1 hr to fix
javascript/affiliationAgreement/AffiliateList.jsx on lines 240..247

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

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

    render() {

        var faculty = null;
        if (this.props.tableData != null) {
            if (this.props.tableData.length > 0) {
Severity: Minor
Found in javascript/facultyEdit/FacultyEdit.jsx - About 1 hr to fix

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

    render() {
        // Create red asterisk for a required field
        var require = <span style={{color: '#FB0000'}}> *</span>;
        return (
            <Modal show={this.props.show} onHide={this.handleExit} backdrop='static'>
Severity: Minor
Found in javascript/emergencyContact/EmgContactList.jsx - About 1 hr to fix

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

    render() {

        var mainButton = null;

        let censusDate = this.timestampToDate(this.props.census);
Severity: Minor
Found in javascript/editTerms/EditTerms.jsx - About 1 hr to fix

Method import has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function import($text, $report_errors = true)
    {
        PHPWS_DB::touchDB();

        // first_import makes sure at least one query was completed
Severity: Minor
Found in class/SubselectDatabase.php - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

        if (tcode !== '' && stype !== '' && descr !== '' && census !== '' &&
            available !== '' && start !== '' && end !== '' && ugradOver !== '' &&
            gradOver !== '') {
            this.refs.term_code.value = '';
            this.refs.sem_type.value = '';
Severity: Critical
Found in javascript/editTerms/EditTerms.jsx - About 1 hr to fix

Avoid excessively long variable names like $studentExistingCreditHours. Keep variable name length under 20.
Open

    public function __construct(Internship $i, Student $student = null, SubHost $host, Supervisor $supervisor, Term $term, $studentExistingCreditHours)
Severity: Minor
Found in class/EditInternshipFormView.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $studentExistingCreditHours. Keep variable name length under 20.
Open

    private $studentExistingCreditHours;
Severity: Minor
Found in class/EditInternshipFormView.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $studentExistingCreditHours. Keep variable name length under 20.
Open

    private $studentExistingCreditHours;
Severity: Minor
Found in class/InternshipView.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $studentExistingCreditHours. Keep variable name length under 20.
Open

    public function __construct(Internship $internship, Student $student = null, WorkflowState $wfState, SubHost $host, Supervisor $supervisor, Term $term, $studentExistingCreditHours) {
Severity: Minor
Found in class/InternshipView.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $supervisor_first_name. Keep variable name length under 20.
Open

    public function __construct($supervisor_first_name, $supervisor_last_name, $supervisor_title, $supervisor_phone, $supervisor_email,
Severity: Minor
Found in class/Supervisor.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $supervisor_first_name. Keep variable name length under 20.
Open

    public $supervisor_first_name;
Severity: Minor
Found in class/Supervisor.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Severity
Category
Status
Source
Language