Showing 5,781 of 10,536 total issues

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

    def on_get(req, resp):
        access_control(req)
        cnx = mysql.connector.connect(**config.myems_system_db)
        cursor = cnx.cursor()

Severity: Minor
Found in myems-api/core/microgrid.py - About 2 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    def on_get(req, resp):
        access_control(req)
        cnx = mysql.connector.connect(**config.myems_system_db)
        cursor = cnx.cursor()

Severity: Minor
Found in myems-api/core/windfarm.py - About 2 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    def on_get(req, resp, id_):
        access_control(req)
        if not id_.isdigit() or int(id_) <= 0:
            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                   description='API.INVALID_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.py - About 2 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    def on_get(req, resp, id_):
        access_control(req)
        if not id_.isdigit() or int(id_) <= 0:
            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                   description='API.INVALID_WIND_FARM_ID')
Severity: Minor
Found in myems-api/core/windfarm.py - About 2 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 16 (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_VIRTUAL_METER_ID')
Severity: Minor
Found in myems-api/core/virtualmeter.py - About 2 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    def on_get(req, resp, id_):
        access_control(req)
        if not id_.isdigit() or int(id_) <= 0:
            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                   description='API.INVALID_WIND_FARM_ID')
Severity: Minor
Found in myems-api/core/windfarm.py - About 2 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    def on_put(req, resp):
        """Handles PUT requests"""
        try:
            raw_json = req.stream.read().decode('utf-8')
            new_values = json.loads(raw_json)
Severity: Minor
Found in myems-api/core/user.py - About 2 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 16 (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/space.py - About 2 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 16 (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/emailserver.py - About 2 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    def on_post(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/tariff.py - About 2 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 HookBuilder has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var HookBuilder = /** @class */ (function () {
        function HookBuilder(transition) {
            this.transition = transition;
        }
        HookBuilder.prototype.buildHooksForPhase = function (phase) {
Severity: Major
Found in myems-admin/js/ui-router/angular-ui-router.js - About 2 hrs to fix

    Function link has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          link: function(scope, element, attrs, ngMessagesCtrl, $transclude) {
            var commentNode, records, staticExp, dynamicExp;
    
            if (!isDefault) {
              commentNode = element[0];
    Severity: Major
    Found in myems-admin/js/angular/angular-messages.js - About 2 hrs to fix

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

              a.name = "Footable Grid", a.init = function(t) {
                  var d = t.options.classes.toggle,
                      s = t.options.classes.detail,
                      f = t.options.grid;
                  if (f.cols) {
      Severity: Major
      Found in myems-admin/js/plugins/footable/footable.all.min.js - About 2 hrs to fix

        Function findNearbySlice has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function findNearbySlice(mouseX, mouseY) {
        
                    var slices = plot.getData(),
                        options = plot.getOptions(),
                        radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius,
        Severity: Major
        Found in myems-admin/js/plugins/flot/jquery.flot.pie.js - About 2 hrs to fix

          Function link has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  link: function(scope, elem, attrs, modelCtrl) {
          
                      var label = elem.next('span');
          
                      scope.size = "default";
          Severity: Major
          Found in myems-admin/js/bootstrap/angular-bootstrap-checkbox.js - About 2 hrs to fix

            Function bindElementEvents has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              bindElementEvents: function(){
                var map = this,
                    mouseMoved;
            
                this.container.mousemove(function(){
            Severity: Major
            Found in myems-admin/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js - About 2 hrs to fix

              Function addMeter has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  $scope.addMeter = function() {
                      var modalInstance = $uibModal.open({
                          templateUrl: 'views/settings/meter/meter.model.html',
                          controller: 'ModalAddMeterCtrl',
                          windowClass: "animated fadeIn",
              Severity: Major
              Found in myems-admin/app/controllers/settings/meter/meter.controller.js - About 2 hrs to fix

                Function NotificationSettings has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const NotificationSettings = () => {
                  const [check1, setCheck1] = useState(true);
                  const [check2, setCheck2] = useState(true);
                  const [check3, setCheck3] = useState(true);
                
                
                Severity: Major
                Found in myems-web/src/components/page/Notifications.js - About 2 hrs to fix

                  Function ModalSideContent has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const ModalSideContent = () => {
                    return (
                      <>
                        <h6 className="mt-5 mt-lg-0">Add To Card</h6>
                        <Nav vertical className="flex-lg-column fs--1">
                  Severity: Major
                  Found in myems-web/src/components/kanban/modalSideContent.js - About 2 hrs to fix

                    Function on_get has 52 lines of code (exceeds 25 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: Major
                    Found in myems-api/reports/metertrend.py - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language