AppStateESS/InternshipInventory

View on GitHub

Showing 379 of 6,675 total issues

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() {

        var mainButton = null;

        let censusDate = this.timestampToDate(this.props.census);
Severity: Minor
Found in javascript/editTerms/EditTerms.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

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

Function render has 41 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/specialHost/ApproveHost.jsx - About 1 hr to fix

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

    render() {
        var fgClasses = classNames({'form-group': true, 'has-error': this.state.hasError});

        var availHostOptions = null;
        if (this.state.availableHost != null) {
Severity: Minor
Found in javascript/location/Location.jsx - About 1 hr to fix

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

    public function __construct($supervisor_first_name, $supervisor_last_name, $supervisor_title, $supervisor_phone, $supervisor_email,
                $supervisor_fax, $supervisor_address, $supervisor_city, $supervisor_state, $supervisor_zip, $supervisor_province,
                $supervisor_country, $host_id){
Severity: Major
Found in class/Supervisor.php - About 1 hr to fix

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

    render() {
        var fgClasses = classNames({
                        'form-group': true,
                        'has-error': this.state.hasError
                    });
Severity: Minor
Found in javascript/createInterface/StateDropDown.jsx - About 1 hr to fix

Function insert has a Cognitive Complexity of 13 (exceeds 5 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

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

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

    public function post()
    {
        // Check permissions
        if(!\Current_User::isLogged()){
            header('HTTP/1.1 403 Forbidden');
Severity: Minor
Found in class/Command/EmergencyContactRest.php - About 1 hr to fix

Method plug has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function plug()
    {
    $tpl = array();
        $tpl['HOME_LINK']    = \PHPWS_Text::moduleLink('Menu', 'intern');
        $tpl['ADD_LINK']     = \PHPWS_Text::moduleLink('Add Student', 'intern', array('action' => 'ShowInternship'));
Severity: Minor
Found in class/UI/TopUI.php - About 1 hr to fix

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

    public static function contractAffilationSelected($id)
    {
        /* Check if user should have access to folders since this method does not go through execute */
        if (!\Current_User::isLogged()) {
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING,
Severity: Minor
Found in class/Command/DocumentRest.php - About 1 hr to fix

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

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

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
Severity
Category
Status
Source
Language