Showing 10,536 of 10,536 total issues

File tenantenergycategory.py has 870 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import base64
from core.utilities import get_translation
import os
import re
import uuid
Severity: Major
Found in myems-api/excelexporters/tenantenergycategory.py - About 2 days to fix

    File combinedequipmentcarbon.py has 869 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import base64
    from core.utilities import get_translation
    import os
    import re
    import uuid
    Severity: Major
    Found in myems-api/excelexporters/combinedequipmentcarbon.py - About 2 days to fix

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

      class AdvancedReportRun:
          def __init__(self):
              """Initializes ReportItem"""
              pass
      
      
      Severity: Major
      Found in myems-api/core/advancedreport.py and 1 other location - About 2 days to fix
      myems-api/core/rule.py on lines 439..478

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

      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

      class RuleRun:
          def __init__(self):
              """Initializes RuleItem"""
              pass
      
      
      Severity: Major
      Found in myems-api/core/rule.py and 1 other location - About 2 days to fix
      myems-api/core/advancedreport.py on lines 368..408

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

      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 combinedequipmentcost.py has 868 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import base64
      from core.utilities import get_translation
      import os
      import re
      import uuid
      Severity: Major
      Found in myems-api/excelexporters/combinedequipmentcost.py - About 2 days to fix

        File spacecarbon.py has 867 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import base64
        from core.utilities import get_translation
        import os
        import re
        import uuid
        Severity: Major
        Found in myems-api/excelexporters/spacecarbon.py - About 2 days to fix

          File spacecost.py has 867 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import base64
          from core.utilities import get_translation
          import os
          import re
          import uuid
          Severity: Major
          Found in myems-api/excelexporters/spacecost.py - About 2 days to fix

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

            app.factory('StoreMeterService', function($http) {
                return {
                    addPair: function(storeID, meterID, metertype, headers, callback) {
                        var meter={};
                        if(metertype=='meters'){
            Severity: Major
            Found in myems-admin/app/services/settings/store/storemeter.service.js and 3 other locations - About 2 days to fix
            myems-admin/app/services/settings/shopfloor/shopfloormeter.service.js on lines 2..39
            myems-admin/app/services/settings/space/spacemeter.service.js on lines 2..39
            myems-admin/app/services/settings/tenant/tenantmeter.service.js on lines 2..39

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

            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 4 locations. Consider refactoring.
            Open

            app.factory('SpaceMeterService', function($http) {
                return {
                    addPair: function(spaceID,meterID, metertype, headers, callback) {
                        var meter={};
                        if(metertype=='meters'){
            Severity: Major
            Found in myems-admin/app/services/settings/space/spacemeter.service.js and 3 other locations - About 2 days to fix
            myems-admin/app/services/settings/shopfloor/shopfloormeter.service.js on lines 2..39
            myems-admin/app/services/settings/store/storemeter.service.js on lines 2..39
            myems-admin/app/services/settings/tenant/tenantmeter.service.js on lines 2..39

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

            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 4 locations. Consider refactoring.
            Open

            app.factory('ShopfloorMeterService', function($http) {
                return {
                    addPair: function(shopfloorID,meterID, metertype, headers, callback) {
                        var meter={};
                        if(metertype=='meters'){
            myems-admin/app/services/settings/space/spacemeter.service.js on lines 2..39
            myems-admin/app/services/settings/store/storemeter.service.js on lines 2..39
            myems-admin/app/services/settings/tenant/tenantmeter.service.js on lines 2..39

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

            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 4 locations. Consider refactoring.
            Open

            app.factory('TenantMeterService', function($http) {
                return {
                    addPair: function(tenantID, meterID, metertype, headers, callback) {
                        var meter={};
                        if(metertype=='meters'){
            myems-admin/app/services/settings/shopfloor/shopfloormeter.service.js on lines 2..39
            myems-admin/app/services/settings/space/spacemeter.service.js on lines 2..39
            myems-admin/app/services/settings/store/storemeter.service.js on lines 2..39

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

            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_get has a Cognitive Complexity of 104 (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/microgriddashboard.py - About 2 days 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 104 (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/shopfloor.py - About 2 days 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

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

                if offline_meter_list_in_expression is not None and len(offline_meter_list_in_expression) > 0:
                    try:
                        for offline_meter_in_expression in offline_meter_list_in_expression:
                            offline_meter_id = str(offline_meter_in_expression['offline_meter_id'])
                            query = (" SELECT start_datetime_utc, actual_value "
            Severity: Major
            Found in myems-normalization/virtualmeter.py and 2 other locations - About 2 days to fix
            myems-normalization/virtualmeter.py on lines 259..280
            myems-normalization/virtualmeter.py on lines 284..306

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

            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

                if meter_list_in_expression is not None and len(meter_list_in_expression) > 0:
                    try:
                        for meter_in_expression in meter_list_in_expression:
                            meter_id = str(meter_in_expression['meter_id'])
                            query = (" SELECT start_datetime_utc, actual_value "
            Severity: Major
            Found in myems-normalization/virtualmeter.py and 2 other locations - About 2 days to fix
            myems-normalization/virtualmeter.py on lines 284..306
            myems-normalization/virtualmeter.py on lines 310..332

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

            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

                if virtual_meter_list_in_expression is not None and len(virtual_meter_list_in_expression) > 0:
                    try:
                        for virtual_meter_in_expression in virtual_meter_list_in_expression:
                            virtual_meter_id = str(virtual_meter_in_expression['virtual_meter_id'])
                            query = (" SELECT start_datetime_utc, actual_value "
            Severity: Major
            Found in myems-normalization/virtualmeter.py and 2 other locations - About 2 days to fix
            myems-normalization/virtualmeter.py on lines 259..280
            myems-normalization/virtualmeter.py on lines 310..332

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

            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

            const RecentPurchasesTable = () => {
              const [isSelected, setIsSelected] = useState(false);
            
              return (
                <Card className="mb-3">
            Severity: Major
            Found in myems-web/src/components/MyEMS/Tenant/RecentPuchasesTable.js and 2 other locations - About 2 days to fix
            myems-web/src/components/MyEMS/Shopfloor/RecentPuchasesTable.js on lines 7..47
            myems-web/src/components/MyEMS/Store/RecentPuchasesTable.js on lines 7..47

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

            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

                    {
                      name: 'cmdQuote',
                      hotkey: 'Ctrl+Q',
                      title: 'Quote',
                      icon: { glyph: 'glyphicon glyphicon-comment', fa: 'fa fa-quote-left', 'fa-3': 'icon-quote-left' },
            myems-admin/js/plugins/bootstrap-markdown/bootstrap-markdown.js on lines 1098..1143
            myems-admin/js/plugins/bootstrap-markdown/bootstrap-markdown.js on lines 1144..1189

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

            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

                    {
                      name: 'cmdListO',
                      hotkey: 'Ctrl+O',
                      title: 'Ordered List',
                      icon: { glyph: 'glyphicon glyphicon-th-list', fa: 'fa fa-list-ol', 'fa-3': 'icon-list-ol' },
            myems-admin/js/plugins/bootstrap-markdown/bootstrap-markdown.js on lines 1098..1143
            myems-admin/js/plugins/bootstrap-markdown/bootstrap-markdown.js on lines 1229..1275

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

            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

            const RecentPurchasesTable = () => {
              const [isSelected, setIsSelected] = useState(false);
            
              return (
                <Card className="mb-3">
            myems-web/src/components/MyEMS/Store/RecentPuchasesTable.js on lines 7..47
            myems-web/src/components/MyEMS/Tenant/RecentPuchasesTable.js on lines 7..47

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

            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