CLOSER-Cohorts/archivist

View on GitHub

Showing 2,584 of 2,584 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

      <Button
        type="button"
        variant="outlined"
        className={classes.sequence}
        onClick={() => {
Severity: Major
Found in react/src/pages/InstrumentConstructBuild.js and 3 other locations - About 2 hrs to fix
react/src/pages/InstrumentConstructBuild.js on lines 427..437
react/src/pages/InstrumentConstructBuild.js on lines 451..461
react/src/pages/InstrumentConstructBuild.js on lines 475..485

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

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

Similar blocks of code found in 4 locations. Consider refactoring.
Open

      <Button
        type="button"
        variant="outlined"
        className={classes.loop}
        onClick={() => {
Severity: Major
Found in react/src/pages/InstrumentConstructBuild.js and 3 other locations - About 2 hrs to fix
react/src/pages/InstrumentConstructBuild.js on lines 427..437
react/src/pages/InstrumentConstructBuild.js on lines 463..473
react/src/pages/InstrumentConstructBuild.js on lines 475..485

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

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

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        <Autocomplete
          onChange={handleChange}
          options={topicOptions}
          renderInput={params => (
            <TextField {...params} label="Topic" variant="outlined" />
Severity: Major
Found in react/src/pages/DatasetView.js and 1 other location - About 2 hrs to fix
react/src/pages/InstrumentMap.js on lines 325..332

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

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            <Autocomplete
              onChange={handleChange}
              options={topicOptions}
              renderInput={params => (
                <TextField {...params} label="Topic" variant="outlined" />
Severity: Major
Found in react/src/pages/InstrumentMap.js and 1 other location - About 2 hrs to fix
react/src/pages/DatasetView.js on lines 62..69

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

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

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 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/AdminInstrumentImportMappingView.js - 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

class ExportJob::Instrument
  include Sidekiq::Worker

  sidekiq_options queue: 'in_and_out'

Severity: Major
Found in app/jobs/export_job.rb and 1 other location - About 2 hrs to fix
app/jobs/export_job.rb on lines 42..75

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

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

class ExportJob::InstrumentComplete
  include Sidekiq::Worker

  sidekiq_options queue: 'in_and_out'

Severity: Major
Found in app/jobs/export_job.rb and 1 other location - About 2 hrs to fix
app/jobs/export_job.rb on lines 5..38

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

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

Cyclomatic complexity for import is too high. [14/6]
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 by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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 has too many lines. [37/30]
Open

    def run(dataset)
      documents = Document.where(item: dataset).order(created_at: :asc)
      unless documents.empty?
        document = documents.first
        @doc = Nokogiri::XML document.file_contents
Severity: Minor
Found in lib/exporters/xml/ddi/dataset.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for import is too high. [13/6]
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 by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Severity
Category
Status
Source
Language