AppStateESS/InternshipInventory

View on GitHub

Showing 6,675 of 6,675 total issues

Method _getJoinOn has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _getJoinOn($join_on_1, $join_on_2, $table1, $table2, $ignore_tables = false)
    {
        if (empty($join_on_1) || empty($join_on_2)) {
            return null;
        }
Severity: Minor
Found in class/SubselectDatabase.php - About 1 hr to fix

Method __construct has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct($id, $main_host_id, $sub_name, $address, $city, $state, $zip, $province, $country, $other_names, $conditions, $approve_flag){
Severity: Major
Found in class/SubHost.php - About 1 hr to fix

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

        } else if (this.state.domestic) {
            dropdown = <StateDropDown key="states" ref={(element) => {this.stateDropDown = element}} states={this.state.availableStates} formStyle='horizontal'/>;
        } else {
Severity: Major
Found in javascript/searchInterface/SearchInterface.jsx and 1 other location - About 1 hr to fix
javascript/searchInterface/SearchInterface.jsx on lines 67..69

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

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 key="countries" ref={(element) => {this.countryDropDown = element}} countries={this.state.availableCountries} formStyle='horizontal'/>;
        }
Severity: Major
Found in javascript/searchInterface/SearchInterface.jsx and 1 other location - About 1 hr to fix
javascript/searchInterface/SearchInterface.jsx on lines 65..67

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

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

The class Curl has 19 fields. Consider redesigning Curl to keep the number of fields under 15.
Open

class Curl {

    const DEFAULT_TIMEOUT = 30;

    public $curl;
Severity: Minor
Found in class/DataProvider/Curl.php by phpmd

TooManyFields

Since: 0.1

Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

Example

class Person {
   protected $one;
   private $two;
   private $three;
   [... many more fields ...]
}

Source https://phpmd.org/rules/codesize.html#toomanyfields

The class Internship has 55 fields. Consider redesigning Internship to keep the number of fields under 15.
Open

class Internship {

    const GPA_MINIMUM = 2.00;

    public $id;
Severity: Minor
Found in class/Internship.php by phpmd

TooManyFields

Since: 0.1

Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

Example

class Person {
   protected $one;
   private $two;
   private $three;
   [... many more fields ...]
}

Source https://phpmd.org/rules/codesize.html#toomanyfields

The class Student has 16 fields. Consider redesigning Student to keep the number of fields under 15.
Open

class Student {
    // Defines for Internship Inventory student Data

    const MAIN_CAMPUS = 'main_campus';
    const DISTANCE_ED = 'distance_ed';
Severity: Minor
Found in class/Student.php by phpmd

TooManyFields

Since: 0.1

Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

Example

class Person {
   protected $one;
   private $two;
   private $three;
   [... many more fields ...]
}

Source https://phpmd.org/rules/codesize.html#toomanyfields

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

    render(){
        var availHost = null;
        if (this.state.availableHost != null) {
            availHost = this.state.availableHost.map(function (available) {
            return (
Severity: Minor
Found in javascript/specialHost/ApproveHost.jsx - About 1 hr to fix

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

    render() {
        let selection;
        // Preselects the contract button for new internships
        if(this.state.showContract && this.state.agreementType !== 'affiliation'){
            selection = <ContractSelected show={this.state.showContract} internshipId={this.props.internshipId}/>
Severity: Minor
Found in javascript/contractAffiliation/ContractAffiliation.jsx - About 1 hr to fix

Method buildMessage has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function buildMessage()
    {
        $faculty = $this->internship->getFaculty();
        $host = $this->internship->getHost();

Severity: Minor
Found in class/Email/EnrollmentReminderEmail.php - About 1 hr to fix

Method insert has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function insert($auto_index = true)
    {
        PHPWS_DB::touchDB();
        $maxID = true;
        $table = $this->getTable(false);
Severity: Minor
Found in class/SubselectDatabase.php - About 1 hr to fix

Method create_autocomplete_query has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function create_autocomplete_query($row)
{
    extract($row);

    $lfirst = strtolower($first_name);
Severity: Minor
Found in contrib/createFakeStudents.php - About 1 hr to fix

Method saveObject has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function saveObject($object, $stripChar = false, $autodetect_id = true)
    {
        if (!is_object($object)) {
            return PHPWS_Error::get(PHPWS_WRONG_TYPE, 'core', 'PHPWS_DB::saveObject', _('Type') . ': ' . gettype($object));
        }
Severity: Minor
Found in class/SubselectDatabase.php - About 1 hr to fix

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

        $.ajax({
            success: updateFaculty,
            error: handleFacultyReponseError,
            data: {module: 'intern',
                action: 'restFacultyById',
Severity: Major
Found in javascript/formGoodies/otherGoodies.js and 1 other location - About 1 hr to fix
javascript/formGoodies/otherGoodies.js on lines 216..225

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

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

                            <div className="col-md-4">
                                <div className="form-group">
                                    <button className="btn btn-default btn-md" onClick={this.handleClick}>Create Code</button>
                                </div>
                            </div>
Severity: Major
Found in javascript/editLevel/editLevel.jsx and 1 other location - About 1 hr to fix
javascript/editAdmin/editAdmin.jsx on lines 311..315

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

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

                  $.ajax({
                      success: handleGetFacultyResponse,
                      error: handleGetFacultyResponseError,
                      data: {module: 'intern',
                          action: 'restFacultyById',
Severity: Major
Found in javascript/formGoodies/otherGoodies.js and 1 other location - About 1 hr to fix
javascript/formGoodies/otherGoodies.js on lines 326..335

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

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

                                        <div className="col-md-3 col-md-offset-6">
                                            <div className="form-group">
                                                <button className="btn btn-default" onClick={this.handleSubmit}>Create Admin</button>
                                            </div>
                                        </div>
Severity: Major
Found in javascript/editAdmin/editAdmin.jsx and 1 other location - About 1 hr to fix
javascript/editLevel/editLevel.jsx on lines 57..61

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

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

    render() {
        // Create red asterisk for a required field
        var require = <span style={{color: '#FB0000'}}> *</span>;
        var HostData = null;
        if (this.state.hostDisplayData != null) {
Severity: Minor
Found in javascript/createInterface/HostBlock.jsx - About 1 hr to fix

Method post has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function post() {
        $Main = $_REQUEST['main'];
        $Name = $_REQUEST['name'];
        $Address = $_REQUEST['address'];
        $City = $_REQUEST['city'];
Severity: Minor
Found in class/Command/SubRest.php - About 1 hr to fix

Function getData has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getData() {
        $.ajax({
            url: 'index.php?module=intern&action=HostRest',
            type: 'GET',
            dataType: 'json',
Severity: Minor
Found in javascript/specialHost/ApproveHost.jsx - About 1 hr to fix
Severity
Category
Status
Source
Language