cdli-gh/pyoracc

View on GitHub

Showing 14 of 107 total issues

AtfParser has 140 functions (exceeds 20 allowed). Consider refactoring.
Open

class AtfParser(object):
tokens = AtfLexicon.TOKENS
 
def __init__(self, debug=0, log=yacc.NullLogger()):
self.parser = yacc.yacc(module=self, tabmodule='pyoracc.atf.parsetab',
Severity: Major
Found in pyoracc/atf/common/atfyacc.py - About 2 days to fix

    File atfyacc.py has 644 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    '''
    Copyright 2015, 2016 University College London.
     
    This file is part of PyORACC.
     
     
    Severity: Major
    Found in pyoracc/atf/common/atfyacc.py - About 1 day to fix

      Function CheckSurfaceRules has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

      def CheckSurfaceRules(self):
      surfaceRegex = re.compile("@surface")
      specificSurfaceRegex = re.compile(
      "@(obverse|reverse|top|bottom|left|right)")
      faceSurfaceRegex = re.compile("@face")
      Severity: Minor
      Found in pyoracc/cdlimodel/structure.py - About 6 hrs to fix

      AtfLexer has 34 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class AtfLexer(object):
       
      def _keyword_dict(self, tokens, extra):
      keywords = {token.lower(): token for token in tokens}
      firstcap = {token.title(): token for token in tokens}
      Severity: Minor
      Found in pyoracc/atf/common/atflex.py - About 4 hrs to fix

        File atflex.py has 340 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        '''
        Copyright 2015, 2016 University College London.
         
        This file is part of PyORACC.
         
         
        Severity: Minor
        Found in pyoracc/atf/common/atflex.py - About 4 hrs to fix

          Function __init__ has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          def __init__(self, **kwargs):
          self.texts = []
          self.failures = 0
          self.successes = 0
          self.atftype = kwargs['atftype']
          Severity: Minor
          Found in pyoracc/model/corpus.py - About 1 hr to fix

          Function t_INITIAL_parallel_labeled_ATID has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          def t_INITIAL_parallel_labeled_ATID(self, t):
          r'^@[a-zA-Z][a-zA-Z0-9\[\]]*\+?'
          t.value = t.value[1:]
          t.lexpos += 1
          t.type = self.resolve_keyword(t.value,
          Severity: Minor
          Found in pyoracc/atf/common/atflex.py - About 1 hr to fix

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

          def check_and_process(pathname, atftype, whole, verbose=False):
          mode = os.stat(pathname)[ST_MODE]
          if S_ISREG(mode) and pathname.lower().endswith('.atf'):
          # It's a file, call the callback function
          if verbose:
          Severity: Minor
          Found in pyoracc/wrapper/cli.py - About 1 hr to fix

          Function main has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def main(input_path, atf_type, whole, verbose):
          """My Tool does one work, and one work well."""
          tsbegin = time.time()
          if os.path.isdir(input_path):
          failures = 0
          Severity: Minor
          Found in pyoracc/wrapper/cli.py - About 1 hr to fix

          Function t_INITIAL_parallel_labeled_HASHID has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def t_INITIAL_parallel_labeled_HASHID(self, t):
          r'#[a-zA-Z][a-zA-Z0-9\[\]]+:'
          # Note that \:? absorbs a trailing colon in protocol keywords
          t.value = t.value[1:-1]
          t.lexpos += 1
          Severity: Minor
          Found in pyoracc/atf/common/atflex.py - About 1 hr to fix

          Function SetObjectType has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def SetObjectType(self, roughType):
          if "@tablet" in roughType:
          self.objectType = "TABLET"
          elif "bulla" in roughType:
          self.objectType = "BULLA"
          Severity: Minor
          Found in pyoracc/cdlimodel/structure.py - About 1 hr to fix

          Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def __init__(self, state=None, scope=None, extent=None,
          Severity: Minor
          Found in pyoracc/model/state.py - About 35 mins to fix

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

            def CheckPMap(self, pnumber):
            self.oldPlist, self.newPlist = self.ReadPMap()
             
            foundMap = False
             
             
            Severity: Minor
            Found in pyoracc/cdlimodel/cdlitext.py - About 25 mins to fix

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

            def __init__(self, content, atftype='oracc', debug=False):
            skipinvalid = False
            if content[-1] != '\n':
            content += "\n"
            if atftype == 'cdli':
            Severity: Minor
            Found in pyoracc/atf/common/atffile.py - About 25 mins to fix
            Severity
            Category
            Status
            Source
            Language