uccser/verto

View on GitHub

Showing 64 of 64 total issues

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

                elif self.INDENT_RE.match(line):
                    item_groups[-1][-1] = '{}\n{}'.format(item_groups[-1][-1], self.looseDetab(line))
Severity: Major
Found in verto/utils/overrides.py and 1 other location - About 1 hr to fix
verto/utils/overrides.py on lines 158..161

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 parse_flag(argument_key, arguments, default=False):
    '''Search for the given argument in a string of all arguments,
    treating the argument as a flag only.

    Args:
Severity: Major
Found in verto/processors/utils.py and 1 other location - About 1 hr to fix
verto/processors/ConditionalProcessor.py on lines 200..215

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

        if len(content_blocks) == 0 or content_blocks[0] == '':
            raise ImageMissingCaptionError(self.processor, argument)
Severity: Major
Found in verto/processors/ImageContainerBlockProcessor.py and 1 other location - About 1 hr to fix
verto/processors/InteractiveContainerBlockProcessor.py on lines 64..65

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

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 __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, uids=set(), occurance_separator='-', entities=True,
Severity: Major
Found in verto/utils/UniqueSlugify.py - About 1 hr to fix

    Function handle_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_data(self, data):
            '''This method is called to process arbitrary data (e.g.
            text nodes and the content of <script>...</script> and
            <style>...</style>).
    
    
    Severity: Minor
    Found in verto/utils/HtmlParser.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 run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(self, root):
            ''' Processes the html tree finding code tags where scratch
            code is used and replaces with template html.
    
            Args:
    Severity: Minor
    Found in verto/processors/ScratchTreeprocessor.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

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

            if len(content_blocks) == 0 or content_blocks[0] == '':
                raise InteractiveMissingTextError(self.processor, argument)
    Severity: Major
    Found in verto/processors/InteractiveContainerBlockProcessor.py and 1 other location - About 1 hr to fix
    verto/processors/ImageContainerBlockProcessor.py on lines 58..59

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

    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 run has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def run(self, parent, blocks):
            ''' Generic run method for container tags.
    
            Args:
                parent: The parent node of the element tree that children
    Severity: Minor
    Found in verto/processors/GenericContainerBlockProcessor.py - About 1 hr to fix

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

          def __init__(self, processors=[], html_templates={}, extensions=[], settings={}, *args, **kwargs):
              '''
              Args:
                  processors: A set of processor names given as strings for which
                      their processors are enabled. If given, all other
      Severity: Minor
      Found in verto/VertoExtension.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 extendMarkdown has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def extendMarkdown(self, md, md_globals):
              '''Inherited from the markdown.Extension class. Extends
              markdown with custom processors.
                  ['style', StylePreprocessor(self, md), '_begin']
      
      
      Severity: Minor
      Found in verto/VertoExtension.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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self, parent, blocks):
              '''Replaces all video tags {video url="example"} with embeded
              video link. Inherited from BlockProcessor class.
      
              Args:
      Severity: Minor
      Found in verto/processors/VideoBlockProcessor.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 extract_video_identifier has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def extract_video_identifier(self, video_url):
              '''Extracts an identifier and service from a video url.
              Args:
                  video_url: The input url.
              Returns:
      Severity: Minor
      Found in verto/processors/VideoBlockProcessor.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 handle_endtag has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def handle_endtag(self, tag):
              '''This method is called to handle the end tag of an
              element (e.g. `</div>`).
      
              Args:
      Severity: Minor
      Found in verto/utils/HtmlParser.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, processors=[], html_templates={}, extensions=[], settings={}, *args, **kwargs):
      Severity: Minor
      Found in verto/VertoExtension.py - About 45 mins to fix

        Function custom_parsing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def custom_parsing(self, content_blocks, argument_values):
                '''
                Extracts the title and subtitle of panel block's contents.
        
                Args:
        Severity: Minor
        Found in verto/processors/PanelBlockProcessor.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 modify_rules has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def modify_rules(self, json_data):
                '''
                Modify the default tag argument rules using given custom rules.
        
                Args:
        Severity: Minor
        Found in verto/VertoExtension.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 add_to_heading_tree has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_to_heading_tree(self, heading, heading_slug, level):
                ''' Adds a new heading to the heading tree.
        
                Args:
                    heading: A string of the heading title
        Severity: Minor
        Found in verto/processors/HeadingBlockProcessor.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, html_string, title, required_files, heading_tree, required_glossary_terms):
        Severity: Minor
        Found in verto/Verto.py - About 35 mins to fix

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

              def __init__(self, title, title_slug, level, parent, children):
          Severity: Minor
          Found in verto/utils/HeadingNode.py - About 35 mins to fix

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

                def process_html(self, node):
                    '''
                    Checks if given node is a scratch code tag and replaces
                    with the given html template.
            
            
            Severity: Minor
            Found in verto/processors/ScratchTreeprocessor.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

            Severity
            Category
            Status
            Source
            Language