CLOSER-Cohorts/archivist

View on GitHub

Showing 215 of 2,579 total issues

File index.js has 1925 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import axios from "axios";
import { reverse as url } from 'named-urls'
import routes from '../routes'

const api_host = process.env.REACT_APP_API_HOST
Severity: Major
Found in react/src/actions/index.js - About 5 days to fix

Function DatasetView has 406 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const DatasetView = (props) => {

  const dispatch = useDispatch()
  const datasetId = get(props, "match.params.dataset_id", "")

Severity: Major
Found in react/src/pages/DatasetView.js - About 2 days to fix

Method read_sequence_children has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
Open

    def read_sequence_children(node, parent, branch = nil)
      position_counter = 0

      sub_sequence = lambda do |node, search, cc, branch|
        ref = node.at_xpath(search)
Severity: Minor
Found in lib/importers/xml/ddi/instrument.rb - About 1 day 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

File InstrumentMap.js has 657 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'
import { Instrument, CcConditions, CcLoops, CcSequences, CcStatements, CcQuestions, QuestionItems, QuestionGrids, Variables, Topics } from '../actions'
import { Dashboard } from '../components/Dashboard'
import { get, isEmpty, isNil, uniq } from "lodash";
Severity: Major
Found in react/src/pages/InstrumentMap.js - About 1 day to fix

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

  render() {

    if(this.props.monthData && this.props.yearData && this.props.projects && this.props.clients){

      const revenue_data = [];
Severity: Major
Found in react/src/components/Home/index.js - About 1 day to fix

Function render has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

  render() {

    if(this.props.monthData && this.props.yearData && this.props.projects && this.props.clients){

      const revenue_data = [];
Severity: Minor
Found in react/src/components/Home/index.js - About 1 day 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

File InstrumentView.js has 524 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'
import { Instrument, CcConditions, CcLoops, CcSequences, CcStatements, CcQuestions, QuestionItems, QuestionGrids, Variables, Topics } from '../actions'
import { Dashboard } from '../components/Dashboard'
import { InstrumentHeading } from '../components/InstrumentHeading'
Severity: Major
Found in react/src/pages/InstrumentView.js - About 1 day to fix

File InstrumentConstructBuild.js has 494 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'
import { Instrument, CcConditions, CcLoops, CcSequences, CcStatements, CcQuestions, QuestionItems, QuestionGrids, ResponseUnits, InstrumentTree } from '../actions'
import { Dashboard } from '../components/Dashboard'
import { MoveConstructSelect } from '../components/MoveConstructSelect'
Severity: Minor
Found in react/src/pages/InstrumentConstructBuild.js - About 7 hrs to fix

Function QuestionGridForm has 192 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const QuestionGridForm = (props) => {
  const {questionGrid, instrumentId, instrument} = props;

  var codeLists = useSelector(state => get(state.codeLists, instrumentId, {}));

Severity: Major
Found in react/src/components/QuestionGridForm.js - About 7 hrs to fix

File DatasetView.js has 485 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'
import { Dataset, DatasetVariable, Topics } from '../actions'
import { Dashboard } from '../components/Dashboard'
import { DatasetHeading } from '../components/DatasetHeading'
Severity: Minor
Found in react/src/pages/DatasetView.js - About 7 hrs to fix

Function DatasetView has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

const DatasetView = (props) => {

  const dispatch = useDispatch()
  const datasetId = get(props, "match.params.dataset_id", "")

Severity: Minor
Found in react/src/pages/DatasetView.js - About 7 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 Tree has 183 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Tree = (props) => {
  const { topSequence, instrumentId, dispatch, onNodeSelect } = props
  const objectFinder = ObjectFinder(instrumentId);
  const [treeData, setTreeData] = useState([TreeNode(instrumentId, 'CcSequence', topSequence.id, objectFinder, true)]);
  const [selectedNode, setSelectedNode] = useState({});
Severity: Major
Found in react/src/pages/InstrumentConstructBuild.js - About 7 hrs to fix

Function DataTable has 181 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const DataTable = (props) => {

  const { actions=()=>{}, fetch=[], stateKey='instruments', searchKey='prefix', headers=[], rowRenderer=()=>{}, parentStateKey, sortKeys=[] } = props;
  let { searchKeys = [searchKey], filters = [] } = props;

Severity: Major
Found in react/src/components/DataTable.js - About 7 hrs to fix

Function CodeListForm has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const CodeListForm = (props) => {
  const {codeList, instrumentId, instrument} = props;

  const categories = useSelector(state => get(state.categories, instrumentId, {}));

Severity: Major
Found in react/src/components/CodeListForm.js - About 7 hrs to fix

Function InstrumentView has 165 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstrumentView = (props) => {
  const { instrument } = props;

  const classes = useStyles();

Severity: Major
Found in react/src/pages/AdminInstrumentView.js - About 6 hrs to fix

Function QuestionItemForm has 162 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const QuestionItemForm = (props) => {
  const {questionItem, instrumentId, instrument} = props;

  const dispatch = useDispatch();
  const classes = useStyles();
Severity: Major
Found in react/src/components/QuestionItemForm.js - About 6 hrs to fix

File index.js has 429 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { combineReducers } from "redux";
import { get } from 'lodash'

const serializeSearchesArrayToObject = (array) =>
  array.reduce((obj, item) => {
Severity: Minor
Found in react/src/reducers/index.js - About 6 hrs to fix

Method read_sequence_children has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def read_sequence_children(node, parent, branch = nil)
      position_counter = 0

      sub_sequence = lambda do |node, search, cc, branch|
        ref = node.at_xpath(search)
Severity: Major
Found in lib/importers/xml/ddi/instrument.rb - About 5 hrs to fix

Function CcQuestionForm has 138 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const CcQuestionForm = (props) => {
  const {ccQuestion, instrumentId, onChange, path, onDelete, onCreate} = props;

  const questions = useSelector(state => state.cc_questions);
  const cc_questions = get(questions, instrumentId, {})
Severity: Major
Found in react/src/components/CcQuestionForm.js - About 5 hrs to fix

File index.js has 377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import ReactDOM from 'react-dom';
import { Link } from 'react-router-dom';
import { connect } from 'react-redux';
import dateFns from 'date-fns';
Severity: Minor
Found in react/src/components/Home/index.js - About 5 hrs to fix
Severity
Category
Status
Source
Language