Showing 10,536 of 10,536 total issues

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

const RecentPurchasesTable = () => {
  const [isSelected, setIsSelected] = useState(false);

  return (
    <Card className="mb-3">
Severity: Major
Found in myems-web/src/components/MyEMS/Store/RecentPuchasesTable.js and 2 other locations - About 2 days to fix
myems-web/src/components/MyEMS/Shopfloor/RecentPuchasesTable.js on lines 7..47
myems-web/src/components/MyEMS/Tenant/RecentPuchasesTable.js on lines 7..47

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

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

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

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

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

Refactorings

Further Reading

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

        data: [{
          name: 'cmdList',
          hotkey: 'Ctrl+U',
          title: 'Unordered List',
          icon: { glyph: 'glyphicon glyphicon-list', fa: 'fa fa-list', 'fa-3': 'icon-list-ul' },
myems-admin/js/plugins/bootstrap-markdown/bootstrap-markdown.js on lines 1144..1189
myems-admin/js/plugins/bootstrap-markdown/bootstrap-markdown.js on lines 1229..1275

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

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 space_energy_input_item.py has 855 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: Major
Found in myems-aggregation/space_energy_input_item.py - About 2 days to fix

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

    const ProductFooter = ({ meta, handler }) => {
      const { isRTL } = useContext(AppContext);
      const { total, pageNo, itemsPerPage, nextPageNo, prevPageNo } = meta;
      const { nextPage, prevPage, currentPage } = handler;
    
    
    Severity: Major
    Found in myems-web/src/components/e-commerce/product/ProductFooter.js and 3 other locations - About 2 days to fix
    myems-web/src/components/MyEMS/EnergyStoragePowerStation/EnergyStoragePowerStationFooter.js on lines 9..35
    myems-web/src/components/MyEMS/Microgrid/MicrogridFooter.js on lines 9..35
    myems-web/src/components/MyEMS/Monitoring/EquipmentFooter.js on lines 9..35

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

    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

    const MicrogridFooter = ({ meta, handler }) => {
      const { isRTL } = useContext(AppContext);
      const { total, pageNo, itemsPerPage, nextPageNo, prevPageNo } = meta;
      const { nextPage, prevPage, currentPage } = handler;
    
    
    Severity: Major
    Found in myems-web/src/components/MyEMS/Microgrid/MicrogridFooter.js and 3 other locations - About 2 days to fix
    myems-web/src/components/MyEMS/EnergyStoragePowerStation/EnergyStoragePowerStationFooter.js on lines 9..35
    myems-web/src/components/MyEMS/Monitoring/EquipmentFooter.js on lines 9..35
    myems-web/src/components/e-commerce/product/ProductFooter.js on lines 9..35

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

    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

    const EquipmentFooter = ({ meta, handler }) => {
      const { isRTL } = useContext(AppContext);
      const { total, pageNo, itemsPerPage, nextPageNo, prevPageNo } = meta;
      const { nextPage, prevPage, currentPage } = handler;
    
    
    Severity: Major
    Found in myems-web/src/components/MyEMS/Monitoring/EquipmentFooter.js and 3 other locations - About 2 days to fix
    myems-web/src/components/MyEMS/EnergyStoragePowerStation/EnergyStoragePowerStationFooter.js on lines 9..35
    myems-web/src/components/MyEMS/Microgrid/MicrogridFooter.js on lines 9..35
    myems-web/src/components/e-commerce/product/ProductFooter.js on lines 9..35

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

    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

    const EnergyStoragePowerStationFooter = ({ meta, handler }) => {
      const { isRTL } = useContext(AppContext);
      const { total, pageNo, itemsPerPage, nextPageNo, prevPageNo } = meta;
      const { nextPage, prevPage, currentPage } = handler;
    
    
    myems-web/src/components/MyEMS/Microgrid/MicrogridFooter.js on lines 9..35
    myems-web/src/components/MyEMS/Monitoring/EquipmentFooter.js on lines 9..35
    myems-web/src/components/e-commerce/product/ProductFooter.js on lines 9..35

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

    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 Inspection.js has 853 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { createRef, Fragment, useEffect, useState } from 'react';
    import paginationFactory, { PaginationProvider } from 'react-bootstrap-table2-paginator';
    import BootstrapTable from 'react-bootstrap-table-next';
    import { toast } from 'react-toastify';
    import {
    Severity: Major
    Found in myems-web/src/components/MyEMS/WorkOrder/Inspection.js - About 2 days to fix

      File Installation.js has 853 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { createRef, Fragment, useEffect, useState } from 'react';
      import paginationFactory, { PaginationProvider } from 'react-bootstrap-table2-paginator';
      import BootstrapTable from 'react-bootstrap-table-next';
      import { toast } from 'react-toastify';
      import {
      Severity: Major
      Found in myems-web/src/components/MyEMS/WorkOrder/Installation.js - About 2 days to fix

        File Repair.js has 853 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { createRef, Fragment, useEffect, useState } from 'react';
        import paginationFactory, { PaginationProvider } from 'react-bootstrap-table2-paginator';
        import BootstrapTable from 'react-bootstrap-table-next';
        import { toast } from 'react-toastify';
        import {
        Severity: Major
        Found in myems-web/src/components/MyEMS/WorkOrder/Repair.js - About 2 days to fix

          File space_energy_input_category.py has 853 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: Major
          Found in myems-aggregation/space_energy_input_category.py - About 2 days to fix

            File offlinemeter.py has 853 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import uuid
            from datetime import datetime, timedelta
            import falcon
            import mysql.connector
            import simplejson as json
            Severity: Major
            Found in myems-api/core/offlinemeter.py - About 2 days to fix

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

                  $scope.editSVG = function(svg) {
                      var modalInstance = $uibModal.open({
                          windowClass: "animated fadeIn",
                          templateUrl: 'views/settings/svg/svg.model.html',
                          controller: 'ModalEditSVGCtrl',
              Severity: Major
              Found in myems-admin/app/controllers/settings/svg/svg.controller.js and 1 other location - About 2 days to fix
              myems-admin/app/controllers/settings/energyflowdiagram/energyflowdiagram.controller.js on lines 60..99

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

              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

                  $scope.editEnergyFlowDiagram = function(energyflowdiagram) {
                      var modalInstance = $uibModal.open({
                          windowClass: "animated fadeIn",
                          templateUrl: 'views/settings/energyflowdiagram/energyflowdiagram.model.html',
                          controller: 'ModalEditEnergyFlowDiagramCtrl',
              myems-admin/app/controllers/settings/svg/svg.controller.js on lines 60..99

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

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

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

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

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

              Refactorings

              Further Reading

              Function init has 409 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  return function init(element, initialOptions) {
                    // all of the animation functions should create
                    // a copy of the options data, however, if a
                    // parent service has already created a copy then
                    // we should stick to using that
              Severity: Major
              Found in myems-admin/js/angular/angular-animate.js - About 2 days to fix

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

                        modalInstance.result.then(function(virtualmeter) {
                            virtualmeter.energy_category_id = virtualmeter.energy_category.id;
                            if(angular.isDefined(virtualmeter.energy_item)) {
                                virtualmeter.energy_item_id = virtualmeter.energy_item.id;
                            } else {
                myems-admin/app/controllers/settings/meter/offlinemeter.controller.js on lines 78..108

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

                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

                        modalInstance.result.then(function(offlinemeter) {
                            offlinemeter.energy_category_id = offlinemeter.energy_category.id;
                            if(angular.isDefined(offlinemeter.energy_item)) {
                                offlinemeter.energy_item_id = offlinemeter.energy_item.id;
                            } else {
                myems-admin/app/controllers/settings/meter/virtualmeter.controller.js on lines 102..132

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

                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 generate_excel has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
                Open

                def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local,
                                   base_period_start_datetime, base_period_end_datetime, period_type, language):
                    trans = get_translation(language)
                    trans.install()
                    _ = trans.gettext
                Severity: Minor
                Found in myems-api/excelexporters/meterenergy.py - About 2 days to fix

                Cognitive Complexity

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

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

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

                Further reading

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

                                <tbody>
                                  <tr>
                                    <th scope="row">1</th>
                                    <td />
                                    <td />
                Severity: Major
                Found in myems-web/src/components/MyEMS/Microgrid/MicrogridDetails.js and 1 other location - About 2 days to fix
                myems-web/src/components/MyEMS/EnergyStoragePowerStation/EnergyStoragePowerStationDetails.js on lines 1026..1067

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

                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

                                  <tbody>
                                    <tr>
                                      <th scope="row">1</th>
                                      <td />
                                      <td />
                myems-web/src/components/MyEMS/Microgrid/MicrogridDetails.js on lines 679..720

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

                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