Showing 10,536 of 10,536 total issues

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

    fetch(APIBaseURL + '/users/emailmessages', {
      method: 'POST',
      body: JSON.stringify({
        data: {
          subject: subject,
myems-web/src/components/MyEMS/auth/SentRegisterEmailMessageForm.js on lines 28..60

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

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

    def on_put(req, resp, id_, pid):
        """Handles PUT requests"""
        admin_control(req)
        if not id_.isdigit() or int(id_) <= 0:
            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
Severity: Minor
Found in myems-api/core/combinedequipment.py - About 1 day 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 55 (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/space.py - About 1 day 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 55 (exceeds 5 allowed). Consider refactoring.
Open

    def on_put(req, resp, id_, pid):
        """Handles PUT requests"""
        admin_control(req)
        if not id_.isdigit() or int(id_) <= 0:
            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
Severity: Minor
Found in myems-api/core/equipment.py - About 1 day 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 combinedequipmentincome.py has 522 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: Major
Found in myems-api/reports/combinedequipmentincome.py - About 1 day to fix

    Function Display has 213 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Display = () => {
      return (
        <Fragment>
          <PageHeader
            title="Display"
    Severity: Major
    Found in myems-web/src/components/utilities/Display.js - About 1 day to fix

      File jquery.carousel.min.js has 520 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      (function(c) {
        function ga(z, s) {
          function m() {
            u = j.length;
            p = v * 2 / u;
      Severity: Major
      Found in myems-admin/js/jquery/jquery.carousel.min.js - About 1 day to fix

        Function QRUtil has 211 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var QRUtil = function() {
        
            var PATTERN_POSITION_TABLE = [
              [],
              [6, 18],
        Severity: Major
        Found in myems-admin/js/angular/qrcode.js - About 1 day to fix

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

                              link: function(scope, element, attrs, ngModel) {
                                  var savedNodes;
          
                                  function combineCallbacks(first,second){
                                      if(second && (typeof second === 'function')) {
          Severity: Major
          Found in myems-admin/js/plugins/ui-sortable/sortable.js - About 1 day to fix

            Function on_post has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

                def on_post(req, resp, id_):
                    """Handles POST requests"""
                    admin_control(req)
                    if not id_.isdigit() or int(id_) <= 0:
                        raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
            Severity: Minor
            Found in myems-api/core/combinedequipment.py - About 1 day 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 54 (exceeds 5 allowed). Consider refactoring.
            Open

                def on_post(req, resp, id_):
                    """Handles POST requests"""
                    admin_control(req)
                    if not id_.isdigit() or int(id_) <= 0:
                        raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
            Severity: Minor
            Found in myems-api/core/equipment.py - About 1 day 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 googleMapStyles.js has 517 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            export default {
              Default: [
                {
                  featureType: 'water',
                  elementType: 'geometry',
            Severity: Major
            Found in myems-web/src/helpers/googleMapStyles.js - About 1 day to fix

              Consider simplifying this complex logical expression.
              Open

                            if (b) {
                              b.bind("dragstart", function(b) {
                                var c = a.getItemFromChildElem(this);
                                if (c && a.isItemEnabled(c))
                                  if (((c = angular.element(this)), a.labelEditStatus()))
              Severity: Critical
              Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 1 day to fix

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

                        CostCenterTariffService.addPair(costcenterid, tariffid, headers, function (response) {
                            if (angular.isDefined(response.status) && response.status === 201) {
                                toaster.pop({
                                    type: "success",
                                    title: $translate.instant("TOASTER.SUCCESS_TITLE"),
                myems-admin/app/controllers/settings/costcenter/costcentertariff.controller.js on lines 88..106

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

                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

                        CostCenterTariffService.deletePair(costcenterid, costcentertariffid, headers, function (response) {
                            if (angular.isDefined(response.status) && response.status === 204) {
                                toaster.pop({
                                    type: "success",
                                    title: $translate.instant("TOASTER.SUCCESS_TITLE"),
                myems-admin/app/controllers/settings/costcenter/costcentertariff.controller.js on lines 61..78

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

                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 spaceoutput.py has 512 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: Major
                Found in myems-api/reports/spaceoutput.py - About 1 day to fix

                  File combinedequipmentoutput.py has 511 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: Major
                  Found in myems-api/reports/combinedequipmentoutput.py - About 1 day to fix

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

                    app.factory('TextMessageService', function($http) {
                        return {
                            getResult: function(query, headers, callback) {
                                $http.get(getAPI()+"textmessages?" + 'startdatetime=' + query.startdatetime + '&enddatetime=' + query.enddatetime, {headers})
                                .then(function (response) {
                    Severity: Major
                    Found in myems-admin/app/services/fdd/textmessage.service.js and 2 other locations - About 1 day to fix
                    myems-admin/app/services/fdd/emailmessage.service.js on lines 2..23
                    myems-admin/app/services/fdd/wechatmessage.service.js on lines 2..23

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

                    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

                    app.factory('WechatMessageService', function($http) {
                        return {
                            getResult: function(query, headers, callback) {
                                $http.get(getAPI()+"wechatmessages?" + 'startdatetime=' + query.startdatetime + '&enddatetime=' + query.enddatetime, {headers})
                                .then(function (response) {
                    Severity: Major
                    Found in myems-admin/app/services/fdd/wechatmessage.service.js and 2 other locations - About 1 day to fix
                    myems-admin/app/services/fdd/emailmessage.service.js on lines 2..23
                    myems-admin/app/services/fdd/textmessage.service.js on lines 2..23

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

                    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

                    app.factory('EmailMessageService', function($http) {
                        return {
                            getResult: function(query, headers, callback) {
                                $http.get(getAPI()+"emailmessages?" + 'startdatetime=' + query.startdatetime + '&enddatetime=' + query.enddatetime, {headers})
                                .then(function (response) {
                    Severity: Major
                    Found in myems-admin/app/services/fdd/emailmessage.service.js and 2 other locations - About 1 day to fix
                    myems-admin/app/services/fdd/textmessage.service.js on lines 2..23
                    myems-admin/app/services/fdd/wechatmessage.service.js on lines 2..23

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

                    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