erikvw/django-collect-offline

View on GitHub

Showing 75 of 75 total issues

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

with open(os.path.join(os.path.dirname(__file__), "VERSION")) as f:
    VERSION = f.read()
Severity: Minor
Found in setup.py and 1 other location - About 50 mins to fix
setup.py on lines 8..9

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

Function __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self):
        self.report_data = []
        for client in Client.objects.all():
            try:
                self.history_model.objects.get(
Severity: Minor
Found in django_collect_offline/views/sync_report_client_view.py - About 45 mins 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

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

Severity: Minor
Found in django_collect_offline/transaction/serialize.py and 1 other location - About 45 mins to fix
django_collect_offline/transaction/deserialize.py on lines 0..15

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

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 serialize_on_save has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def serialize_on_save(sender, instance, raw, created, using, **kwargs):
Severity: Minor
Found in django_collect_offline/models/signals.py - About 45 mins to fix

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

    Severity: Minor
    Found in django_collect_offline/transaction/deserialize.py and 1 other location - About 45 mins to fix
    django_collect_offline/transaction/serialize.py on lines 0..15

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

    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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, order_by=None, model=None, batch=None, producer=None, **kwargs):
    Severity: Minor
    Found in django_collect_offline/management/commands/deserialize.py - About 35 mins to fix

      Function serialize_m2m_on_save has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def serialize_m2m_on_save(sender, action, instance, using, **kwargs):
      Severity: Minor
      Found in django_collect_offline/models/signals.py - About 35 mins to fix

        Function makePageElements has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function makePageElements ( divId, host, resourceName, listUrl, userName ) {
        Severity: Minor
        Found in django_collect_offline/static/django_offline/js/edc_sync.js - About 35 mins to fix

          Function create_auth_token has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def create_auth_token(sender, instance, raw, created, **kwargs):
          Severity: Minor
          Found in django_collect_offline/models/signals.py - About 35 mins to fix

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

                var checkUSBConnection = $.ajax({
                    url: url,
                    type: 'GET',
                    dataType: 'json ',
                    processData: true,
            Severity: Major
            Found in django_collect_offline/static/django_offline/js/middleman.js and 6 other locations - About 35 mins to fix
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 63..69
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 154..160
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 225..231
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 245..251
            django_collect_offline/static/django_offline/js/middleman.js on lines 77..83
            django_collect_offline/static/django_offline/js/middleman.js on lines 108..116

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

                var ajExportBatch = $.ajax({
                    url: url,
                    type: 'GET',
                    dataType: 'json ',
                    processData: true,
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 154..160
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 225..231
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 245..251
            django_collect_offline/static/django_offline/js/middleman.js on lines 43..51
            django_collect_offline/static/django_offline/js/middleman.js on lines 77..83
            django_collect_offline/static/django_offline/js/middleman.js on lines 108..116

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

                var ajloadFile = $.ajax({
                    url: url,
                    type: 'GET',
                    dataType: 'json ',
                    processData: true,
            Severity: Major
            Found in django_collect_offline/static/django_offline/js/middleman.js and 6 other locations - About 35 mins to fix
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 63..69
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 154..160
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 225..231
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 245..251
            django_collect_offline/static/django_offline/js/middleman.js on lines 43..51
            django_collect_offline/static/django_offline/js/middleman.js on lines 77..83

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

                var ajPendingFiles = $.ajax({
                    url: url,
                    type: 'GET',
                    dataType: 'json ',
                    processData: true,
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 63..69
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 154..160
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 225..231
            django_collect_offline/static/django_offline/js/middleman.js on lines 43..51
            django_collect_offline/static/django_offline/js/middleman.js on lines 77..83
            django_collect_offline/static/django_offline/js/middleman.js on lines 108..116

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

                var isTransferred = $.ajax({
                    url: url,
                    type: 'GET',
                    dataType: 'json',
                    processData: true,
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 63..69
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 225..231
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 245..251
            django_collect_offline/static/django_offline/js/middleman.js on lines 43..51
            django_collect_offline/static/django_offline/js/middleman.js on lines 77..83
            django_collect_offline/static/django_offline/js/middleman.js on lines 108..116

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

                    var ajSaveConfirmation = $.ajax({
                        url: url,
                        type: 'GET',
                        dataType: 'json',
                        processData: true,
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 63..69
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 154..160
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 245..251
            django_collect_offline/static/django_offline/js/middleman.js on lines 43..51
            django_collect_offline/static/django_offline/js/middleman.js on lines 77..83
            django_collect_offline/static/django_offline/js/middleman.js on lines 108..116

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

                var ajDumpFile = $.ajax({
                    url: url,
                    type: 'GET',
                    dataType: 'json ',
                    processData: true,
            Severity: Major
            Found in django_collect_offline/static/django_offline/js/middleman.js and 6 other locations - About 35 mins to fix
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 63..69
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 154..160
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 225..231
            django_collect_offline/static/django_offline/js/file_transfer.js on lines 245..251
            django_collect_offline/static/django_offline/js/middleman.js on lines 43..51
            django_collect_offline/static/django_offline/js/middleman.js on lines 108..116

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

                    migrations.AlterField(
                        model_name="outgoingtransaction",
                        name="hostname_modified",
                        field=django_audit_fields.fields.hostname_modification_field.HostnameModificationField(
            Severity: Major
            Found in django_collect_offline/migrations/0003_auto_20190305_0123.py and 3 other locations - About 35 mins to fix
            django_collect_offline/migrations/0003_auto_20190305_0123.py on lines 21..24
            django_collect_offline/migrations/0003_auto_20190305_0123.py on lines 64..67
            django_collect_offline/migrations/0003_auto_20190305_0123.py on lines 150..153

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

            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

                    migrations.AlterField(
                        model_name="incomingtransaction",
                        name="hostname_modified",
                        field=django_audit_fields.fields.hostname_modification_field.HostnameModificationField(
            Severity: Major
            Found in django_collect_offline/migrations/0003_auto_20190305_0123.py and 3 other locations - About 35 mins to fix
            django_collect_offline/migrations/0003_auto_20190305_0123.py on lines 21..24
            django_collect_offline/migrations/0003_auto_20190305_0123.py on lines 107..110
            django_collect_offline/migrations/0003_auto_20190305_0123.py on lines 150..153

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

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

                    if "historical" not in instance._meta.label_lower:
                        try:
                            wrapped_instance = site_offline_models.get_wrapped_instance(instance)
                        except ModelNotRegistered:
                            pass
            Severity: Minor
            Found in django_collect_offline/models/signals.py and 2 other locations - About 35 mins to fix
            django_collect_offline/models/signals.py on lines 28..34
            django_collect_offline/models/signals.py on lines 63..68

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

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

                try:
                    wrapped_instance = site_offline_models.get_wrapped_instance(history_instance)
                except ModelNotRegistered:
                    pass
                else:
            Severity: Minor
            Found in django_collect_offline/models/signals.py and 2 other locations - About 35 mins to fix
            django_collect_offline/models/signals.py on lines 28..34
            django_collect_offline/models/signals.py on lines 44..50

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

            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