CLOSER-Cohorts/archivist

View on GitHub

Showing 2,591 of 2,591 total issues

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

const AdminInstrumentImportMappingView = (props) => {

  const dispatch = useDispatch()
  const instrumentId = get(props, "match.params.instrumentId", "")
  const importMappingId = get(props, "match.params.id", "")
Severity: Minor
Found in react/src/pages/AdminInstrumentImportMappingView.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/InstrumentMap.js - About 1 hr to fix

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

    def V3_2(qitem_id)
      @klass = ::QuestionItem

      super do |qitem, qi|
        build_response_domain = lambda do |rd|
Severity: Minor
Found in lib/exporters/xml/ddi/question_item.rb - About 1 hr to fix

Method update has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    self.resource = resource_class.reset_password_by_token(resource_params)
    yield resource if block_given?

    if resource.errors.empty?
Severity: Minor
Found in app/controllers/users/passwords_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 run has a Cognitive Complexity of 12 (exceeds 5 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

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 create_categories has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def create_categories(categories=[])
      categories.reverse.each do | category_hash |
        urn = category_hash.fetch(:urn, '')
        parsed_urn = parse_urn(urn)
        if @instrument.prefix != parsed_urn[:instrument_prefix]
Severity: Minor
Found in lib/importers/xml/ddi/fragment_instance.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 InstrumentBuildResponseDomains has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstrumentBuildResponseDomains = (props) => {
  const dispatch = useDispatch()
  const instrumentId = get(props, "match.params.instrument_id", "")
  const responseDomainId = get(props, "match.params.responseDomainId", null)
  const responseDomainType = get(props, "match.params.responseDomainType", null)
Severity: Minor
Found in react/src/pages/InstrumentBuildResponseDomains.js - About 1 hr to fix

Function AdminUsers has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AdminUsers = () => {

  const dispatch = useDispatch()

  const deleteUser = (instrumentId) => {
Severity: Minor
Found in react/src/pages/AdminUsers.js - About 1 hr to fix

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

        <Button>
          <Link to={url(routes.admin.datasets.dataset.show, { dataset_id: row.id })}>View</Link>
        </Button>
Severity: Major
Found in react/src/pages/AdminDatasets.js and 5 other locations - About 1 hr to fix
react/src/pages/AdminInstrumentExports.js on lines 46..48
react/src/pages/AdminInstrumentView.js on lines 158..160
react/src/pages/AdminInstruments.js on lines 31..33
react/src/pages/AdminInstruments.js on lines 34..36
react/src/pages/AdminUsers.js on lines 25..27

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

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

          <Button>
            <Link to={url(routes.admin.instruments.instrument.show, { instrument_id: row.prefix })}>View</Link>
          </Button>
Severity: Major
Found in react/src/pages/AdminInstrumentExports.js and 5 other locations - About 1 hr to fix
react/src/pages/AdminDatasets.js on lines 24..26
react/src/pages/AdminInstrumentView.js on lines 158..160
react/src/pages/AdminInstruments.js on lines 31..33
react/src/pages/AdminInstruments.js on lines 34..36
react/src/pages/AdminUsers.js on lines 25..27

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

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

          <Button>
            <Link to={url(routes.admin.instruments.instrument.edit, { instrument_id: row.prefix })}>Edit</Link>
          </Button>
Severity: Major
Found in react/src/pages/AdminInstruments.js and 5 other locations - About 1 hr to fix
react/src/pages/AdminDatasets.js on lines 24..26
react/src/pages/AdminInstrumentExports.js on lines 46..48
react/src/pages/AdminInstrumentView.js on lines 158..160
react/src/pages/AdminInstruments.js on lines 34..36
react/src/pages/AdminUsers.js on lines 25..27

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

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

          <Button>
            <Link to={url(routes.admin.instruments.instrument.datasets, { instrument_id: row.prefix })}>Datasets</Link>
          </Button>
Severity: Major
Found in react/src/pages/AdminInstruments.js and 5 other locations - About 1 hr to fix
react/src/pages/AdminDatasets.js on lines 24..26
react/src/pages/AdminInstrumentExports.js on lines 46..48
react/src/pages/AdminInstrumentView.js on lines 158..160
react/src/pages/AdminInstruments.js on lines 31..33
react/src/pages/AdminUsers.js on lines 25..27

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

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

          <Button>
            <Link to={url(routes.admin.users.user.edit, { user_id: row.id })}>Edit</Link>
          </Button>
Severity: Major
Found in react/src/pages/AdminUsers.js and 5 other locations - About 1 hr to fix
react/src/pages/AdminDatasets.js on lines 24..26
react/src/pages/AdminInstrumentExports.js on lines 46..48
react/src/pages/AdminInstrumentView.js on lines 158..160
react/src/pages/AdminInstruments.js on lines 31..33
react/src/pages/AdminInstruments.js on lines 34..36

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

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

                    <Button>
                      <Link to={url(routes.admin.datasets.dataset.show, { dataset_id: row.id })}>View</Link>
                    </Button>
Severity: Major
Found in react/src/pages/AdminInstrumentView.js and 5 other locations - About 1 hr to fix
react/src/pages/AdminDatasets.js on lines 24..26
react/src/pages/AdminInstrumentExports.js on lines 46..48
react/src/pages/AdminInstruments.js on lines 31..33
react/src/pages/AdminInstruments.js on lines 34..36
react/src/pages/AdminUsers.js on lines 25..27

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

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

      <Box fontWeight="fontWeightLight" m={2} >
        <Typography variant="h5" component="p" >
          {instrument.label} - {instrument.prefix}
        </Typography>
      </Box>
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 39..43

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

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

      <Box fontWeight="fontWeightLight" m={2} >
        <Typography variant="h5" component="p" >
          {dataset.name} - {dataset.study}
        </Typography>
      </Box>
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 50..54

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

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

const InstrumentView = (props) => {

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

Function AdminImportView has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AdminImportView = (props) => {

  const dispatch = useDispatch()
  const importId = get(props, "match.params.importId", "")
  const imports = useSelector(state => state.imports);
Severity: Minor
Found in react/src/pages/AdminImportView.js - About 1 hr to fix

Function Instruments has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Instruments = () => {

  const dispatch = useDispatch()

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

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

      const request = axios.post(api_host + '/instruments/' + instrumentId + '/cc_questions/' + ccQuestionId + '/add_variables.json',
      {
        "variable_names": variableNames,
        "x": x,
        "y": y
Severity: Major
Found in react/src/actions/index.js and 1 other location - About 1 hr to fix
react/src/actions/index.js on lines 1201..1209

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

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

Severity
Category
Status
Source
Language