fossasia/open-event-orga-server

View on GitHub

Showing 1,194 of 1,194 total issues

Function validate_date has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def validate_date(event, data):
    if event:
        if 'starts_at' not in data:
            data['starts_at'] = event.starts_at

Severity: Minor
Found in app/api/events.py - About 55 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

Function before_update_object has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def before_update_object(self, feedback, data, view_kwargs):
        """
        before update object method of feedback details
        :param feedback:
        :param data:
Severity: Minor
Found in app/api/feedbacks.py - About 55 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

Function query has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def query(self, view_kwargs):
        query_ = UserFavouriteSession.query
        if view_kwargs.get('user_id'):
            user = safe_query_kwargs(User, view_kwargs, 'user_id')
            if user != current_user and not (
Severity: Minor
Found in app/api/user_favourite_sessions.py - About 55 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

Function before_create_object has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def before_create_object(self, data, view_kwargs):
        """
        before create object method for AccessCodeListPost Class
        :param data:
        :param view_kwargs:
Severity: Minor
Found in app/api/access_codes.py - About 55 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

Function create_save_resized_image has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def create_save_resized_image(
    image_file,
    basewidth=None,
    maintain_aspect=None,
    height_size=None,
Severity: Minor
Found in app/api/helpers/files.py - About 55 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

Function export_event_json has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def export_event_json(event_id, settings):
    """
    Exports the event as a zip on the server and return its path
    """
    # make directory
Severity: Minor
Found in app/api/helpers/export_helpers.py - About 55 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

Function get_track_stats has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def get_track_stats(track_ids, check_in_attendee, check_out_attendee, current_time):
    """
    get track stats
    @param track_ids: track_ids
    @param check_in_attendee: check_in_attendee
Severity: Minor
Found in app/api/custom/check_in_stats.py - About 55 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

Function change_password has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def change_password():
    old_password = request.json['data']['old-password']
    new_password = request.json['data']['new-password']

    try:
Severity: Minor
Found in app/api/auth.py - About 55 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

Function create_object has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def create_object(self, data, view_kwargs):
        identifier = 'identifier'

        if view_kwargs.get('identifier').isdigit():
            identifier = 'id'
Severity: Minor
Found in app/api/data_layers/EventCopyLayer.py - About 55 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

Function create_file_csv has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def create_file_csv(userCheckIns):
    headers = [
        'Ticket Id',
        'Date Time',
        'Track Name',
Severity: Minor
Found in app/api/helpers/user_check_in.py - About 55 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

Function uploaded_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def uploaded_file(files, multiple=False):
    if multiple:
        files_uploaded = []
        for file in files:
            extension = file.filename.split('.')[1]
Severity: Minor
Found in app/api/helpers/files.py - About 55 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

Function print_badge_pdf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def print_badge_pdf():
    """Print Badge Template PDF"""
    from ..helpers.tasks import create_print_badge_pdf

    if not request.args.get('attendee_id', False):
Severity: Minor
Found in app/api/custom/badge_forms.py - About 55 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

Function event_query has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def event_query(
    query_,
    view_kwargs,
    event_id='event_id',
    event_identifier='event_identifier',
Severity: Minor
Found in app/api/helpers/query.py - About 55 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

Function before_get_object has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def before_get_object(self, view_kwargs):
        """
        before get method to get the resource id for fetching details
        :param view_kwargs:
        :return:
Severity: Minor
Found in app/api/event_topics.py - About 55 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

Function before_get_object has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def before_get_object(self, view_kwargs):
        """
        before get method to get the resource id to fetch details
        :param view_kwargs:
        :return:
Severity: Minor
Found in app/api/event_sub_topics.py - About 55 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 38 locations. Consider refactoring.
Open

    exhibitors = Relationship(
        self_view='v1.event_exhibitor',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.exhibitor_list',
        related_view_kwargs={'event_id': '<id>'},
Severity: Major
Found in app/api/schema/events.py and 37 other locations - About 55 mins to fix
app/api/schema/access_codes.py on lines 103..107
app/api/schema/custom_system_roles.py on lines 24..28
app/api/schema/discount_codes.py on lines 128..132
app/api/schema/discount_codes.py on lines 268..272
app/api/schema/events.py on lines 124..128
app/api/schema/events.py on lines 133..137
app/api/schema/events.py on lines 142..146
app/api/schema/events.py on lines 151..155
app/api/schema/events.py on lines 160..164
app/api/schema/events.py on lines 493..497
app/api/schema/events.py on lines 502..506
app/api/schema/faq_types.py on lines 32..36
app/api/schema/groups.py on lines 81..85
app/api/schema/session_types.py on lines 54..58
app/api/schema/sessions.py on lines 161..165
app/api/schema/sessions.py on lines 207..211
app/api/schema/sessions.py on lines 216..220
app/api/schema/speakers.py on lines 83..87
app/api/schema/ticket_tags.py on lines 25..29
app/api/schema/tickets.py on lines 152..156
app/api/schema/tickets.py on lines 170..174
app/api/schema/tracks.py on lines 54..58
app/api/schema/users.py on lines 108..112
app/api/schema/users.py on lines 127..131
app/api/schema/users.py on lines 162..166
app/api/schema/users.py on lines 171..175
app/api/schema/users.py on lines 190..194
app/api/schema/users.py on lines 199..203
app/api/schema/users.py on lines 217..221
app/api/schema/users.py on lines 226..230
app/api/schema/users.py on lines 235..239
app/api/schema/users.py on lines 244..248
app/api/schema/users.py on lines 253..257
app/api/schema/users.py on lines 262..266
app/api/schema/users.py on lines 271..275
app/api/schema/users.py on lines 280..284
app/api/schema/users.py on lines 289..293

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

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

    sessions = Relationship(
        self_view='v1.session_type_sessions',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.session_list',
        related_view_kwargs={'session_type_id': '<id>'},
Severity: Major
Found in app/api/schema/session_types.py and 37 other locations - About 55 mins to fix
app/api/schema/access_codes.py on lines 103..107
app/api/schema/custom_system_roles.py on lines 24..28
app/api/schema/discount_codes.py on lines 128..132
app/api/schema/discount_codes.py on lines 268..272
app/api/schema/events.py on lines 124..128
app/api/schema/events.py on lines 133..137
app/api/schema/events.py on lines 142..146
app/api/schema/events.py on lines 151..155
app/api/schema/events.py on lines 160..164
app/api/schema/events.py on lines 363..367
app/api/schema/events.py on lines 493..497
app/api/schema/events.py on lines 502..506
app/api/schema/faq_types.py on lines 32..36
app/api/schema/groups.py on lines 81..85
app/api/schema/sessions.py on lines 161..165
app/api/schema/sessions.py on lines 207..211
app/api/schema/sessions.py on lines 216..220
app/api/schema/speakers.py on lines 83..87
app/api/schema/ticket_tags.py on lines 25..29
app/api/schema/tickets.py on lines 152..156
app/api/schema/tickets.py on lines 170..174
app/api/schema/tracks.py on lines 54..58
app/api/schema/users.py on lines 108..112
app/api/schema/users.py on lines 127..131
app/api/schema/users.py on lines 162..166
app/api/schema/users.py on lines 171..175
app/api/schema/users.py on lines 190..194
app/api/schema/users.py on lines 199..203
app/api/schema/users.py on lines 217..221
app/api/schema/users.py on lines 226..230
app/api/schema/users.py on lines 235..239
app/api/schema/users.py on lines 244..248
app/api/schema/users.py on lines 253..257
app/api/schema/users.py on lines 262..266
app/api/schema/users.py on lines 271..275
app/api/schema/users.py on lines 280..284
app/api/schema/users.py on lines 289..293

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

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

    groups = Relationship(
        self_view='v1.user_group',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.group_list',
        related_view_kwargs={'user_id': '<id>'},
Severity: Major
Found in app/api/schema/users.py and 37 other locations - About 55 mins to fix
app/api/schema/access_codes.py on lines 103..107
app/api/schema/custom_system_roles.py on lines 24..28
app/api/schema/discount_codes.py on lines 128..132
app/api/schema/discount_codes.py on lines 268..272
app/api/schema/events.py on lines 124..128
app/api/schema/events.py on lines 133..137
app/api/schema/events.py on lines 142..146
app/api/schema/events.py on lines 151..155
app/api/schema/events.py on lines 160..164
app/api/schema/events.py on lines 363..367
app/api/schema/events.py on lines 493..497
app/api/schema/events.py on lines 502..506
app/api/schema/faq_types.py on lines 32..36
app/api/schema/groups.py on lines 81..85
app/api/schema/session_types.py on lines 54..58
app/api/schema/sessions.py on lines 161..165
app/api/schema/sessions.py on lines 207..211
app/api/schema/sessions.py on lines 216..220
app/api/schema/speakers.py on lines 83..87
app/api/schema/ticket_tags.py on lines 25..29
app/api/schema/tickets.py on lines 152..156
app/api/schema/tickets.py on lines 170..174
app/api/schema/tracks.py on lines 54..58
app/api/schema/users.py on lines 108..112
app/api/schema/users.py on lines 127..131
app/api/schema/users.py on lines 162..166
app/api/schema/users.py on lines 171..175
app/api/schema/users.py on lines 199..203
app/api/schema/users.py on lines 217..221
app/api/schema/users.py on lines 226..230
app/api/schema/users.py on lines 235..239
app/api/schema/users.py on lines 244..248
app/api/schema/users.py on lines 253..257
app/api/schema/users.py on lines 262..266
app/api/schema/users.py on lines 271..275
app/api/schema/users.py on lines 280..284
app/api/schema/users.py on lines 289..293

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

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

    alternate_emails = Relationship(
        self_view='v1.user_emails',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.user_emails_list',
        related_view_kwargs={'user_id': '<id>'},
Severity: Major
Found in app/api/schema/users.py and 37 other locations - About 55 mins to fix
app/api/schema/access_codes.py on lines 103..107
app/api/schema/custom_system_roles.py on lines 24..28
app/api/schema/discount_codes.py on lines 128..132
app/api/schema/discount_codes.py on lines 268..272
app/api/schema/events.py on lines 124..128
app/api/schema/events.py on lines 133..137
app/api/schema/events.py on lines 142..146
app/api/schema/events.py on lines 151..155
app/api/schema/events.py on lines 160..164
app/api/schema/events.py on lines 363..367
app/api/schema/events.py on lines 493..497
app/api/schema/events.py on lines 502..506
app/api/schema/faq_types.py on lines 32..36
app/api/schema/groups.py on lines 81..85
app/api/schema/session_types.py on lines 54..58
app/api/schema/sessions.py on lines 161..165
app/api/schema/sessions.py on lines 207..211
app/api/schema/sessions.py on lines 216..220
app/api/schema/speakers.py on lines 83..87
app/api/schema/ticket_tags.py on lines 25..29
app/api/schema/tickets.py on lines 152..156
app/api/schema/tickets.py on lines 170..174
app/api/schema/tracks.py on lines 54..58
app/api/schema/users.py on lines 108..112
app/api/schema/users.py on lines 127..131
app/api/schema/users.py on lines 162..166
app/api/schema/users.py on lines 190..194
app/api/schema/users.py on lines 199..203
app/api/schema/users.py on lines 217..221
app/api/schema/users.py on lines 226..230
app/api/schema/users.py on lines 235..239
app/api/schema/users.py on lines 244..248
app/api/schema/users.py on lines 253..257
app/api/schema/users.py on lines 262..266
app/api/schema/users.py on lines 271..275
app/api/schema/users.py on lines 280..284
app/api/schema/users.py on lines 289..293

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

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

    speaker_invites = Relationship(
        self_view='v1.session_speaker_invites',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.speaker_invite_list',
        related_view_kwargs={'session_id': '<id>'},
Severity: Major
Found in app/api/schema/sessions.py and 37 other locations - About 55 mins to fix
app/api/schema/access_codes.py on lines 103..107
app/api/schema/custom_system_roles.py on lines 24..28
app/api/schema/discount_codes.py on lines 128..132
app/api/schema/discount_codes.py on lines 268..272
app/api/schema/events.py on lines 124..128
app/api/schema/events.py on lines 133..137
app/api/schema/events.py on lines 142..146
app/api/schema/events.py on lines 151..155
app/api/schema/events.py on lines 160..164
app/api/schema/events.py on lines 363..367
app/api/schema/events.py on lines 493..497
app/api/schema/events.py on lines 502..506
app/api/schema/faq_types.py on lines 32..36
app/api/schema/groups.py on lines 81..85
app/api/schema/session_types.py on lines 54..58
app/api/schema/sessions.py on lines 161..165
app/api/schema/sessions.py on lines 207..211
app/api/schema/speakers.py on lines 83..87
app/api/schema/ticket_tags.py on lines 25..29
app/api/schema/tickets.py on lines 152..156
app/api/schema/tickets.py on lines 170..174
app/api/schema/tracks.py on lines 54..58
app/api/schema/users.py on lines 108..112
app/api/schema/users.py on lines 127..131
app/api/schema/users.py on lines 162..166
app/api/schema/users.py on lines 171..175
app/api/schema/users.py on lines 190..194
app/api/schema/users.py on lines 199..203
app/api/schema/users.py on lines 217..221
app/api/schema/users.py on lines 226..230
app/api/schema/users.py on lines 235..239
app/api/schema/users.py on lines 244..248
app/api/schema/users.py on lines 253..257
app/api/schema/users.py on lines 262..266
app/api/schema/users.py on lines 271..275
app/api/schema/users.py on lines 280..284
app/api/schema/users.py on lines 289..293

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

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