AppStateESS/InternshipInventory

View on GitHub

Showing 6,675 of 6,675 total issues

Avoid deeply nested control flow statements.
Open

                if (item.host_approve_flag === 1) {
                    filtered.push(item);
                }
Severity: Major
Found in javascript/specialHost/ApproveHost.jsx - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                if (!item.auto_renew && expiration < 0) {
                    filtered.push(item);
                }
Severity: Major
Found in javascript/affiliationAgreement/AffiliateList.jsx - About 45 mins to fix

Method saveFile has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function saveFile($id, $name, $fileName, $target_file, $type,
            $fileLongType)
Severity: Minor
Found in class/Command/DocumentRest.php - About 45 mins to fix

Function handleSave has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    handleSave() {
        this.setState({editMode: false});

        var newStype = ReactDOM.findDOMNode(this.refs.savedStype).value.trim();
        var newDescr = ReactDOM.findDOMNode(this.refs.savedDescr).value.trim();
Severity: Minor
Found in javascript/editTerms/EditTerms.jsx - About 45 mins 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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        var ApproveData = null;
        if (this.state.approveData != null && this.state.hostData != null && this.state.conditionData != null) {
            ApproveData = this.state.approveData.map(function (host) {
                return (
Severity: Minor
Found in javascript/specialHost/ApproveHost.jsx - About 45 mins 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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct(Internship $i, Student $student = null, SubHost $host, Supervisor $supervisor, Term $term, $studentExistingCreditHours)
Severity: Minor
Found in class/EditInternshipFormView.php - About 45 mins to fix

Method addColumn has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function addColumn($column, $max_min = null, $as = null, $count = false, $distinct = false, $coalesce = null)
Severity: Minor
Found in class/SubselectDatabase.php - About 45 mins to fix

Function addColumn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function addColumn($column, $max_min = null, $as = null, $count = false, $distinct = false, $coalesce = null)
    {

        /****
         * What is this for?
Severity: Minor
Found in class/SubselectDatabase.php - About 45 mins 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 encodeStudents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function encodeStudents(Array $students) {
        $studentArray = array();

        // If an empty array was given, just return an empty JSON array
        if(sizeof($students) === 0){
Severity: Minor
Found in class/Command/GetSearchSuggestions.php - About 45 mins 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 joinResult has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function joinResult($source_column, $join_table, $join_column, $content_column, $new_name=null, $searchable=false)
Severity: Minor
Found in class/SubselectPager.php - About 45 mins to fix

Method addWhere has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function addWhere($column, $value = null, $operator = null, $conj = null, $group = null, $join = false)
Severity: Minor
Found in class/SubselectDatabase.php - About 45 mins to fix

Function getStudent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStudent($studentId){
        if($studentId === null || $studentId == ''){
            throw new \InvalidArgumentException('Missing student ID.');
        }

Severity: Minor
Found in class/DataProvider/Student/WebServiceDataProvider.php - About 45 mins 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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct(Internship $i = null, \PHPWS_User $phpwsUser = null, $timestamp = null, WorkflowState $fromState = null, WorkflowState $toState = null, $note = null)
Severity: Minor
Found in class/ChangeHistory.php - About 45 mins to fix

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

    public function __construct(InternSettings $emailSettings, Internship $internship, Term $term, $censusTimestamp, $toUsername, $templateFile)
Severity: Minor
Found in class/Email/EnrollmentReminderEmail.php - About 45 mins to fix

Method addJoin has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function addJoin($join_type, $join_from, $join_to, $join_on_1 = null, $join_on_2 = null, $ignore_tables = false)
Severity: Minor
Found in class/SubselectDatabase.php - About 45 mins to fix

Function checkRequiredFields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkRequiredFields(Internship $i){
        // Course number and subject are required so we can check against the expected insurance list in doNotification()
        // NB: Course subject and number are not required for secondary parts of multi-part internships
        if(!$i->isSecondaryPart() && $i->getCourseNumber() === null || $i->getCourseNumber() === ''){
            throw new MissingDataException("Please enter a course number.");
Severity: Minor
Found in class/WorkflowTransition/DeanApprove.php - About 45 mins 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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(Internship $i = null, \PHPWS_User $phpwsUser = null, $timestamp = null, WorkflowState $fromState = null, WorkflowState $toState = null, $note = null)
    {
        if(!is_null($i)){
            $this->id = 0;
            $this->internship_id = $i->getId();
Severity: Minor
Found in class/ChangeHistory.php - About 45 mins 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 requireClasses has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function requireClasses()
    {
        if ($this->load_class && is_array($this->load_class)) {
            foreach ($this->load_class as $files) {
                if (!is_array($files)) {
Severity: Minor
Found in class/SubselectDatabase.php - About 45 mins 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 prefixVary has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function prefixVary($sql, $tbl)
    {
        $repl = true;
        $ar = explode("'", $sql);

Severity: Minor
Found in class/SubselectDatabase.php - About 45 mins 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 4 locations. Consider refactoring.
Open

            error: function(xhr, status, err){
                alert("Failed to add department to database properly. "+ err.toString())
                console.error(status, err.toString());
            }
Severity: Major
Found in javascript/affiliationAgreement/AffiliationDepartments.jsx and 3 other locations - About 45 mins to fix
javascript/affiliationAgreement/AffiliationDepartments.jsx on lines 148..151
javascript/affiliationAgreement/AffiliationDepartments.jsx on lines 174..177
javascript/affiliationAgreement/AffiliationLocation.jsx on lines 153..156

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

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