Showing 5,781 of 10,536 total issues

Function NavBarTop has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const NavBarTop = () => {
  const { setIsTopNav } = useContext(AppContext);

  return (
    <Fragment>
Severity: Minor
Found in myems-web/src/components/bootstrap-components/NavBarTop.js - About 1 hr to fix

    Function FaqCol has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const FaqCol = () => {
      const { loading, data: faqs } = useFakeFetch(rawFaqs);
      const [isOpen, setIsOpen] = useState(false);
    
      const toggleModal = () => setIsOpen(!isOpen);
    Severity: Minor
    Found in myems-web/src/components/faq/FaqCol.js - About 1 hr to fix

      Function refreshSVGData has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const refreshSVGData = () => {
          let isResponseOK = false;
          fetch(APIBaseURL + '/reports/pointrealtime', {
            method: 'GET',
            headers: {

        Function Dialog has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const Dialog = props => {
          if (props.type === 'charts') {
            const data = props.data;
            return (
              <div
        Severity: Minor
        Found in myems-web/src/components/MyEMS/common/dialog/dialog.js - About 1 hr to fix

          Function arrayReducer has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const arrayReducer = (state, action) => {
            const { type, id, payload, sortBy, order, isAddToStart, isUpdatedStart } = action;
            switch (type) {
              case 'ADD':
                if (!payload) {
          Severity: Minor
          Found in myems-web/src/reducers/arrayReducer.js - About 1 hr to fix

            Function refreshSVGData has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const refreshSVGData = () => {
                let isResponseOK = false;
                fetch(APIBaseURL + '/reports/pointrealtime', {
                  method: 'GET',
                  headers: {
            Severity: Minor
            Found in myems-web/src/components/MyEMS/Microgrid/MicrogridDetails.js - About 1 hr to fix

              Function on_put has 40 lines of code (exceeds 25 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 1 hr to fix

                Function on_post has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def on_post(req, resp):
                        """Handles POST requests"""
                        admin_control(req)
                
                        try:
                Severity: Minor
                Found in myems-api/core/wechatmessage.py - About 1 hr to fix

                  Function on_put has 40 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: Minor
                  Found in myems-api/core/user.py - About 1 hr to fix

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

                        def on_put(req, resp):
                            """Handles PUT requests"""
                            if 'USER-UUID' not in req.headers or \
                                    not isinstance(req.headers['USER-UUID'], str) or \
                                    len(str.strip(req.headers['USER-UUID'])) == 0:
                    Severity: Minor
                    Found in myems-api/core/user.py - About 1 hr to fix

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

                          def on_get(req, resp):
                              """Handles GET requests"""
                              admin_control(req)
                              cnx = mysql.connector.connect(**config.myems_reporting_db)
                              cursor = cnx.cursor()
                      Severity: Minor
                      Found in myems-api/core/advancedreport.py - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def on_get(req, resp):
                              """Handles GET requests"""
                              admin_control(req)
                              cnx = mysql.connector.connect(**config.myems_fdd_db)
                              cursor = cnx.cursor()
                      Severity: Minor
                      Found in myems-api/core/rule.py - About 1 hr 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 13 (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/virtualpowerplant.py - About 1 hr 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 13 (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/virtualpowerplant.py - About 1 hr 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 13 (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/menu.py - About 1 hr 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 13 (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/rule.py - About 1 hr 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 13 (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/tenant.py - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def on_get(req, resp):
                              admin_control(req)
                              cnx = mysql.connector.connect(**config.myems_system_db)
                              cursor = cnx.cursor()
                      
                      
                      Severity: Minor
                      Found in myems-api/core/datasource.py - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def on_put(req, resp, id_):
                              """Handles GET requests"""
                              admin_control(req)
                              # Get command by ID
                              if not id_.isdigit() or int(id_) <= 0:
                      Severity: Minor
                      Found in myems-api/core/command.py - About 1 hr 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 13 (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/rule.py - About 1 hr 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

                      Severity
                      Category
                      Status
                      Source
                      Language