Showing 10,536 of 10,536 total issues

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

const TypedExample = () => (
  <Fragment>
    <PageHeader
      title="React Typed"
      description="This is a react component that wraps up the typed.js. Typed.js is a library that types. Enter in any string, and watch it type at the speed you've set, backspace what it's typed, and begin a new sentence for however many strings you've set."
Severity: Major
Found in myems-web/src/components/plugins/Typed.js and 1 other location - About 7 hrs to fix
myems-web/src/components/plugins/Toastify.js on lines 32..58

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

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

const Toastify = () => (
  <Fragment>
    <PageHeader
      title="React Toastify"
      description="By default, all toasts will inherit ToastContainer's props. Props defined on toast supersede ToastContainer's props. Props marked with * can only be set on the ToastContainer. The demo is not exhaustive, check the repo for more!"
Severity: Major
Found in myems-web/src/components/plugins/Toastify.js and 1 other location - About 7 hrs to fix
myems-web/src/components/plugins/Typed.js on lines 17..43

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

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

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

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

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

Refactorings

Further Reading

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

        if row is None:
            raise falcon.HTTPError(status=falcon.HTTP_404, title='API.NOT_FOUND',
                                   description='API.ENERGY_STORAGE_CONTAINER_NOT_FOUND')
        else:
            meta_result = {"id": row[0],
Severity: Major
Found in myems-api/core/energystoragecontainer.py and 1 other location - About 7 hrs to fix
myems-api/core/energystoragecontainer.py on lines 72..81

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

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

                meta_result = {"id": row[0],
                               "name": row[1],
                               "uuid": row[2],
                               "rated_capacity": row[3],
                               "rated_power": row[4],
Severity: Major
Found in myems-api/core/energystoragecontainer.py and 1 other location - About 7 hrs to fix
myems-api/core/energystoragecontainer.py on lines 282..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 114.

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 combined_equipment_energy_input_item.py has 472 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import random
import time
from datetime import datetime, timedelta
from decimal import Decimal
from multiprocessing import Pool
Severity: Minor
Found in myems-aggregation/combined_equipment_energy_input_item.py - About 7 hrs to fix

    File bootstrap-colorpicker-module.js has 470 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    angular.module('colorpicker.module', [])
        .factory('Helper', function () {
            return {
    Severity: Minor
    Found in myems-admin/js/plugins/colorpicker/bootstrap-colorpicker-module.js - About 7 hrs to fix

      File equipmentincome.py has 470 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import re
      from datetime import datetime, timedelta, timezone
      from decimal import Decimal
      import falcon
      import mysql.connector
      Severity: Minor
      Found in myems-api/reports/equipmentincome.py - About 7 hrs to fix

        File combined_equipment_energy_output_category.py has 469 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import random
        import time
        from datetime import datetime, timedelta
        from decimal import Decimal
        from multiprocessing import Pool
        Severity: Minor
        Found in myems-aggregation/combined_equipment_energy_output_category.py - About 7 hrs to fix

          File shopfloor_energy_input_item.py has 469 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import random
          import time
          from datetime import datetime, timedelta
          from decimal import Decimal
          from multiprocessing import Pool
          Severity: Minor
          Found in myems-aggregation/shopfloor_energy_input_item.py - About 7 hrs to fix

            File combined_equipment_energy_input_category.py has 469 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import random
            import time
            from datetime import datetime, timedelta
            from decimal import Decimal
            from multiprocessing import Pool
            Severity: Minor
            Found in myems-aggregation/combined_equipment_energy_input_category.py - About 7 hrs to fix

              Function on_get has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
              Open

                  def on_get(req, resp):
                      if 'API-KEY' not in req.headers or \
                              not isinstance(req.headers['API-KEY'], str) or \
                              len(str.strip(req.headers['API-KEY'])) == 0:
                          access_control(req)
              Severity: Minor
              Found in myems-api/reports/distributionsystem.py - About 7 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function on_put has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
              Open

                  def on_put(req, resp, id_, bid):
                      """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 7 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function on_get has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
              Open

                  def on_get(req, resp, id_):
                      if 'API-KEY' not in req.headers or \
                              not isinstance(req.headers['API-KEY'], str) or \
                              len(str.strip(req.headers['API-KEY'])) == 0:
                          access_control(req)
              Severity: Minor
              Found in myems-api/core/virtualmeter.py - About 7 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function on_get has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
              Open

                  def on_get(req, resp, id_):
                      if 'API-KEY' not in req.headers or \
                              not isinstance(req.headers['API-KEY'], str) or \
                              len(str.strip(req.headers['API-KEY'])) == 0:
                          access_control(req)
              Severity: Minor
              Found in myems-api/core/virtualmeter.py - About 7 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

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

                              $stateProvider
                                  .state('fdd', {
                                      abstract: true,
                                      url: "/fdd",
                                      templateUrl: "views/common/content.html",
              Severity: Major
              Found in myems-admin/app/config.router.js and 3 other locations - About 7 hrs to fix
              myems-admin/app/config.router.js on lines 37..199
              myems-admin/app/config.router.js on lines 37..243
              myems-admin/app/config.router.js on lines 37..287

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

              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 new_values['points'] is not None and len(new_values['points']) > 0:
                          for point in new_values['points']:
                              # todo: validate point properties
                              add_value = (" INSERT INTO tbl_points (name, data_source_id, object_type, units, "
                                           "                         high_limit, low_limit, higher_limit, lower_limit, ratio, "
              Severity: Major
              Found in myems-api/core/datasource.py and 1 other location - About 7 hrs to fix
              myems-api/core/datasource.py on lines 827..845

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

              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 meta_result['points'] is not None:
                          for point in meta_result['points']:
                              add_value = (" INSERT INTO tbl_points (name, data_source_id, object_type, units, "
                                           "                         high_limit, low_limit, higher_limit, lower_limit, ratio, "
                                           "                         is_trend, is_virtual, address, description) "
              Severity: Major
              Found in myems-api/core/datasource.py and 1 other location - About 7 hrs to fix
              myems-api/core/datasource.py on lines 713..732

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

              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 resourceFactory has 181 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    function resourceFactory(url, paramDefaults, actions, options) {
                      var route = new Route(url, options);
              
                      actions = extend({}, provider.defaults.actions, actions);
              
              
              Severity: Major
              Found in myems-admin/js/angular/angular-resource.js - About 7 hrs to fix

                Function Calendar has 181 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const Calendar = () => {
                  const calendarRef = useRef();
                  const [calendarApi, setCalendarApi] = useState({});
                  const [title, setTitle] = useState('');
                  const [currentFilter, setCurrentFilter] = useState('Month View');
                Severity: Major
                Found in myems-web/src/components/calendar/Calendar.js - About 7 hrs to fix

                  File directives.js has 468 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /**
                   * INSPINIA - Responsive Admin Theme
                   *
                   * Main directives.js file
                   * Define directives for used plugin
                  Severity: Minor
                  Found in myems-admin/app/directives/directives.js - About 7 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language