CLOSER-Cohorts/archivist

View on GitHub

Showing 219 of 2,583 total issues

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

  def import(options = {})
    Map.where(id: @object.maps.pluck(:id)).delete_all
    set_import_to_running
    @doc.each do |control_construct_scheme, q, dataset, v|
      log :input, "#{control_construct_scheme},#{q},#{dataset},#{v}"
Severity: Minor
Found in lib/importers/txt/mapper/mapping.rb - About 4 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 BreadcrumbBar has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const BreadcrumbBar = (props) => {
  const {instrumentId} = props

  const location = useLocation();

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

Method safe_params has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def safe_params
    # The params from Angular use :codes in the params array, we
    # tranform these into params that comply with the params expected
    # by nested attributes using accepts_nested_attributes for the codes
    # and their nested categories.
Severity: Minor
Found in app/controllers/code_lists_controller.rb - About 4 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

File QuestionGridForm.js has 347 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useEffect } from 'react';
import { get, isNil } from "lodash";
import { Form } from 'react-final-form';
import { useDispatch, useSelector } from 'react-redux'
import { QuestionGrids, ResponseDomainNumerics, ResponseDomainTexts, ResponseDomainDatetimes, ResponseDomainCodes, CodeLists } from '../actions'
Severity: Minor
Found in react/src/components/QuestionGridForm.js - About 4 hrs to fix

Function InstrumentBuild has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstrumentBuild = (props) => {

  const dispatch = useDispatch()
  const classes = useStyles();

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

Method copy has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  def copy(new_prefix, other_vals = {})
    new_i = self.dup
    new_i.prefix = new_prefix
    other_vals.select { |key, val| new_i[key] = val }

Severity: Minor
Found in app/models/instrument.rb - About 4 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 BreadcrumbBar has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

const BreadcrumbBar = (props) => {
  const {instrumentId} = props

  const location = useLocation();

Severity: Minor
Found in react/src/components/BreadcrumbBar.js - About 3 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 SourcesList has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const SourcesList = (props) => {
    const { sources, datasetId, variable } = props

    let { sourceOptions } = props

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

Function VariableSourcesList has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const VariableSourcesList = (props) => {
    const { sources, datasetId, variable } = props

    let { sourceOptions } = props

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

Function InstrumentMap has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstrumentMap = (props) => {

  const dispatch = useDispatch()
  const instrumentId = get(props, "match.params.instrument_id", "")
  const instrument = useSelector(state => get(state.instruments, instrumentId));
Severity: Major
Found in react/src/pages/InstrumentMap.js - About 3 hrs to fix

Function VariableList has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const VariableList = (props) => {
  const {variables, instrumentId, ccQuestionId, x, y, topicId, label='Variables'} = props

  const dispatch = useDispatch()

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

Function BuildContainer has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const BuildContainer = (props) => {
  let history = useHistory();

  const { instrumentId, selectionPath = () => { }, heading = "Code Lists", itemId, itemType, objectType = "CodeList", stateKey = "codeLists", fetch = [], formRenderer = () => { }, defaultValues = { used_by: [], min_responses: 1, max_responses: 1 }} = props;
  const { findSelectedItem = (items, itemId, itemType) => { return get(items, itemId, {}) }, listItemLabel = (item) => { return item.label }, listItemValue = (item) => { return item.used_by.length }, headingContent = (instrumentId) => { return '' } } = props;
Severity: Major
Found in react/src/components/BuildContainer.js - About 3 hrs to fix

Method question_grid_node has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def question_grid_node(node)
      question = ::QuestionGrid.new(
          {
              urn: node.at_xpath('./URN').content,            
              label: node.at_xpath('./QuestionGridName/String').content,
Severity: Minor
Found in lib/importers/xml/ddi/question.rb - About 3 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

Class Instrument has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

class Instrument < ApplicationRecord
  # This model is exportable as DDI
  include Exportable

  # This model can be tracked using an Identifier
Severity: Minor
Found in app/models/instrument.rb - About 3 hrs to fix

Function Dashboard has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Dashboard = (props)  => {
  const classes = useStyles();
  const [open, setOpen] = React.useState(false);
  const dispatch = useDispatch();
  const { instrumentId } = props;
Severity: Major
Found in react/src/components/Dashboard.js - About 3 hrs to fix

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

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

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

  def import(options = {})
    set_import_to_running
    vars = @object.variables.includes(:questions, :src_variables, :der_variables, :topic)
    begin
        @doc.each do |variable_dataset, v, source_dataset, s|
Severity: Minor
Found in lib/importers/txt/mapper/dv.rb - About 3 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 ConditionItem has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ConditionItem = (props) => {
  const { instrumentId } = props;
  var {title} = props;
  const classes = useStyles();
  const [open, setOpen] = React.useState(true);
Severity: Major
Found in react/src/pages/InstrumentMap.js - About 3 hrs to fix

Function CcConditionForm has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

Function CcStatementForm has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  const dispatch = useDispatch();
  const classes = useStyles();
Severity: Major
Found in react/src/components/CcStatementForm.js - About 3 hrs to fix
Severity
Category
Status
Source
Language