hackedteam/vector-edk

View on GitHub
BaseTools/Source/Python/UPT/Library/ExpressionValidate.py

Summary

Maintainability
F
5 days
Test Coverage

File ExpressionValidate.py has 313 lines of code (exceeds 250 allowed). Consider refactoring.
Open

## @file
# This file is used to check PCD logical expression
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
Severity: Minor
Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py - About 3 hrs to fix

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

    def IsValidBareCString(String):
        EscapeList = ['n', 't', 'f', 'r', 'b', '0', '\\', '"']
        PreChar = ''
        LastChar = ''
        for Char in String:
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.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 _CheckToken has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def _CheckToken(self, MatchList):
            for Match in MatchList:
                if Match and Match.start() == 0:
                    if not _ValidateToken(
                                self.Token[self.Index:self.Index+Match.end()]
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.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 ValidRange has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def ValidRange(self):
            if self.IsCurrentOp(["("]):
                self.RangeExpression()
                if not self.IsCurrentOp([")"]):
                    raise _ExprError('')
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.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 StringItem has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def StringItem(self):
            Match1 = re.compile(self.QUOTED_PATTERN)\
                .match(self.Token[self.Index:].replace('\\\\', '//')\
                       .replace('\\\"', '\\\''))
            Match2 = re.compile(self.MACRO_PATTERN).match(self.Token[self.Index:])
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.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 Expr has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def Expr(self):
            Ret = self.Factor()
            while self.IsCurrentOp(["+", "-", "&", "|", "^"]):
                if self.Token[self.Index-1] == '|' and self.Parens <= 0:
                    raise  _ExprError(ST.ERR_EXPR_OR)
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py - About 55 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 LogicalExpression has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def LogicalExpression(self):
            Ret = self.SpecNot()
            while self.IsCurrentOp(['||', 'OR', 'or', '&&', 'AND', 'and', 'XOR']):
                if self.Token[self.Index-1] == '|' and self.Parens <= 0:
                    raise  _ExprError(ST.ERR_EXPR_OR)
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py - 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 Factor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def Factor(self):
            if self.IsCurrentOp(["("]):
                self.Parens += 1
                Ret = self.LogicalExpression()
                if not self.IsCurrentOp([")"]):
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py - 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 IsCurrentOp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def IsCurrentOp(self, OpList):
            self.SkipWhitespace()
            LetterOp = ["EQ", "NE", "GE", "LE", "GT", "LT", "NOT", "and", "AND", 
                        "or", "OR", "XOR"]
            OpMap = {
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py - 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 IsValidFeatureFlagExp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def IsValidFeatureFlagExp(Token, Flag=False):
        #
        # Not do the check right now, keep the implementation for future enhancement.
        #
        if not Flag:
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py - 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 too many return statements within this function.
    Open

                    return True
    Severity: Major
    Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return True, ''
      Severity: Major
      Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return False
        Severity: Major
        Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py - About 30 mins to fix

          Function Rel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def Rel(self):
                  Ret = self.Expr()
                  if self.IsCurrentOp(["<=", ">=", ">", "<", "GT", "LT", "GE", "LE",
                                       "==", "EQ", "!=", "NE"]):
                      if Ret == self.STRINGITEM or Ret == self.REALLOGICAL:
          Severity: Minor
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py - About 25 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

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

                      if HexRangeMatch and HexRangeMatch.start() == 0:
                          self.Index += HexRangeMatch.end()
                      elif IntRangeMatch and IntRangeMatch.start() == 0:
                          self.Index += IntRangeMatch.end()
                      else:
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 3 hrs to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 353..358

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

          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

                      if HexMatch and HexMatch.start() == 0:
                          self.Index += HexMatch.end()
                      elif IntMatch and IntMatch.start() == 0:
                          self.Index += IntMatch.end()
                      else:
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 3 hrs to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 366..371

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

          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

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

                  if self.Token[self.Index:self.Index+1] == '_' or \
                      self.Token[self.Index:self.Index+1].isalnum():
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 2 hrs to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 157..158

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

          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

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

                          if self.Token[self.Index:self.Index+1] == '_' or \
                              self.Token[self.Index:self.Index+1].isalnum():
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 2 hrs to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 373..374

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

          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

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

                      if self.Token[self.Index-1] == '|' and self.Parens <= 0:
                          raise  _ExprError(ST.ERR_EXPR_OR)
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 1 hr to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 220..221

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

          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

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

                      if self.Token[self.Index-1] == '|' and self.Parens <= 0:
                          raise  _ExprError(ST.ERR_EXPR_OR)
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 1 hr to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 254..255

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

          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

                  Match1 = re.compile(self.QUOTED_PATTERN)\
                      .match(self.Token[self.Index:].replace('\\\\', '//')\
                             .replace('\\\"', '\\\''))
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 1 hr to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 209..211

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

          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

                  Match3 = re.compile(self.QUOTED_PATTERN).\
                      match(self.Token[self.Index:].replace('\\\\', '//').\
                            replace('\\\"', '\\\''))
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 1 hr to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 397..399

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

          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

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

                      if Ret == self.STRINGITEM or Ret == self.REALLOGICAL:
                          raise _ExprError(ST.ERR_EXPR_LOGICAL % self.Token)
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 3 other locations - About 1 hr to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 241..242
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 256..257
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 259..260

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

          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

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

                      if Ret == self.STRINGITEM or Ret == self.REALLOGICAL:
                          raise _ExprError(ST.ERR_EXPR_LOGICAL % self.Token)
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 3 other locations - About 1 hr to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 244..245
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 256..257
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 259..260

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

          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

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

                      if Ret == self.STRINGITEM or Ret == self.REALLOGICAL:
                          raise _ExprError(ST.ERR_EXPR_LOGICAL % self.Token)
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 3 other locations - About 1 hr to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 241..242
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 244..245
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 256..257

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

          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

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

                      if Ret == self.STRINGITEM or Ret == self.REALLOGICAL:
                          raise _ExprError(ST.ERR_EXPR_LOGICAL % self.Token)
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 3 other locations - About 1 hr to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 241..242
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 244..245
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 259..260

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

          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

              def SkipWhitespace(self):
                  for Char in self.Token[self.Index:]:
                      if Char not in ' \t':
                          break
                      self.Index += 1
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 2 other locations - About 1 hr to fix
          BaseTools/Source/Python/Common/Expression.py on lines 384..388
          BaseTools/Source/Python/UPT/Parser/DecParserMisc.py on lines 299..303

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

          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

          def IsValidLogicalExpr(Token, Flag=False):
              #
              # Not do the check right now, keep the implementation for future enhancement.
              #
              if not Flag:
          Severity: Minor
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 40 mins to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 450..456

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

          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

          def IsValidStringTest(Token, Flag=False):
              #
              # Not do the check right now, keep the implementation for future enhancement.
              #
              if not Flag:
          Severity: Minor
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 40 mins to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 437..443

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

          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

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

                          if not _ValidateToken(
                                      self.Token[self.Index:self.Index+Match.end()]
          Severity: Minor
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 35 mins to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 405..406

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

          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

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

                          if not _ValidateToken(
                                      self.Token[self.Index:self.Index+Match.end()]
          Severity: Minor
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 35 mins to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 149..150

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

          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

              def Unary(self):
                  if self.IsCurrentOp(["NOT", "-"]):
                      return self.Unary()
                  return self.ValidRange()
          Severity: Minor
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 35 mins to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 230..233

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

          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

              def SpecNot(self):
                  if self.IsCurrentOp(["NOT", "!"]):
                      return self.SpecNot()
                  return self.Rel()
          Severity: Minor
          Found in BaseTools/Source/Python/UPT/Library/ExpressionValidate.py and 1 other location - About 35 mins to fix
          BaseTools/Source/Python/UPT/Library/ExpressionValidate.py on lines 334..337

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

          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

          There are no issues that match your filters.

          Category
          Status