Showing 5,781 of 10,536 total issues

Function Navbars has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Function on_put has 57 lines of code (exceeds 25 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: Major
    Found in myems-api/core/tenant.py - About 2 hrs to fix

      Function on_delete has 57 lines of code (exceeds 25 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_POINT_ID')
      Severity: Major
      Found in myems-api/core/point.py - About 2 hrs to fix

        Function indexOf has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

                Array.prototype.indexOf = function (searchElement, fromIndex) {
                        var k;
        
                        // 1. Let O be the result of calling ToObject passing
                        //    the this value as the argument.
        Severity: Minor
        Found in myems-admin/js/plugins/oclazyload/ocLazyLoad.js - 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 indexOf has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          Array.prototype.indexOf = function (searchElement, fromIndex) {
        
            var k;
        
            // 1. Let O be the result of calling ToObject passing
        Severity: Minor
        Found in myems-admin/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js - 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 SpaceEnvironmentMonitor has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const SpaceEnvironmentMonitor = ({ setRedirect, setRedirectUrl, t }) => {
          const [cursor, setCursor] = useState(0);
          const [maxCursor, setMaxCursor] = useState(0);
          const [selectSensorList, setSelectSensorList] = useState([]);
          const len = 8;
        Severity: Minor
        Found in myems-web/src/components/MyEMS/Space/SpaceEnvironmentMonitor.js - 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 MeterRealtime has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const MeterRealtime = ({ setRedirect, setRedirectUrl, t }) => {
          const [cursor, setCursor] = useState(0);
          const [maxCursor, setMaxCursor] = useState(0);
          const [selectMeterList, setSelectMeterList] = useState([]);
          const len = 8;
        Severity: Minor
        Found in myems-web/src/components/MyEMS/Meter/MeterRealtime.js - 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 OfflineMeterInput has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const OfflineMeterInput = ({ 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/Meter/OfflineMeterInput.js - 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 MultipleLineChart has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const MultipleLineChart = ({ reportingTitle, baseTitle, labels, data, options }) => {
          const colors = ['#2c7be5', '#00d27a', '#27bcfd', '#f5803e', '#e63757'];
          const [values, setValues] = useState(['a0']);
          const [oldValues, setOldValues] = useState(['a0']);
          const { isDark } = useContext(AppContext);
        Severity: Minor
        Found in myems-web/src/components/MyEMS/common/MultipleLineChart.js - 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 17 (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/pointrealtime.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 17 (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/virtualpowerplant.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 17 (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/datasource.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 17 (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/distributioncircuit.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 17 (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/datasource.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 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def on_post(req, resp, id_):
                """Handles POST requests"""
                admin_control(req)
                try:
                    raw_json = req.stream.read().decode('utf-8')
        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_put has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def on_put(req, resp, id_, hid):
                """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 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 17 (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/workingcalendar.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 17 (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/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 17 (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 setUrlParams has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                setUrlParams: function(config, params, actionUrl) {
                  var self = this,
                    url = actionUrl || self.template,
                    val,
                    encodedVal,
        Severity: Major
        Found in myems-admin/js/angular/angular-resource.js - About 2 hrs to fix
          Severity
          Category
          Status
          Source
          Language