Showing 10,536 of 10,536 total issues

Function on_post has a Cognitive Complexity of 51 (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/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

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

        if requires_authentication:
            if 'user_name' not in new_values['data'].keys() or \
                    not isinstance(new_values['data']['user_name'], str) or \
                    len(str.strip(new_values['data']['user_name'])) == 0:
                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
Severity: Major
Found in myems-api/core/emailserver.py and 1 other location - About 7 hrs to fix
myems-api/core/emailserver.py on lines 82..90

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

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 in range(0, len(time)):
                col = 'B'
                row = str(start_detail_data_row_num + 1 + i)
                # col = chr(ord('B') + i)
                ws[col + row].font = title_font
Severity: Major
Found in myems-api/excelexporters/metercomparison.py and 1 other location - About 7 hrs to fix
myems-api/excelexporters/combinedequipmentenergycategory.py on lines 899..906

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

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 requires_authentication:
            if 'user_name' not in new_values['data'].keys() or \
                    not isinstance(new_values['data']['user_name'], str) or \
                    len(str.strip(new_values['data']['user_name'])) == 0:
                raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
Severity: Major
Found in myems-api/core/emailserver.py and 1 other location - About 7 hrs to fix
myems-api/core/emailserver.py on lines 250..258

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

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 in range(0, len(time)):
                    col = 'B'
                    row = str(table_row+1 + i)
                    # col = chr(ord('B') + i)
                    ws[col + row].font = title_font
Severity: Major
Found in myems-api/excelexporters/combinedequipmentenergycategory.py and 1 other location - About 7 hrs to fix
myems-api/excelexporters/metercomparison.py on lines 276..283

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

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

import React, { Fragment, useEffect, useState, useContext } from 'react';
import CountUp from 'react-countup';
import { Col, Row, Spinner, Nav, NavItem, NavLink, TabContent, TabPane } from 'reactstrap';
import EnergyStoragePowerStationTableCard from './EnergyStoragePowerStationTableCard';
import CardSummary from '../common/CardSummary';
Severity: Minor
Found in myems-web/src/components/MyEMS/EnergyStoragePowerStation/Dashboard.js - About 7 hrs to fix

    File CollectionDashboard.js has 496 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { Fragment, useEffect, useState, useContext } from 'react';
    import CountUp from 'react-countup';
    import { Col, Row, Spinner, Nav, NavItem, NavLink, TabContent, TabPane } from 'reactstrap';
    import EnergyStoragePowerStationTableCard from './EnergyStoragePowerStationTableCard';
    import CardSummary from '../common/CardSummary';

      File equipmentenergyitem.py has 496 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/equipmentenergyitem.py - About 7 hrs to fix

        File distributioncircuit.py has 496 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import uuid
        import falcon
        import mysql.connector
        import simplejson as json
        from core.useractivity import user_logger, admin_control, access_control, api_key_control
        Severity: Minor
        Found in myems-api/core/distributioncircuit.py - About 7 hrs to fix

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

          (function (angular) {
              'use strict';
          
              angular.module('oc.lazyLoad').config(["$provide", function ($provide) {
                  $provide.decorator('$ocLazyLoad', ["$delegate", "$q", function ($delegate, $q) {
          Severity: Major
          Found in myems-admin/js/plugins/oclazyload/ocLazyLoad.js and 1 other location - About 7 hrs to fix
          myems-admin/js/plugins/oclazyload/ocLazyLoad.js on lines 1183..1212

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

          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

                  b.allowEvents &&
                    (h =
                      1 == b.options.checkBoxSettings.threeState
                        ? angular.isDefined(c.events) && c.events.itemCheckstateChanging
                          ? c.events.itemCheckstateChanging({ item: d, value: a })
          Severity: Major
          Found in myems-admin/js/jcui/angular.integralui.treeview.min.js and 1 other location - About 7 hrs to fix
          myems-admin/js/jcui/angular.integralui.treeview.min.js on lines 533..541

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

          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

          (function (angular) {
              'use strict';
          
              angular.module('oc.lazyLoad').config(["$provide", function ($provide) {
                  $provide.decorator('$ocLazyLoad', ["$delegate", "$q", function ($delegate, $q) {
          Severity: Major
          Found in myems-admin/js/plugins/oclazyload/ocLazyLoad.js and 1 other location - About 7 hrs to fix
          myems-admin/js/plugins/oclazyload/ocLazyLoad.js on lines 1213..1242

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

          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

                  b.allowEvents &&
                    (retValue =
                      1 == b.options.checkBoxSettings.threeState
                        ? angular.isDefined(c.events) && c.events.itemCheckstateChanged
                          ? c.events.itemCheckstateChanged({ item: d, value: a })
          Severity: Major
          Found in myems-admin/js/jcui/angular.integralui.treeview.min.js and 1 other location - About 7 hrs to fix
          myems-admin/js/jcui/angular.integralui.treeview.min.js on lines 521..529

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

          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 equipmentcost.py has 494 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/equipmentcost.py - About 7 hrs to fix

            File metersaving.py has 494 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/metersaving.py - About 7 hrs to fix

              File meterplan.py has 494 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/meterplan.py - About 7 hrs to fix

                File equipmentcarbon.py has 494 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/equipmentcarbon.py - About 7 hrs to fix

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

                          <Row form>
                            <Col sm tag={FormGroup}>
                              <Label for="endDate">End Date</Label>
                              <Datetime
                                timeFormat={false}
                  Severity: Major
                  Found in myems-web/src/components/event/EventDetailsForm.js and 1 other location - About 7 hrs to fix
                  myems-web/src/components/event/EventDetailsForm.js on lines 43..63

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

                  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 EducationInput = ({ id, label, type, ...rest }) => (
                    <FormGroup className="form-group">
                      <Row>
                        <Col lg={3} className="text-lg-right">
                          <Label className="mb-0" htmlFor={id}>
                  Severity: Major
                  Found in myems-web/src/components/education/EducationInput.js and 1 other location - About 7 hrs to fix
                  myems-web/src/components/experience/ExperienceInput.js on lines 6..19

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

                  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 ExperienceInput = ({ id, label, type, ...rest }) => (
                    <FormGroup className="form-group">
                      <Row>
                        <Col lg={3} className="text-lg-right">
                          <Label className="mb-0" htmlFor={id}>
                  Severity: Major
                  Found in myems-web/src/components/experience/ExperienceInput.js and 1 other location - About 7 hrs to fix
                  myems-web/src/components/education/EducationInput.js on lines 6..19

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

                  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