AppStateESS/InternshipInventory

View on GitHub

Showing 6,675 of 6,675 total issues

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

    protected function buildMessage()
    {
        $subjects = Subject::getSubjects();
        $faculty = $this->internship->getFaculty();

Severity: Major
Found in class/Email/RegistrationConfirmationEmail.php - About 2 hrs to fix

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

    if($("#internship_secondary_part").prop('checked')){
        // Disable course info
        $("#internship_course_subj").prop('disabled', true);
        $("#internship_course_no").prop('disabled', true);
        $("#internship_course_sect").prop('disabled', true);
Severity: Major
Found in javascript/formGoodies/otherGoodies.js and 1 other location - About 2 hrs to fix
javascript/formGoodies/otherGoodies.js on lines 173..187

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

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

        if($("#internship_secondary_part").prop('checked')){
            // Disable course info
            $("#internship_course_subj").prop('disabled', true);
            $("#internship_course_no").prop('disabled', true);
            $("#internship_course_sect").prop('disabled', true);
Severity: Major
Found in javascript/formGoodies/otherGoodies.js and 1 other location - About 2 hrs to fix
javascript/formGoodies/otherGoodies.js on lines 162..169

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

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

    validate(form, thisComponent) {

        // Assume everything is valid, change this if we detect otherwise
        var valid = true;
        var errors = [];
Severity: Major
Found in javascript/createInterface/CreateInternshipInterface.jsx - About 2 hrs to fix

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

    public function getSortButtons(&$template)
    {
        if (empty($this->table_columns)) {
            return null;
        }
Severity: Major
Found in class/SubselectPager.php - About 2 hrs to fix

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

    protected function buildMessage()
    {
        $this->subject = 'Internship Enrollment Issue';
        $this->to[] = $this->internship->email . $this->emailSettings->getEmailDomain();

Severity: Major
Found in class/Email/RegistrationIssueEmail.php - About 2 hrs to fix

File DocumentRest.php has 271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Intern\Command;

use \phpws2\Database;
Severity: Minor
Found in class/Command/DocumentRest.php - About 2 hrs to fix

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

class AllHostList extends React.Component {
    constructor(props) {
        super(props);

        this.state = {
Severity: Minor
Found in javascript/specialHost/ApproveHost.jsx - About 2 hrs to fix

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

            error: function(xhr, status, err) {
                var message = "Failed to grab settings data.";
                var notifStatus = "danger";
                this.setState({errorMessage: message, notificationStatus: notifStatus});
                console.error(this.props.url, status, err.toString());
Severity: Major
Found in javascript/settings/settings.jsx and 1 other location - About 2 hrs to fix
javascript/settings/settings.jsx on lines 71..76

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

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

                error: function(xhr, status, err) {
                    var message = "Settings did not save.";
                    var notifStatus = "danger";
                    this.setState({notification: message, notificationStatus: notifStatus});
                    console.error(this.props.url, status, err.toString());
Severity: Major
Found in javascript/settings/settings.jsx and 1 other location - About 2 hrs to fix
javascript/settings/settings.jsx on lines 89..94

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

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

    public function put() {
        $postarray = json_decode(file_get_contents('php://input'));
        $Id = $postarray->id;

        $db = Database::newDB();
Severity: Major
Found in class/Command/HostRest.php - About 2 hrs to fix

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

    constructor(props) {
        super(props);

        this.state = {
            showError: false,
Severity: Major
Found in javascript/specialHost/ApproveHost.jsx and 2 other locations - About 2 hrs to fix
javascript/specialHost/ApproveHost.jsx on lines 9..19
javascript/specialHost/ApproveHost.jsx on lines 139..149

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

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

    constructor(props) {
        super(props);

        this.state = {
            showError: false,
Severity: Major
Found in javascript/specialHost/ApproveHost.jsx and 2 other locations - About 2 hrs to fix
javascript/specialHost/ApproveHost.jsx on lines 139..149
javascript/specialHost/ApproveHost.jsx on lines 224..234

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

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

    constructor(props) {
        super(props);

        this.state = {
            showError: false,
Severity: Major
Found in javascript/specialHost/ApproveHost.jsx and 2 other locations - About 2 hrs to fix
javascript/specialHost/ApproveHost.jsx on lines 9..19
javascript/specialHost/ApproveHost.jsx on lines 224..234

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

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

    render(){
        return (
            <div className="row">
                <div className="col-md-offset-1 col-md-10">

Severity: Major
Found in javascript/facultyEdit/FacultyEdit.jsx - About 2 hrs to fix

Function buildMessage has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function buildMessage()
    {
        $subjects = Subject::getSubjects();
        $faculty = $this->internship->getFaculty();

Severity: Minor
Found in class/Email/RegistrationConfirmationEmail.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 createReport has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    function createReport()
    {
        if ($this->class) {
            $methods = get_class_methods($this->class);
            if (in_array($this->report_row, $methods)) {
Severity: Minor
Found in class/SubselectPager.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

Method get has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get($return_blank_results=true)
    {
        $template = array();

        if (empty($this->display_rows)) {
Severity: Major
Found in class/SubselectPager.php - About 2 hrs to fix

Method getPageRows has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getPageRows()
    {
        $template = null;
        $count = 0;

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

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

                        <div className="form-group">
                            <label className="col-lg-3 control-label">Address {require}</label>
                            <div className="col-lg-9"><input  type="text" className="form-control" id="sub-address" ref="sub_address"/></div>
                        </div>
Severity: Major
Found in javascript/createInterface/HostBlock.jsx and 5 other locations - About 2 hrs to fix
javascript/createInterface/HostBlock.jsx on lines 179..182
javascript/createInterface/HostBlock.jsx on lines 185..188
javascript/createInterface/HostBlock.jsx on lines 189..192
javascript/createInterface/HostBlock.jsx on lines 220..223
javascript/createInterface/HostBlock.jsx on lines 228..231

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

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

Severity
Category
Status
Source
Language