Showing 5,781 of 10,536 total issues

Function on_post has a Cognitive Complexity of 19 (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/sensor.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 19 (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/svg.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 19 (exceeds 5 allowed). Consider refactoring.
Open

    def on_post(req, resp):
        try:
            raw_json = req.stream.read().decode('utf-8')
            new_values = json.loads(raw_json)
        except Exception as ex:
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 19 (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/store.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

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

'use strict';

app.controller('EnergyStorageContainerFirecontrolController', function(
    $scope,
    $rootScope,

    Function update has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    function update() {
                        var mainEl = angular.element(element);
                        mainEl.append(graphEl);
                        mainEl.empty();
                        var graphEl = $compile('<div></div>')(scope);
    Severity: Major
    Found in myems-admin/js/plugins/rickshaw/angular-rickshaw.js - About 2 hrs to fix

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

                  link: function(scope, elm, attrs, controller) {
      
                      var sources = scope.eventSources,
                          sourcesChanged = false,
                          eventSourcesWatcher = controller.changeWatcher(sources, controller.sourcesFingerprint),
      Severity: Major
      Found in myems-admin/js/plugins/fullcalendar/calendar.js - About 2 hrs to fix

        Function plotLine has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    function plotLine(datapoints, xoffset, yoffset, axisx, axisy) {
                        var points = datapoints.points,
                            ps = datapoints.pointsize,
                            prevx = null, prevy = null;
        
        
        Severity: Major
        Found in myems-admin/js/plugins/flot/jquery.flot.js - About 2 hrs to fix

          Function Map has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          jvm.Map = function(params) {
            var map = this,
                e;
          
            this.params = jvm.$.extend(true, {}, jvm.Map.defaultParams, params);
          Severity: Major
          Found in myems-admin/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js - About 2 hrs to fix

            Function CustomerDetail has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const CustomerDetail = () => {
              const { loading, data: customer } = useFakeFetch(rawCustomer);
              const { id, email, createdAt, description, vat_no, email_to, address, cell, invoice_prefix } = customer;
            
              return (
            Severity: Major
            Found in myems-web/src/components/page/CustomerDetails.js - About 2 hrs to fix

              Function ReactBootstrapTable2 has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ReactBootstrapTable2 = () => {
                const [data, setData] = useState({ items: getItems(10), selected: getItems(5, 10) });
              
                const id2List = {
                  droppable: 'items',
              Severity: Major
              Found in myems-web/src/components/plugins/ReactBeautifulDnD.js - About 2 hrs to fix

                Function UsersAndFeed has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const UsersAndFeed = () => {
                  const VideoPostContent = rawFeeds.find(feed => {
                    return Object.keys(feed.content).includes('video');
                  });
                  const GalleryPostContent = rawFeeds.find(feed => {
                Severity: Major
                Found in myems-web/src/components/widgets/UsersAndFeed.js - About 2 hrs to fix

                  Function Charts has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const Charts = props => {
                    const pointid = props.pointid;
                    const pointname = props.pointname;
                    const namewithid = pointname + ' ( ID: ' + pointid + ' )';
                    const optionData = props.data;
                  Severity: Major
                  Found in myems-web/src/components/MyEMS/common/dialog/charts.js - About 2 hrs to fix

                    Function on_put has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def on_put(req, resp, id_, lid):
                            """Handles PUT requests"""
                            admin_control(req)
                            try:
                                raw_json = req.stream.read().decode('utf-8')
                    Severity: Major
                    Found in myems-api/core/energystoragecontainer.py - About 2 hrs to fix

                      File angular-messages.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /**
                       * @license AngularJS v1.8.3
                       * (c) 2010-2020 Google LLC. http://angularjs.org
                       * License: MIT
                       */
                      Severity: Minor
                      Found in myems-admin/js/angular/angular-messages.js - About 2 hrs to fix

                        Function initDefaultTypes has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function initDefaultTypes() {
                                var makeDefaultType = function (def) {
                                    var valToString = function (val) { return (val != null ? val.toString() : val); };
                                    var defaultTypeBase = {
                                        encode: valToString,
                        Severity: Major
                        Found in myems-admin/js/ui-router/angular-ui-router.js - About 2 hrs to fix

                          Function UrlMatcher has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  function UrlMatcher(pattern, paramTypes, paramFactory, config) {
                                      var _this = this;
                                      /** @internal */
                                      this._cache = { path: [this] };
                                      /** @internal */
                          Severity: Major
                          Found in myems-admin/js/ui-router/angular-ui-router.js - About 2 hrs to fix

                            Function TargetState has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                var TargetState = /** @class */ (function () {
                                    /**
                                     * The TargetState constructor
                                     *
                                     * Note: Do not construct a `TargetState` manually.
                            Severity: Major
                            Found in myems-admin/js/ui-router/angular-ui-router.js - About 2 hrs to fix

                              Function factory has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function factory(angular, Dropzone){
                                    
                                  angular.module('thatisuday.dropzone', []).provider('dropzoneOps', function(){
                                    /*
                                     *  Add default options here
                              Severity: Major
                              Found in myems-admin/js/plugins/dropzone/ng-dropzone.js - About 2 hrs to fix

                                Function Navs has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const Navs = () => {
                                  return (
                                    <Fragment>
                                      <PageHeader
                                        title="Navs"
                                Severity: Major
                                Found in myems-web/src/components/bootstrap-components/Navs.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language