CLOSER-Cohorts/archivist

View on GitHub

Showing 219 of 2,584 total issues

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

  render() {
    return (

      <main>

Severity: Minor
Found in react/src/components/ForgottenPassword.js - About 1 hr to fix

Function ObjectCheckForInitialValues has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const ObjectCheckForInitialValues = (initialValues, values) => {
    // For every field initially provided, we check whether it value has been removed
    // and set it explicitly to an empty string
    if (!initialValues) return values;
    const initialValuesWithEmptyFields = Object.keys(initialValues).reduce(
Severity: Minor
Found in react/src/support/ObjectCheckForInitialValues.js - About 1 hr 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_children has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def construct_children(branch = nil)
    query_children = lambda do |query_branch, cc|
      if query_branch.nil?
        return cc.children.map { |c| {id: c.id, type: c.class.name } }
      else
Severity: Minor
Found in app/models/parental_construct.rb - About 1 hr 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 a Cognitive Complexity of 11 (exceeds 5 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: Minor
Found in react/src/pages/InstrumentConstructBuild.js - About 1 hr 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 VariableList has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

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

  const dispatch = useDispatch()

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

  const VariableTableRow = (props) => {
    const { row } = props;

    const status = ObjectStatus(row.id, 'DatasetVariable')

Severity: Minor
Found in react/src/pages/DatasetView.js - About 1 hr to fix

Function registerValidSW has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function registerValidSW(swUrl, config) {
  navigator.serviceWorker
    .register(swUrl)
    .then(registration => {
      registration.onupdatefound = () => {
Severity: Minor
Found in react/src/serviceWorker.js - About 1 hr to fix

Function ReadOnlyVariableTableRow has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const ReadOnlyVariableTableRow = (props) => {
    const { row } = props;

    const status = ObjectStatus(row.id, 'DatasetVariable')

Severity: Minor
Found in react/src/pages/DatasetView.js - About 1 hr to fix

Method XML_node has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def XML_node(node)
      codes_to_add = []
      node.xpath('./Code').each_with_index do |code, i|
        begin
          co = ::Code.new ({
Severity: Minor
Found in lib/importers/xml/ddi/code_list.rb - About 1 hr to fix

Function actions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const actions = (row) => {
    return (
      <ButtonGroup variant="outlined">
        <Button>
          <Link to={url(routes.admin.datasets.dataset.show, { dataset_id: row.id })}>View</Link>
Severity: Minor
Found in react/src/pages/AdminDatasets.js - About 1 hr to fix

Function Datasets has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Datasets = () => {

  const dispatch = useDispatch()

  const actions = (row) => {
Severity: Minor
Found in react/src/pages/Datasets.js - About 1 hr to fix

Function actions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const actions = (row) => {
    return (
      <>
        <ButtonGroup variant="outlined">
          <Button>
Severity: Minor
Found in react/src/pages/AdminInstruments.js - About 1 hr to fix

Function ConditionItem has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in react/src/pages/InstrumentView.js - About 1 hr to fix

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

  render() {
    let message = this.props.message
    let position = this.props.position
    let size = this.props.size

Severity: Minor
Found in react/src/components/Tooltip.js - About 1 hr to fix

Method clear_cached_stats has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def clear_cached_stats
    self.class.reflections.keys.each do |key|
      if self.class.reflections[key].is_a? ActiveRecord::Reflection::BelongsToReflection
        unless self.send(key).nil?
          begin
Severity: Minor
Found in app/models/application_record.rb - About 1 hr 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 shim_construct_type has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def shim_construct_type(p)
    # Ensure that if the parent_type is a valid ParentalContstruct class name
    # or that it can be matched to one.
    parental_classes = %w(CcCondition CcLoop CcQuestion CcSequence CcStatement)
    unless p[:parent_type].nil? || parental_classes.include?(p[:parent_type])
Severity: Minor
Found in app/controllers/construct_controller.rb - About 1 hr 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 all has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def all
    instruments = Rails.cache.fetch('instruments.json&#{auth_token}', version: Instrument.maximum(:updated_at).to_i) do
      connection = ActiveRecord::Base.connection
      sql = %|
              SELECT instruments.id, instruments.agency, instruments.version, instruments.prefix, instruments.label, instruments.slug, instruments.study, instruments.signed_off, COUNT(DISTINCT(control_constructs.id)) as ccs, COUNT(DISTINCT(qv_mappings.id)) as qvs
Severity: Minor
Found in app/services/instruments/serializer.rb - About 1 hr 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 update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    with_unconfirmed_confirmable do
      if @confirmable.has_no_password?
        @confirmable.attempt_set_password(params[:user])
        if @confirmable.valid? and @confirmable.password_match?
Severity: Minor
Found in app/controllers/users/confirmations_controller.rb - About 1 hr 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 HumanizeObjectType has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const HumanizeObjectType = (type) => {
   switch (type){
      case 'statement':
      case 'CcStatement':
         return 'Statement'
Severity: Minor
Found in react/src/support/HumanizeObjectType.js - About 1 hr to fix

Function actions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const actions = (row) => {
    return (
      <>
        <ButtonGroup variant="outlined">
          <Button>
Severity: Minor
Found in react/src/pages/AdminInstrumentExports.js - About 1 hr to fix
Severity
Category
Status
Source
Language