Showing 5,781 of 10,536 total issues

Function EnterProduction has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

const EnterProduction = ({ setRedirect, setRedirectUrl, t }) => {
  let current_moment = moment();
  useEffect(() => {
    let is_logged_in = getCookieValue('is_logged_in');
    let user_name = getCookieValue('user_name');
Severity: Minor
Found in myems-web/src/components/MyEMS/Space/EnterProduction.js - About 3 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 23 (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/advancedreportfile.py - About 3 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_delete has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def on_delete(req, resp, id_):
        admin_control(req)
        if not id_.isdigit() or int(id_) <= 0:
            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                   description='API.INVALID_METER_ID')
Severity: Minor
Found in myems-api/core/meter.py - About 3 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_post has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def on_post(req, resp):
        """Handles POST requests"""
        admin_control(req)
        try:
            upload = req.get_param('file')
Severity: Minor
Found in myems-api/core/energyplanfile.py - About 3 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_post has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def on_post(req, resp):
        """Handles POST requests"""
        admin_control(req)
        try:
            upload = req.get_param('file')
Severity: Minor
Found in myems-api/core/offlinemeterfile.py - About 3 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_post has a Cognitive Complexity of 23 (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/tenant.py - About 3 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 23 (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/microgrid.py - About 3 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 23 (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/core/space.py - About 3 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 23 (exceeds 5 allowed). Consider refactoring.
Open

    def on_put(req, resp, id_):
        """Handles PUT requests"""
        admin_control(req)
        try:
            raw_json = req.stream.read().decode('utf-8')
Severity: Minor
Found in myems-api/core/store.py - About 3 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 renderSection has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function renderSection(position) {
            var e = $("<td class='fc-header-" + position + "'/>");
            var buttonStr = options.header[position];
            if (buttonStr) {
                $.each(buttonStr.split(' '), function(i) {
Severity: Major
Found in myems-admin/js/plugins/fullcalendar/fullcalendar.min.js - About 3 hrs to fix

    Function a has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function a() {
            var e = this;
            e.name = "Footable Sortable", e.init = function(a) {
                e.footable = a, a.options.sort === !0 && t(a.table).unbind(".sorting").bind({
                    "footable_initialized.sorting": function() {
    Severity: Major
    Found in myems-admin/js/plugins/footable/footable.all.min.js - About 3 hrs to fix

      Function drawBar has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function drawBar(x, y, b, barLeft, barRight, fillStyleCallback, axisx, axisy, c, horizontal, lineWidth) {
                  var left, right, bottom, top,
                      drawLeft, drawRight, drawTop, drawBottom,
                      tmp;
      
      
      Severity: Major
      Found in myems-admin/js/plugins/flot/jquery.flot.js - About 3 hrs to fix

        Function generate_excel has 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def generate_excel(report,
                           name,
                           base_period_start_datetime_local,
                           base_period_end_datetime_local,
                           reporting_start_datetime_local,
        Severity: Major
        Found in myems-api/excelexporters/combinedequipmentstatistics.py - About 3 hrs to fix

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

          'use strict';
          
          app.controller('StoreController', function(
              $scope,
              $rootScope,
          Severity: Minor
          Found in myems-admin/app/controllers/settings/store/store.controller.js - About 3 hrs to fix

            Function StateRegistry has 80 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var StateRegistry = /** @class */ (function () {
                    /** @internal */
                    function StateRegistry(router) {
                        this.router = router;
                        this.states = {};
            Severity: Major
            Found in myems-admin/js/ui-router/angular-ui-router.js - About 3 hrs to fix

              Function setHand has 80 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  ClockPicker.prototype.setHand = function(x, y, roundBy5, dragging){
                      var radian = Math.atan2(x, - y),
                          isHours = this.currentView === 'hours',
                          unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
                          z = Math.sqrt(x * x + y * y),
              Severity: Major
              Found in myems-admin/js/plugins/clockpicker/clockpicker.js - About 3 hrs to fix

                Function updateOptions has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      this.updateOptions = function(d) {
                        d
                          ? ((b.options = {
                              allowAnimation: f.isFieldAvailable(d.allowAnimation, !0),
                              allowDrag: f.isFieldAvailable(d.allowDrag, !1),
                Severity: Major
                Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 3 hrs to fix

                  Function SettingsProfile has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const SettingsProfile = () => {
                    const [firstName, setFirstName] = useState('Anthony');
                    const [lastName, setLastName] = useState('Hopkins');
                    const [email, setEmail] = useState('anthony@gmail.com');
                    const [phone, setPhone] = useState('+44098098304');
                  Severity: Major
                  Found in myems-web/src/components/Settings/SettingsProfile.js - About 3 hrs to fix

                    Function handleCodeSubmit has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const handleCodeSubmit = e => {
                        setIsDisabled(true);
                        const timeId = setTimeout(() => {
                          setIsDisabled(false);
                          clearTimeout(timeId);
                    Severity: Major
                    Found in myems-web/src/components/MyEMS/auth/SentRegisterEmailMessageForm.js - About 3 hrs to fix

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

                      'use strict';
                      
                      app.controller('EquipmentParameterController', function(
                          $scope,
                          $rootScope,
                        Severity
                        Category
                        Status
                        Source
                        Language