kariminf/aruudy

View on GitHub

Showing 19 of 43 total issues

File word.py has 754 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#  pattern.py
#  Used to detect patterns from a fully vocalized word
Severity: Major
Found in aruudy/tools/word.py - About 1 day to fix

    File meter.py has 642 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    
    #  Copyright 2019 Abdelkrime Aries <kariminfo0@gmail.com>
    #
    Severity: Major
    Found in aruudy/poetry/meter.py - About 1 day to fix

      File foot.py has 400 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      
      #  Copyright 2019 Abdelkrime Aries <kariminfo0@gmail.com>
      #
      Severity: Minor
      Found in aruudy/poetry/foot.py - About 5 hrs to fix

        Function getPattern has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        def getPattern(word):
        
            tmpPattern = u''
        
            for char in word:
        Severity: Minor
        Found in aruudy/tools/word.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

        File litebase.py has 272 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/env python
        # -*- coding: utf-8 -*-
        #
        #  litebase.py
        #  Used to manage Sqlite database with easiest way
        Severity: Minor
        Found in aruudy/db/litebase.py - About 2 hrs to fix

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

          def process_shatr(text, opt=None):
              s = prosody.process_shatr(text).to_dict(bahr=True, parts=True)
              res = 200
              if not s["bahr"]:
                  res = 404
          Severity: Minor
          Found in aruudy/web/api.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 getTemplateNoDiac has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          def getTemplateNoDiac(word):
              """This function take an Arabic word as parameter;
              it deletes its diacritics if exist; then returns the possible Templates;
              If there are many possible templates, they will be separated with + """
          
          
          Severity: Minor
          Found in aruudy/tools/word.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

          Avoid deeply nested control flow statements.
          Open

                              if s["bahr"]:
                                  s["bahr"] = s["bahr"]["name"]
                          else:
          Severity: Major
          Found in aruudy/web/api.py - About 45 mins to fix

            Function get_ameter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_ameter (text):
                """Get the Arabic meter of a given text.
                Produces the Arabic meter of a given text in prosody form.
                The Arabic meter is composed of two letters:
            
            
            Severity: Minor
            Found in aruudy/poetry/meter.py - About 35 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 makeLiteType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def makeLiteType(stringType):
                stringType = string.upper(stringType)
                if re.match('INT[^\(]', stringType):
                    return liteINT(0)
                if re.match('TEXT', stringType):
            Severity: Minor
            Found in aruudy/db/litebase.py - About 35 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 setPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def setPath(self, filePath):
                    if self.__database:
                        print 'Database already exists'
                        return     
                        
            Severity: Minor
            Found in aruudy/db/litebase.py - About 35 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 liteType(stringType)
            Severity: Major
            Found in aruudy/db/litebase.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return liteCHAR(num)
              Severity: Major
              Found in aruudy/db/litebase.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return liteINT(num)
                Severity: Major
                Found in aruudy/db/litebase.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return liteVARCHAR(num)
                  Severity: Major
                  Found in aruudy/db/litebase.py - About 30 mins to fix

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

                        def __addTable(self, sqlQuery):
                    
                            sqlQuery = u'' + sqlQuery    
                            theLiteTable = liteTable()
                            tableName = u''
                    Severity: Minor
                    Found in aruudy/db/litebase.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

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

                    def getTemplateFromList(word, template):
                        """This function take an Arabic  word (diacretized)
                        and some possible templates separated by a +;
                        If the program succeed to choose just one, it will add a (;)
                        at the end
                    Severity: Minor
                    Found in aruudy/tools/word.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

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

                    def get_bahr(name, dic=True):
                        """Search for poetry Bahr by name.
                    
                        Parameters
                        ----------
                    Severity: Minor
                    Found in aruudy/poetry/meter.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

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

                        def addColumn(self, columnName, columnDef, columnInf, index):
                            if not self.__canAddColumns:
                                return 
                            if len(self.__tableName) < 1:
                                return
                    Severity: Minor
                    Found in aruudy/db/litebase.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

                    Severity
                    Category
                    Status
                    Source
                    Language