Terralego/django-template-engines

View on GitHub

Showing 70 of 71 total issues

File odt_tags.py has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import base64
import logging
import random
import re
import secrets
Severity: Minor
Found in template_engines/templatetags/odt_tags.py - About 2 hrs to fix

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

        def replace_inputs(self, soup):
            """ Replace all text:text-input to text-span """
            input_list = soup.find_all("text:text-input")
    
            for tag in input_list:
    Severity: Minor
    Found in template_engines/backends/odt.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 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, url, data=None, request=None, max_width=None,
    Severity: Minor
    Found in template_engines/templatetags/pdf_tags.py - About 35 mins to fix

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

      def get_image_infos_from_uri(uri):
          """ get image size and dimensions """
          if not uri.lower().startswith('http'):
              # protect use of urlopen from filesystem read
              return None, (None, None), None
      Severity: Minor
      Found in template_engines/templatetags/utils.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 resize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def resize(bimage, max_width, max_height, odt=True):
          """
          Resize the image with max_width or/and max_height has been specified,
          otherwise convert them.
      
      
      Severity: Minor
      Found in template_engines/templatetags/utils.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

      Multiple consecutive blank lines
      Open

      
      
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD012 - Multiple consecutive blank lines

      Tags: whitespace, blank_lines

      Aliases: no-multiple-blanks

      This rule is triggered when there are multiple consecutive blank lines in the document:

      Some text here
      
      
      Some more text here

      To fix this, delete the offending lines:

      Some text here
      
      Some more text here

      Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

      Multiple consecutive blank lines
      Open

      
      
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD012 - Multiple consecutive blank lines

      Tags: whitespace, blank_lines

      Aliases: no-multiple-blanks

      This rule is triggered when there are multiple consecutive blank lines in the document:

      Some text here
      
      
      Some more text here

      To fix this, delete the offending lines:

      Some text here
      
      Some more text here

      Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

      Multiple consecutive blank lines
      Open

      
      
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD012 - Multiple consecutive blank lines

      Tags: whitespace, blank_lines

      Aliases: no-multiple-blanks

      This rule is triggered when there are multiple consecutive blank lines in the document:

      Some text here
      
      
      Some more text here

      To fix this, delete the offending lines:

      Some text here
      
      Some more text here

      Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

      Lists should be surrounded by blank lines
      Open

       * packaging
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD032 - Lists should be surrounded by blank lines

      Tags: bullet, ul, ol, blank_lines

      Aliases: blanks-around-lists

      This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:

      Some text
      * Some
      * List
      
      1. Some
      2. List
      Some text

      To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):

      Some text
      
      * Some
      * List
      
      1. Some
      2. List
      
      Some text

      Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.

      Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:

      * This is
      not okay
      
      * This is
        okay

      Multiple consecutive blank lines
      Open

      
      
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD012 - Multiple consecutive blank lines

      Tags: whitespace, blank_lines

      Aliases: no-multiple-blanks

      This rule is triggered when there are multiple consecutive blank lines in the document:

      Some text here
      
      
      Some more text here

      To fix this, delete the offending lines:

      Some text here
      
      Some more text here

      Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

      Multiple consecutive blank lines
      Open

      
      
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD012 - Multiple consecutive blank lines

      Tags: whitespace, blank_lines

      Aliases: no-multiple-blanks

      This rule is triggered when there are multiple consecutive blank lines in the document:

      Some text here
      
      
      Some more text here

      To fix this, delete the offending lines:

      Some text here
      
      Some more text here

      Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

      Multiple consecutive blank lines
      Open

      
      
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD012 - Multiple consecutive blank lines

      Tags: whitespace, blank_lines

      Aliases: no-multiple-blanks

      This rule is triggered when there are multiple consecutive blank lines in the document:

      Some text here
      
      
      Some more text here

      To fix this, delete the offending lines:

      Some text here
      
      Some more text here

      Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

      Lists should be surrounded by blank lines
      Open

       * the template is cleaned before it is filled.
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD032 - Lists should be surrounded by blank lines

      Tags: bullet, ul, ol, blank_lines

      Aliases: blanks-around-lists

      This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:

      Some text
      * Some
      * List
      
      1. Some
      2. List
      Some text

      To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):

      Some text
      
      * Some
      * List
      
      1. Some
      2. List
      
      Some text

      Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.

      Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:

      * This is
      not okay
      
      * This is
        okay

      Multiple consecutive blank lines
      Open

      
      
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD012 - Multiple consecutive blank lines

      Tags: whitespace, blank_lines

      Aliases: no-multiple-blanks

      This rule is triggered when there are multiple consecutive blank lines in the document:

      Some text here
      
      
      Some more text here

      To fix this, delete the offending lines:

      Some text here
      
      Some more text here

      Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

      Lists should be surrounded by blank lines
      Open

       * requirements
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD032 - Lists should be surrounded by blank lines

      Tags: bullet, ul, ol, blank_lines

      Aliases: blanks-around-lists

      This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:

      Some text
      * Some
      * List
      
      1. Some
      2. List
      Some text

      To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):

      Some text
      
      * Some
      * List
      
      1. Some
      2. List
      
      Some text

      Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.

      Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:

      * This is
      not okay
      
      * This is
        okay

      Lists should be surrounded by blank lines
      Open

       * ``AbstractEngine`` becomes ``ZipAbstractEngine`` and allow you to write
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD032 - Lists should be surrounded by blank lines

      Tags: bullet, ul, ol, blank_lines

      Aliases: blanks-around-lists

      This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:

      Some text
      * Some
      * List
      
      1. Some
      2. List
      Some text

      To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):

      Some text
      
      * Some
      * List
      
      1. Some
      2. List
      
      Some text

      Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.

      Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:

      * This is
      not okay
      
      * This is
        okay

      Multiple consecutive blank lines
      Open

      
      
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD012 - Multiple consecutive blank lines

      Tags: whitespace, blank_lines

      Aliases: no-multiple-blanks

      This rule is triggered when there are multiple consecutive blank lines in the document:

      Some text here
      
      
      Some more text here

      To fix this, delete the offending lines:

      Some text here
      
      Some more text here

      Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

      Lists should be surrounded by blank lines
      Open

       * a method that removes incorrect additions in the template tags of the xml file
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD032 - Lists should be surrounded by blank lines

      Tags: bullet, ul, ol, blank_lines

      Aliases: blanks-around-lists

      This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:

      Some text
      * Some
      * List
      
      1. Some
      2. List
      Some text

      To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):

      Some text
      
      * Some
      * List
      
      1. Some
      2. List
      
      Some text

      Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.

      Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:

      * This is
      not okay
      
      * This is
        okay

      Trailing spaces
      Open

       
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD009 - Trailing spaces

      Tags: whitespace

      Aliases: no-trailing-spaces

      Parameters: br_spaces (number; default: 0)

      This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

      The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

      Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

      Lists should be surrounded by blank lines
      Open

      * Pillow>=5.4.1
      Severity: Info
      Found in CHANGES.md by markdownlint

      MD032 - Lists should be surrounded by blank lines

      Tags: bullet, ul, ol, blank_lines

      Aliases: blanks-around-lists

      This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:

      Some text
      * Some
      * List
      
      1. Some
      2. List
      Some text

      To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):

      Some text
      
      * Some
      * List
      
      1. Some
      2. List
      
      Some text

      Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.

      Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:

      * This is
      not okay
      
      * This is
        okay
      Severity
      Category
      Status
      Source
      Language