opsforgeio/cabot

View on GitHub
cabot/cabotapp/migrations/0001_initial.py

Summary

Maintainability
F
5 days
Test Coverage

File 0001_initial.py has 282 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
Severity: Minor
Found in cabot/cabotapp/migrations/0001_initial.py - About 2 hrs to fix

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

            'cabotapp.service': {
                'Meta': {'ordering': "['name']", 'object_name': 'Service'},
                'alerts_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
                'email_alert': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
                'hackpad_id': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
    Severity: Major
    Found in cabot/cabotapp/migrations/0001_initial.py and 3 other locations - About 1 day to fix
    cabot/cabotapp/migrations/0002_auto__add_field_statuscheck_verify_ssl_certificate.py on lines 52..67
    cabot/cabotapp/migrations/0003_auto.py on lines 56..71
    cabot/cabotapp/migrations/0004_auto.py on lines 50..65

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

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

            'auth.user': {
                'Meta': {'object_name': 'User'},
                'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
                'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
                'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
    Severity: Major
    Found in cabot/cabotapp/migrations/0001_initial.py and 7 other locations - About 1 day to fix
    cabot/cabotapp/migrations/0002_auto__add_field_statuscheck_verify_ssl_certificate.py on lines 36..50
    cabot/cabotapp/migrations/0003_auto.py on lines 40..54
    cabot/cabotapp/migrations/0004_auto.py on lines 34..48
    cabot/cabotapp/migrations/0005_auto__add_instance.py on lines 81..95
    cabot/cabotapp/migrations/0006_auto__chg_field_statuscheck_created_by.py on lines 34..48
    cabot/cabotapp/migrations/0007_auto__add_instancestatussnapshot.py on lines 44..58
    cabot/cabotapp/migrations/0008_auto__add_field_statuscheckresult_job_number.py on lines 36..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 155.

    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

            'cabotapp.servicestatussnapshot': {
                'Meta': {'object_name': 'ServiceStatusSnapshot'},
                'did_send_alert': ('django.db.models.fields.IntegerField', [], {'default': 'False'}),
                'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
                'num_checks_active': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
    Severity: Major
    Found in cabot/cabotapp/migrations/0001_initial.py and 1 other location - About 5 hrs to fix
    cabot/cabotapp/migrations/0002_auto__add_field_statuscheck_verify_ssl_certificate.py on lines 69..78

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

    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

            'cabotapp.statuscheckresult': {
                'Meta': {'object_name': 'StatusCheckResult'},
                'check': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cabotapp.StatusCheck']"}),
                'error': ('django.db.models.fields.TextField', [], {'null': 'True'}),
                'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
    Severity: Major
    Found in cabot/cabotapp/migrations/0001_initial.py and 1 other location - About 4 hrs to fix
    cabot/cabotapp/migrations/0002_auto__add_field_statuscheck_verify_ssl_certificate.py on lines 115..123

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

            db.create_table('cabotapp_service_users_to_notify', (
                ('id', models.AutoField(verbose_name='ID',
                 primary_key=True, auto_created=True)),
                ('service',
                 models.ForeignKey(orm['cabotapp.service'], null=False)),
    Severity: Major
    Found in cabot/cabotapp/migrations/0001_initial.py and 4 other locations - About 3 hrs to fix
    cabot/cabotapp/migrations/0001_initial.py on lines 50..56
    cabot/cabotapp/migrations/0005_auto__add_instance.py on lines 29..32
    cabot/cabotapp/migrations/0005_auto__add_instance.py on lines 37..40
    cabot/cabotapp/migrations/0005_auto__add_instance.py on lines 45..48

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

            db.create_table('cabotapp_service_status_checks', (
                ('id', models.AutoField(verbose_name='ID',
                 primary_key=True, auto_created=True)),
                ('service',
                 models.ForeignKey(orm['cabotapp.service'], null=False)),
    Severity: Major
    Found in cabot/cabotapp/migrations/0001_initial.py and 4 other locations - About 3 hrs to fix
    cabot/cabotapp/migrations/0001_initial.py on lines 39..44
    cabot/cabotapp/migrations/0005_auto__add_instance.py on lines 29..32
    cabot/cabotapp/migrations/0005_auto__add_instance.py on lines 37..40
    cabot/cabotapp/migrations/0005_auto__add_instance.py on lines 45..48

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

    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