Showing 10,536 of 10,536 total issues

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

            for (i = 0; i < axisCount; ++i) {

                axisOptions = options.yaxes[i];
                if (axisOptions && !axisOptions.tickColor) {
                    axisOptions.tickColor = axisOptions.color;
Severity: Major
Found in myems-admin/js/plugins/flot/jquery.flot.js and 1 other location - About 1 day to fix
myems-admin/js/plugins/flot/jquery.flot.js on lines 782..801

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

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 (i = 0; i < axisCount; ++i) {

                axisOptions = options.xaxes[i];
                if (axisOptions && !axisOptions.tickColor) {
                    axisOptions.tickColor = axisOptions.color;
Severity: Major
Found in myems-admin/js/plugins/flot/jquery.flot.js and 1 other location - About 1 day to fix
myems-admin/js/plugins/flot/jquery.flot.js on lines 804..823

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

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

File virtualmeter.controller.js has 539 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

app.controller('VirtualMeterController', function($scope, $rootScope, $window, $uibModal, $translate,
    MeterService,
    VirtualMeterService,
Severity: Major
Found in myems-admin/app/controllers/settings/meter/virtualmeter.controller.js - About 1 day to fix

    Function aggregate_hourly_data_by_period has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

    def aggregate_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetime_utc, period_type):
        # todo: validate parameters
        if start_datetime_utc is None or \
                end_datetime_utc is None or \
                start_datetime_utc >= end_datetime_utc or \
    Severity: Minor
    Found in myems-api/core/utilities.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 on_post has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_post(req, resp):
            """Handles POST requests"""
            admin_control(req)
            try:
                raw_json = req.stream.read().decode('utf-8')
    Severity: Minor
    Found in myems-api/core/energyflowdiagram.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 on_put has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_put(req, resp, id_, pid):
            """Handles PUT requests"""
            admin_control(req)
            try:
                raw_json = req.stream.read().decode('utf-8')
    Severity: Minor
    Found in myems-api/core/energystoragecontainer.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 on_post has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_post(req, resp, id_):
            """Handles POST requests"""
            admin_control(req)
            try:
                raw_json = req.stream.read().decode('utf-8')
    Severity: Minor
    Found in myems-api/core/energystoragecontainer.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

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

            if 'energy_item_id' in new_values['data'].keys() and \
                    new_values['data']['energy_item_id'] is not None:
                if not isinstance(new_values['data']['energy_item_id'], int) or \
                        new_values['data']['energy_item_id'] <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
    Severity: Major
    Found in myems-api/core/meter.py and 7 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 714..722
    myems-api/core/offlinemeter.py on lines 149..157
    myems-api/core/offlinemeter.py on lines 541..549
    myems-api/core/offlinemeter.py on lines 793..801
    myems-api/core/virtualmeter.py on lines 183..191
    myems-api/core/virtualmeter.py on lines 689..697
    myems-api/core/virtualmeter.py on lines 1061..1069

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

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

            if 'energy_item_id' in new_values['data'].keys() and \
                    new_values['data']['energy_item_id'] is not None:
                if not isinstance(new_values['data']['energy_item_id'], int) or \
                        new_values['data']['energy_item_id'] <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
    Severity: Major
    Found in myems-api/core/meter.py and 7 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 162..170
    myems-api/core/offlinemeter.py on lines 149..157
    myems-api/core/offlinemeter.py on lines 541..549
    myems-api/core/offlinemeter.py on lines 793..801
    myems-api/core/virtualmeter.py on lines 183..191
    myems-api/core/virtualmeter.py on lines 689..697
    myems-api/core/virtualmeter.py on lines 1061..1069

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

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

            if 'id' in new_values['energy_item'].keys() and \
                    new_values['energy_item']['id'] is not None:
                if not isinstance(new_values['energy_item']['id'], int) or \
                        new_values['energy_item']['id'] <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
    Severity: Major
    Found in myems-api/core/offlinemeter.py and 7 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 162..170
    myems-api/core/meter.py on lines 714..722
    myems-api/core/offlinemeter.py on lines 149..157
    myems-api/core/offlinemeter.py on lines 541..549
    myems-api/core/virtualmeter.py on lines 183..191
    myems-api/core/virtualmeter.py on lines 689..697
    myems-api/core/virtualmeter.py on lines 1061..1069

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

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

            if 'energy_item_id' in new_values['data'].keys() and \
                    new_values['data']['energy_item_id'] is not None:
                if not isinstance(new_values['data']['energy_item_id'], int) or \
                        new_values['data']['energy_item_id'] <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
    Severity: Major
    Found in myems-api/core/offlinemeter.py and 7 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 162..170
    myems-api/core/meter.py on lines 714..722
    myems-api/core/offlinemeter.py on lines 149..157
    myems-api/core/offlinemeter.py on lines 793..801
    myems-api/core/virtualmeter.py on lines 183..191
    myems-api/core/virtualmeter.py on lines 689..697
    myems-api/core/virtualmeter.py on lines 1061..1069

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

    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 pcs_run_state_point_value is None:
                        pcs_run_state = 'Unknown'
                    elif pcs_run_state_point_value == 0:
                        pcs_run_state = 'Shutdown'
                    elif pcs_run_state_point_value == 1:
    Severity: Major
    Found in myems-api/reports/energystoragepowerstationlist.py and 1 other location - About 1 day to fix
    myems-api/reports/energystoragepowerstationlist.py on lines 186..205

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

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

            if 'id' in new_values['energy_item'].keys() and \
                    new_values['energy_item']['id'] is not None:
                if not isinstance(new_values['energy_item']['id'], int) or \
                        new_values['energy_item']['id'] <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
    Severity: Major
    Found in myems-api/core/virtualmeter.py and 7 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 162..170
    myems-api/core/meter.py on lines 714..722
    myems-api/core/offlinemeter.py on lines 149..157
    myems-api/core/offlinemeter.py on lines 541..549
    myems-api/core/offlinemeter.py on lines 793..801
    myems-api/core/virtualmeter.py on lines 183..191
    myems-api/core/virtualmeter.py on lines 689..697

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

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

            if 'energy_item_id' in new_values['data'].keys() and \
                    new_values['data']['energy_item_id'] is not None:
                if not isinstance(new_values['data']['energy_item_id'], int) or \
                        new_values['data']['energy_item_id'] <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
    Severity: Major
    Found in myems-api/core/virtualmeter.py and 7 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 162..170
    myems-api/core/meter.py on lines 714..722
    myems-api/core/offlinemeter.py on lines 149..157
    myems-api/core/offlinemeter.py on lines 541..549
    myems-api/core/offlinemeter.py on lines 793..801
    myems-api/core/virtualmeter.py on lines 183..191
    myems-api/core/virtualmeter.py on lines 1061..1069

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

    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

            if 'lower_limit' not in new_values['data'].keys() or \
                    new_values['data']['lower_limit'] is None:
                lower_limit = None
            elif not (isinstance(new_values['data']['lower_limit'], float) or
                      isinstance(new_values['data']['lower_limit'], int)):
    Severity: Major
    Found in myems-api/core/point.py and 3 other locations - About 1 day to fix
    myems-api/core/point.py on lines 126..134
    myems-api/core/point.py on lines 727..735
    myems-api/core/point.py on lines 738..746

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

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

            if 'energy_item_id' in new_values['data'].keys() and \
                    new_values['data']['energy_item_id'] is not None:
                if not isinstance(new_values['data']['energy_item_id'], int) or \
                        new_values['data']['energy_item_id'] <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
    Severity: Major
    Found in myems-api/core/offlinemeter.py and 7 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 162..170
    myems-api/core/meter.py on lines 714..722
    myems-api/core/offlinemeter.py on lines 541..549
    myems-api/core/offlinemeter.py on lines 793..801
    myems-api/core/virtualmeter.py on lines 183..191
    myems-api/core/virtualmeter.py on lines 689..697
    myems-api/core/virtualmeter.py on lines 1061..1069

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

    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

            if 'lower_limit' not in new_values['data'].keys() or \
                    new_values['data']['lower_limit'] is None:
                lower_limit = None
            elif not (isinstance(new_values['data']['lower_limit'], float) or
                      isinstance(new_values['data']['lower_limit'], int)):
    Severity: Major
    Found in myems-api/core/point.py and 3 other locations - About 1 day to fix
    myems-api/core/point.py on lines 126..134
    myems-api/core/point.py on lines 137..145
    myems-api/core/point.py on lines 727..735

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

    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

                    meta_result = {"id": row[0],
                                   "recipient_name": row[1],
                                   "recipient_openid": row[2],
                                   "message_template_id": row[3],
                                   "message_data": row[4],
    Severity: Major
    Found in myems-api/core/wechatmessage.py and 1 other location - About 1 day to fix
    myems-api/core/wechatmessage.py on lines 287..295

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

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

            if 'energy_item_id' in new_values['data'].keys() and \
                    new_values['data']['energy_item_id'] is not None:
                if not isinstance(new_values['data']['energy_item_id'], int) or \
                        new_values['data']['energy_item_id'] <= 0:
                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
    Severity: Major
    Found in myems-api/core/virtualmeter.py and 7 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 162..170
    myems-api/core/meter.py on lines 714..722
    myems-api/core/offlinemeter.py on lines 149..157
    myems-api/core/offlinemeter.py on lines 541..549
    myems-api/core/offlinemeter.py on lines 793..801
    myems-api/core/virtualmeter.py on lines 689..697
    myems-api/core/virtualmeter.py on lines 1061..1069

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

    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

            if 'higher_limit' not in new_values['data'].keys() or \
                    new_values['data']['higher_limit'] is None:
                higher_limit = None
            elif not (isinstance(new_values['data']['higher_limit'], float) or
                      isinstance(new_values['data']['higher_limit'], int)):
    Severity: Major
    Found in myems-api/core/point.py and 3 other locations - About 1 day to fix
    myems-api/core/point.py on lines 137..145
    myems-api/core/point.py on lines 727..735
    myems-api/core/point.py on lines 738..746

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

    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