CLOSER-Cohorts/archivist

View on GitHub

Showing 2,591 of 2,591 total issues

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

                  case 'CcLoop':
                    return (
                      <ListItem className={classes.nested}>
                        <LoopItem instrumentId={instrumentId} id={child.id} type={child.type} />
                      </ListItem>)
Severity: Major
Found in react/src/pages/InstrumentMap.js and 6 other locations - About 1 hr to fix
react/src/pages/InstrumentMap.js on lines 578..582
react/src/pages/InstrumentView.js on lines 422..426
react/src/pages/InstrumentView.js on lines 427..431
react/src/pages/InstrumentView.js on lines 437..441
react/src/pages/InstrumentView.js on lines 487..491
react/src/pages/InstrumentView.js on lines 492..496

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

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 5 locations. Consider refactoring.
Open

                  <Link to={url(routes.instruments.instrument.build.ccSequences, { instrument_id: instrumentId })}>
                    <StatCount label="Sequences" value={cc_sequences} />
                  </Link>
Severity: Major
Found in react/src/pages/InstrumentBuild.js and 4 other locations - About 1 hr to fix
react/src/pages/InstrumentBuild.js on lines 121..123
react/src/pages/InstrumentBuild.js on lines 124..126
react/src/pages/InstrumentBuild.js on lines 127..129
react/src/pages/InstrumentBuild.js on lines 133..135

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

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

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

const useStyles = makeStyles({
  card: {
    minWidth: 275,
  },
  bullet: {
Severity: Major
Found in react/src/pages/AdminInstrumentView.js and 1 other location - About 1 hr to fix
react/src/pages/AdminDatasetView.js on lines 14..29

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

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 5 locations. Consider refactoring.
Open

                  <Link to={url(routes.instruments.instrument.build.ccConditions, { instrument_id: instrumentId })}>
                    <StatCount label="Conditions" value={cc_conditions} />
                  </Link>
Severity: Major
Found in react/src/pages/InstrumentBuild.js and 4 other locations - About 1 hr to fix
react/src/pages/InstrumentBuild.js on lines 124..126
react/src/pages/InstrumentBuild.js on lines 127..129
react/src/pages/InstrumentBuild.js on lines 130..132
react/src/pages/InstrumentBuild.js on lines 133..135

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

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 5 locations. Consider refactoring.
Open

                  <Link to={url(routes.instruments.instrument.build.ccLoops, { instrument_id: instrumentId })}>
                    <StatCount label="Loops" value={cc_loops} />
                  </Link>
Severity: Major
Found in react/src/pages/InstrumentBuild.js and 4 other locations - About 1 hr to fix
react/src/pages/InstrumentBuild.js on lines 121..123
react/src/pages/InstrumentBuild.js on lines 127..129
react/src/pages/InstrumentBuild.js on lines 130..132
react/src/pages/InstrumentBuild.js on lines 133..135

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

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 7 locations. Consider refactoring.
Open

                    case 'CcQuestion':
                      return (
                          <StyledListItem className={classes.nested}>
                            <QuestionListItem instrumentId={instrumentId} id={child.id} type={child.type} />
                          </StyledListItem>)
Severity: Major
Found in react/src/pages/InstrumentView.js and 6 other locations - About 1 hr to fix
react/src/pages/InstrumentMap.js on lines 578..582
react/src/pages/InstrumentMap.js on lines 588..592
react/src/pages/InstrumentView.js on lines 427..431
react/src/pages/InstrumentView.js on lines 437..441
react/src/pages/InstrumentView.js on lines 487..491
react/src/pages/InstrumentView.js on lines 492..496

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

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 5 locations. Consider refactoring.
Open

                  <Link to={url(routes.instruments.instrument.build.ccStatements, { instrument_id: instrumentId })}>
                    <StatCount label="Statements" value={cc_statements} />
                  </Link>
Severity: Major
Found in react/src/pages/InstrumentBuild.js and 4 other locations - About 1 hr to fix
react/src/pages/InstrumentBuild.js on lines 121..123
react/src/pages/InstrumentBuild.js on lines 124..126
react/src/pages/InstrumentBuild.js on lines 127..129
react/src/pages/InstrumentBuild.js on lines 130..132

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

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

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

const useStyles = makeStyles({
  card: {
    minWidth: 275,
  },
  bullet: {
Severity: Major
Found in react/src/pages/AdminDatasetView.js and 1 other location - About 1 hr to fix
react/src/pages/AdminInstrumentView.js on lines 25..40

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

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 UsedByQuestions has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const UsedByQuestions = (props) => {
  const {item, instrumentId} = props;

  const classes = useStyles();

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

Method import has 38 lines of code (exceeds 25 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 1 hr to fix

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

      headingContent={(instrumentId)=>{ return (<Link to={url(routes.instruments.instrument.build.questionGrids.all, { instrument_id: instrumentId })}>Question Grids</Link>) }}
Severity: Major
Found in react/src/pages/InstrumentBuildQuestionItems.js and 1 other location - About 1 hr to fix
react/src/pages/InstrumentBuildQuestionGrids.js on lines 21..21

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

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

      headingContent={(instrumentId) => { return (<Link to={url(routes.instruments.instrument.build.questionItems.all, { instrument_id: instrumentId })}>Question Items</Link>) }}
Severity: Major
Found in react/src/pages/InstrumentBuildQuestionGrids.js and 1 other location - About 1 hr to fix
react/src/pages/InstrumentBuildQuestionItems.js on lines 21..21

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

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 ObjectTypeLookup has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ObjectTypeLookup = (objectType, instrumentId) => {
    switch(objectType) {
      case('ResponseDomainNumeric'):
        return {
          path: url(routes.instruments.instrument.build.responseDomains.show, { instrument_id: instrumentId, responseDomainType: objectType, responseDomainId: 'new' }),
Severity: Minor
Found in react/src/components/CreateNewBuildObjectButtons.js - About 1 hr to fix

Function ListPagination has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ListPagination = props => {
  if (props.articlesCount <= 10) {
    return null;
  }

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

Method build_instrument has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.build_instrument(doc, options= {}, instrument_importer=nil)
      save = defined?(options[:save]) ? true : options[:save]
      duplicate = defined?(options[:duplicate]) ? :do_nothing : options[:duplicate]

      i = ::Instrument.new
Severity: Minor
Found in lib/importers/xml/ddi/instrument.rb - About 1 hr to fix

Method run has 37 lines of code (exceeds 25 allowed). Consider refactoring.
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 - About 1 hr to fix

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

    def build_ccs
      exporters = {}
      exporters[::CcCondition] = Exporters::XML::DDI::CcCondition.new @doc
      exporters[::CcQuestion]  = Exporters::XML::DDI::CcQuestion.new @doc
      exporters[::CcStatement] = Exporters::XML::DDI::CcStatement.new @doc
Severity: Major
Found in lib/exporters/xml/ddi/instrument_complete.rb and 1 other location - About 1 hr to fix
lib/exporters/xml/ddi/instrument.rb on lines 163..172

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

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

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

    def build_ccs
      exporters = {}
      exporters[::CcCondition] = Exporters::XML::DDI::CcCondition.new @doc
      exporters[::CcQuestion]  = Exporters::XML::DDI::CcQuestion.new @doc
      exporters[::CcStatement] = Exporters::XML::DDI::CcStatement.new @doc
Severity: Major
Found in lib/exporters/xml/ddi/instrument.rb and 1 other location - About 1 hr to fix
lib/exporters/xml/ddi/instrument_complete.rb on lines 163..172

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

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 AdminDatasetImportMappingView has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AdminDatasetImportMappingView = (props) => {

  const dispatch = useDispatch()
  const datasetId = get(props, "match.params.datasetId", "")
  const importMappingId = get(props, "match.params.id", "")
Severity: Minor
Found in react/src/pages/AdminDatasetImportMappingView.js - About 1 hr to fix

Function ObjectFinder has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ObjectFinder = (instrumentId, type, id) => {
  const sequences = useSelector(state => state.cc_sequences);
  const cc_sequences = get(sequences, instrumentId, {})
  const statements = useSelector(state => state.cc_statements);
  const cc_statements = get(statements, instrumentId, {})
Severity: Minor
Found in react/src/pages/InstrumentView.js - About 1 hr to fix
Severity
Category
Status
Source
Language