Showing 5,781 of 10,536 total issues

Avoid deeply nested control flow statements.
Open

                        if (
                          !xa &&
                          (2 < c || 2 < d) &&
                          da &&
                          a.isItemEnabled(da)
Severity: Major
Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if ((bb(), a.isDragAllowed(c))) {
                              a.dragDropStatus(!0);
                              a.addDropMark();
                              b.dataTransfer
                                ? ((b.dataTransfer.effectAllowed = "move"),
    Severity: Major
    Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              switch (b.keyCode) {
                                case 13:
                                  g[a.options.dataFields.text] = B[0].value
                                    ? B[0].value
                                    : "null";
      Severity: Major
      Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 45 mins to fix

        Function app has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                    function($controllerProvider, $compileProvider, $filterProvider, $provide, $httpProvider,$cookiesProvider) {
        Severity: Minor
        Found in myems-admin/app/config.js - About 45 mins to fix

          Function MessageTextArea has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          const MessageTextArea = ({ thread }) => {
            const { isDark, isRTL } = useContext(AppContext);
            const { messages, messagesDispatch, threadsDispatch, textAreaInitialHeight, setTextAreaInitialHeight } = useContext(
              ChatContext
            );
          Severity: Minor
          Found in myems-web/src/components/chat/content/MessageTextArea.js - About 45 mins 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 ReactBootstrapTable2 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          const ReactBootstrapTable2 = () => {
            const [data, setData] = useState({ items: getItems(10), selected: getItems(5, 10) });
          
            const id2List = {
              droppable: 'items',
          Severity: Minor
          Found in myems-web/src/components/plugins/ReactBeautifulDnD.js - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                          if (json[route.to].indexOf(child.to) !== -1) {
                            showChildren.push(child);
                          }
          Severity: Major
          Found in myems-web/src/components/navbar/NavbarTopDropDownMenus.js - About 45 mins to fix

            Function addPair has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    addPair: function (combinedequipmentID, meterID, metertype, is_output, headers, callback) {

              Function addPair has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      addPair: function(equipmentID, meterID, metertype, is_output, headers, callback) {
              Severity: Minor
              Found in myems-admin/app/services/settings/equipment/equipmentmeter.service.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                if (json[route.to].indexOf(child.to) !== -1) {
                                  showChildren.push(child);
                                }
                Severity: Major
                Found in myems-web/src/components/navbar/NavbarVertical.js - About 45 mins to fix

                  Function Calendar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const Calendar = () => {
                    const calendarRef = useRef();
                    const [calendarApi, setCalendarApi] = useState({});
                    const [title, setTitle] = useState('');
                    const [currentFilter, setCurrentFilter] = useState('Month View');
                  Severity: Minor
                  Found in myems-web/src/components/calendar/Calendar.js - About 45 mins 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 getIcon has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const getIcon = type => {
                    const icon = ['far'];
                    if (type.includes('image')) {
                      icon.push('file-image');
                    }
                  Severity: Minor
                  Found in myems-web/src/components/email/ComposeAttachment.js - About 45 mins 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

                  Avoid deeply nested control flow statements.
                  Open

                                          if cursor:
                                              cursor.close()
                                          if cnx:
                  Severity: Major
                  Found in myems-normalization/offlinemeter.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if len(carbon_dict[current_datetime_utc]) == 0:
                                            del carbon_dict[current_datetime_utc]
                    
                                ############################################################################################################
                                # Step 6: save carbon dioxide emissions data to database
                    Severity: Major
                    Found in myems-aggregation/tenant_carbon_input_category.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          for energy_category_id in energy_category_list:
                                              current_tariff = tariff_dict[energy_category_id].get(current_datetime_utc)
                                              current_energy = energy_dict[current_datetime_utc].get(energy_category_id)
                                              if current_tariff is not None \
                                                      and isinstance(current_tariff, Decimal) \
                      Severity: Major
                      Found in myems-aggregation/space_billing_output_category.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if common_start_datetime_utc < min(energy_hourly.keys()):
                                                common_start_datetime_utc = min(energy_hourly.keys())
                                            if common_end_datetime_utc > max(energy_hourly.keys()):
                        Severity: Major
                        Found in myems-aggregation/combined_equipment_energy_output_category.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if current_carbon is not None and isinstance(current_carbon, Decimal):
                                                      add_values += " (" + str(energy_storage_container['id']) + ","
                                                      add_values += "'" + current_datetime_utc.isoformat()[0:19] + "',"
                                                      add_values += str(current_carbon) + "), "
                          
                          
                          Severity: Major
                          Found in myems-aggregation/energy_storage_container_carbon_charge.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                for cell in row:
                                                    col_num += 1
                                                    print(cell.value)
                                                    if col_num == 1:
                                                        # get offline meter ID
                            Severity: Major
                            Found in myems-normalization/offlinemeter.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if cnx:
                                                          cnx.close()
                                                      time.sleep(60)
                              Severity: Major
                              Found in myems-normalization/offlinemeter.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        for energy_data_item in energy_data_list:
                                                            add_values = (" INSERT INTO tbl_energy_value "
                                                                          "             (point_id, utc_date_time, actual_value, is_bad) "
                                                                          " VALUES  ")
                                                            add_values += " (" + str(point_id) + ","
                                Severity: Major
                                Found in myems-normalization/datarepair.py - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language