CLOSER-Cohorts/archivist

View on GitHub

Showing 219 of 2,583 total issues

Function AdminImports has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AdminImports = () => {

  const dispatch = useDispatch()
  const imports = useSelector(state => state.imports);
  const [page, setPage] = React.useState(0);
Severity: Major
Found in react/src/pages/AdminImports.js - About 2 hrs to fix

Function LoopItem has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const LoopItem = (props) => {
  const { type, id, instrumentId, title } = props
  const classes = useStyles();
  const [open, setOpen] = React.useState(true);

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

Function InstrumentForm has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const InstrumentForm = (props) => {
  const {instrument, onChange, path, onDelete} = props;

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

Function CcSequenceForm has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

Function AdminInstrumentExports has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AdminInstrumentExports = () => {

  const dispatch = useDispatch()
  const [message, setMessage] = useState()

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

Method V3_2 has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def V3_2(qgrid_id)
      @klass = ::QuestionGrid

      super do |qgrid, qg|

Severity: Major
Found in lib/exporters/xml/ddi/question_grid.rb - About 2 hrs to fix

Method V3_2 has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def V3_2(con_id)
      if con_id.is_a? ::CcCondition
        cc = con_id
      else
        cc = ::CcCondition.find con_id
Severity: Major
Found in lib/exporters/xml/ddi/cc_condition.rb - About 2 hrs to fix

Function DatasetImportView has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const DatasetImportView = (props) => {
  const { datasetImport } = props;

  const classes = useStyles();

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

Function InstrumentImportView has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstrumentImportView = (props) => {
  const { instrumentImport } = props;

  const classes = useStyles();

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

Function DatasetForm has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const DatasetForm = (props) => {
  const {dataset, onChange, path, onDelete} = props;

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

Function InstrumentImportView has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstrumentImportView = (props) => {
  const { instrumentImport } = props;

  const classes = useStyles();

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

Function App has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const App = () => {

  return (
    <MuiThemeProvider theme={theme}>
      <Router>
Severity: Major
Found in react/src/App.js - About 2 hrs to fix

File CodeListForm.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import { get, isNil } from "lodash";
import { Form } from 'react-final-form';
import { useDispatch, useSelector } from 'react-redux'
import { CodeLists } from '../actions'
Severity: Minor
Found in react/src/components/CodeListForm.js - About 2 hrs to fix

Function formFields has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const formFields = (item) => {
  return [
    {
      size: 12,
      field: (
Severity: Major
Found in react/src/components/InstrumentForm.js - About 2 hrs to fix

Method import has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def import(options = {})
    cc_question_ids_to_delete = @object.cc_questions.pluck(:id)
    set_import_to_running
    @doc.each do |control_construct_scheme, q, t|
      log :input, "#{control_construct_scheme},#{q},#{t}"
Severity: Minor
Found in lib/importers/txt/mapper/topic_q.rb - 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 read_question has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def read_question(node)
      question_item = @instrument.question_items.new(
          label: node['name'],
          literal: node.at_xpath('./qt_properties/label')&.content
      )
Severity: Major
Found in lib/importers/xml/qsrx/parental_importer.rb - About 2 hrs to fix

Function AdminInstruments has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AdminInstruments = () => {

  const dispatch = useDispatch()

  const deleteInstrument = (instrumentId) => {
Severity: Major
Found in react/src/pages/AdminInstruments.js - About 2 hrs to fix

Class InstrumentsController has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

class InstrumentsController < ImportableController
  include Importers::Controller
  include Exporters

  has_importers({
Severity: Minor
Found in app/controllers/instruments_controller.rb - About 2 hrs to fix

Class FragmentInstance has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

  class FragmentInstance

    attr_accessor :questions, :errors

    def initialize(xml_fragment, instrument)
Severity: Minor
Found in lib/importers/xml/ddi/fragment_instance.rb - About 2 hrs to fix

Function Login has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function Login() {
  const classes = useStyles();

  const emailField = useFormField();
  const passwordField = useFormField();
Severity: Major
Found in react/src/pages/Login.js - About 2 hrs to fix
Severity
Category
Status
Source
Language