hack4impact/maps4all

View on GitHub
app/bulk_resource/views.py

Summary

Maintainability
F
1 wk
Test Coverage

Function save_csv has a Cognitive Complexity of 173 (exceeds 5 allowed). Consider refactoring.
Open

def save_csv():
    """ Last step in CSV workflow to update the resource and descriptor data models. """
    csv_storage = CsvStorage.most_recent(user=current_user)
    if csv_storage is None:
        db.session.rollback()
Severity: Minor
Found in app/bulk_resource/views.py - About 3 days 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 views.py has 655 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from datetime import datetime
import json
import geocoder
import time
import os
Severity: Major
Found in app/bulk_resource/views.py - About 1 day to fix

    Function set_required_option_descriptor has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
    Open

    def set_required_option_descriptor():
        """ Choose one option descriptor to be the required option descriptor.
        Can only select from option descriptors in the CSV or the existing required
        option descriptor if any. """
        csv_storage = CsvStorage.most_recent(user=current_user)
    Severity: Minor
    Found in app/bulk_resource/views.py - About 1 day 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 validate_required_option_descriptor has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

    def validate_required_option_descriptor():
        """ If there are resources that don't have the selected required option descriptor value set,
        enforce that they are updated to have the required option descriptor """
        csv_storage = CsvStorage.most_recent(user=current_user)
        if csv_storage is None:
    Severity: Minor
    Found in app/bulk_resource/views.py - About 6 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 upload_row has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    def upload_row():
        """ Processes each Deferred Ajax request """
        data = json.loads(request.form['json'])
    
        # Store CSV fields as descriptors
    Severity: Minor
    Found in app/bulk_resource/views.py - About 5 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 set_descriptor_types has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def set_descriptor_types():
        """ Sets each descriptor in the CSV to be an option, text, or hyperlink descriptor """
        csv_storage = CsvStorage.most_recent(user=current_user)
        if csv_storage is None:
            db.session.rollback()
    Severity: Minor
    Found in app/bulk_resource/views.py - 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 review_desc_options has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def review_desc_options():
        """ If there are option descriptors in the CSV, display the option values parsed
        from the CSV for verification """
        csv_storage = CsvStorage.most_recent(user=current_user)
        if csv_storage is None:
    Severity: Minor
    Found in app/bulk_resource/views.py - 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

    Avoid deeply nested control flow statements.
    Open

                        if csv_storage.action == 'update':
                            if desc.descriptor_id:
                                descriptor = Descriptor.query.filter_by(
                                    id=desc.descriptor_id
                                ).first()
    Severity: Major
    Found in app/bulk_resource/views.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if cached is None:
                              db.session.rollback()
                              abort(404)
                          resource.latitude = cached.latitude
      Severity: Major
      Found in app/bulk_resource/views.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            for value in assocValues:
                                arguments = {
                                    'resource_id': resource.id,
                                    'descriptor_id': descriptor.id,
                                    keyword: value,
        Severity: Major
        Found in app/bulk_resource/views.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if descriptor.dtype == 'text':
                                  association_class = TextAssociation
                                  keyword = 'text'
                                  # see if same descriptor already exists
                                  if csv_storage.action == 'update':
          Severity: Major
          Found in app/bulk_resource/views.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if resource is not None:
                                    for val in req_opt_desc_const.missing_dict[name]:
                                        new_association = OptionAssociation(
                                                            resource_id=resource.id,
                                                            descriptor_id=required_option_descriptor.id,
            Severity: Major
            Found in app/bulk_resource/views.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if descriptor is not None and descriptor.name == form.required_option_descriptor.data:
                                      req_opt_desc_const = RequiredOptionDescriptorConstructor(
                                          name=descriptor.name,
                                          values=descriptor.values
                                      )
              Severity: Major
              Found in app/bulk_resource/views.py - About 45 mins to fix

                Avoid too many return statements within this function.
                Open

                                return jsonify({
                Severity: Major
                Found in app/bulk_resource/views.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return jsonify({
                  Severity: Major
                  Found in app/bulk_resource/views.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return render_template(
                    Severity: Major
                    Found in app/bulk_resource/views.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return redirect(url_for('bulk_resource.save_csv'))
                      Severity: Major
                      Found in app/bulk_resource/views.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return render_template(
                        Severity: Major
                        Found in app/bulk_resource/views.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return render_template('bulk_resource/save.html', form=form)
                          Severity: Major
                          Found in app/bulk_resource/views.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return render_template('bulk_resource/set_descriptor_types.html',
                            Severity: Major
                            Found in app/bulk_resource/views.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return redirect(url_for('single_resource.index'))
                              Severity: Major
                              Found in app/bulk_resource/views.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return jsonify(redirect=url_for('bulk_resource.set_descriptor_types'))
                                Severity: Major
                                Found in app/bulk_resource/views.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return jsonify({
                                  Severity: Major
                                  Found in app/bulk_resource/views.py - About 30 mins to fix

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

                                            if form.navigation.data['submit_back']:
                                                return redirect(url_for('bulk_resource.set_required_option_descriptor'))
                                            elif form.navigation.data['submit_cancel']:
                                                db.session.delete(csv_storage)
                                                db.session.commit()
                                    Severity: Major
                                    Found in app/bulk_resource/views.py and 1 other location - About 3 hrs to fix
                                    app/bulk_resource/views.py on lines 355..362

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

                                    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

                                            if form.navigation.data['submit_next']:
                                                return redirect(url_for('bulk_resource.set_required_option_descriptor'))
                                            elif form.navigation.data['submit_back']:
                                                return redirect(url_for('bulk_resource.set_descriptor_types'))
                                            elif form.navigation.data['submit_cancel']:
                                    Severity: Major
                                    Found in app/bulk_resource/views.py and 1 other location - About 3 hrs to fix
                                    app/bulk_resource/views.py on lines 538..543

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

                                    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

                                        for num, name in enumerate(missing_resources):
                                            form.resources.append_entry()
                                            form.resources[num].label = name
                                            form.resources[num].choices = [(v, v) for v in req_opt_desc_const.values]
                                    Severity: Major
                                    Found in app/bulk_resource/views.py and 1 other location - About 3 hrs to fix
                                    app/descriptor/views.py on lines 419..422

                                    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

                                                if curr_req_opt_desc.descriptor_id != -1:
                                                    req_descriptor = Descriptor.query.filter_by(
                                                        id=curr_req_opt_desc.descriptor_id
                                                    ).first()
                                                    if req_descriptor is not None:
                                    Severity: Major
                                    Found in app/bulk_resource/views.py and 1 other location - About 2 hrs to fix
                                    app/descriptor/views.py on lines 342..347

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

                                    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

                                                new_d = [f.strip() for f in fields if
                                                    f.strip() and f.strip() != 'Name' and f.strip() != 'Address']
                                    Severity: Major
                                    Found in app/bulk_resource/views.py and 1 other location - About 1 hr to fix
                                    app/bulk_resource/views.py on lines 101..102

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

                                    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

                                                fields = [f.strip() for f in fields if
                                                    f.strip() and f.strip() != 'Name' and f.strip() != 'Address']
                                    Severity: Major
                                    Found in app/bulk_resource/views.py and 1 other location - About 1 hr to fix
                                    app/bulk_resource/views.py on lines 134..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 49.

                                    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

                                                        for value in assocValues:
                                                            arguments = {
                                                                'resource_id': resource.id,
                                                                'descriptor_id': descriptor.id,
                                                                keyword: value,
                                    Severity: Major
                                    Found in app/bulk_resource/views.py and 1 other location - About 1 hr to fix
                                    app/single_resource/views.py on lines 236..243

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

                                    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

                                                            for val in req_opt_desc_const.missing_dict[name]:
                                                                new_association = OptionAssociation(
                                                                                    resource_id=resource.id,
                                                                                    descriptor_id=required_option_descriptor.id,
                                                                                    option=required_option_descriptor.values.index(val),
                                    Severity: Major
                                    Found in app/bulk_resource/views.py and 1 other location - About 1 hr to fix
                                    app/descriptor/views.py on lines 406..413

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

                                    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

                                                if gstatus != 'OK':
                                                    msg = 'Address cannot be geocoded due to ' + gstatus + ": " + address
                                                    return jsonify({
                                                        "status": "Error",
                                                        "message": msg
                                    Severity: Major
                                    Found in app/bulk_resource/views.py and 1 other location - About 1 hr to fix
                                    app/bulk_resource/views.py on lines 195..199

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

                                    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

                                                if gstatus != 'OK':
                                                    msg = 'Address cannot be geocoded due to ' + gstatus + ": " + address
                                                    return jsonify({
                                                        "status": "Error",
                                                        "message": msg
                                    Severity: Major
                                    Found in app/bulk_resource/views.py and 1 other location - About 1 hr to fix
                                    app/bulk_resource/views.py on lines 227..231

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

                                    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

                                        if len(descriptors) > 0:
                                            csv += ',' + ','.join([desc.name for desc in descriptors])
                                    Severity: Major
                                    Found in app/bulk_resource/views.py and 1 other location - About 1 hr to fix
                                    app/single_resource/views.py on lines 272..273

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

                                    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

                                                for f in fields:
                                                    desc = CsvDescriptor(
                                                        csv_storage=csv_storage,
                                                        name=f,
                                                        values=set(),
                                    Severity: Minor
                                    Found in app/bulk_resource/views.py and 1 other location - About 50 mins to fix
                                    app/bulk_resource/views.py on lines 167..173

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

                                    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

                                                for f in added:
                                                    desc = CsvDescriptor(
                                                        csv_storage=csv_storage,
                                                        name=f,
                                                        values=set(),
                                    Severity: Minor
                                    Found in app/bulk_resource/views.py and 1 other location - About 50 mins to fix
                                    app/bulk_resource/views.py on lines 103..109

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

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status