Showing 5,781 of 10,536 total issues

Function on_get has 44 lines of code (exceeds 25 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/equipmentbatch.py - About 1 hr to fix

    Function on_get has 44 lines of code (exceeds 25 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/storebatch.py - About 1 hr to fix

      Function on_get has 44 lines of code (exceeds 25 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/shopfloorbatch.py - About 1 hr to fix

        Function generate_excel has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):
        
            trans = get_translation(language)
            trans.install()
            _ = trans.gettext
        Severity: Minor
        Found in myems-api/excelexporters/metersubmetersbalance.py - About 1 hr to fix

          Function on_post has 44 lines of code (exceeds 25 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/photovoltaicpowerstation.py - About 1 hr to fix

            Function on_post has 44 lines of code (exceeds 25 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/photovoltaicpowerstation.py - About 1 hr to fix

              Function on_post has 44 lines of code (exceeds 25 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/windfarm.py - About 1 hr to fix

                Function on_post has 44 lines of code (exceeds 25 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/windfarm.py - About 1 hr to fix

                  Function on_put has 44 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/point.py - About 1 hr to fix

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

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

                      Function on_put has 44 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/store.py - About 1 hr to fix

                        Function NavbarDropdown has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const NavbarDropdown = ({ title, items, right, children, handleSetNavbarCollapsed }) => {
                          const [dropdownOpen, setDropdownOpen] = useState(false);
                          const toggleDropdown = () => setDropdownOpen(prevState => !prevState);
                        
                          const findTitleName = name => {
                        Severity: Minor
                        Found in myems-web/src/components/navbar/NavbarDropdown.js - 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 Avatar has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const Avatar = ({ size, rounded, src, name, emoji, className, mediaClass, isExact, icon }) => {
                          const classNames = ['avatar', `avatar-${size}`, className].join(' ');
                          const mediaClasses = [rounded ? `rounded-${rounded}` : 'rounded', mediaClass].join(' ');
                        
                          const getAvatar = () => {
                        Severity: Minor
                        Found in myems-web/src/components/common/Avatar.js - 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 14 (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/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 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def on_get(req, resp, id_, hid):
                                access_control(req)
                                if not id_.isdigit() or int(id_) <= 0:
                                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                           description='API.INVALID_ENERGY_STORAGE_CONTAINER_ID')
                        Severity: Minor
                        Found in myems-api/core/energystoragecontainer.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 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def on_get(req, resp, id_, fid):
                                access_control(req)
                                if not id_.isdigit() or int(id_) <= 0:
                                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                           description='API.INVALID_ENERGY_STORAGE_CONTAINER_ID')
                        Severity: Minor
                        Found in myems-api/core/energystoragecontainer.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 14 (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/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_put has a Cognitive Complexity of 14 (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/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_get has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def on_get(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_DATA_SOURCE_ID')
                        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_get has a Cognitive Complexity of 14 (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/combinedequipment.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