mattwalshdev/emailee

View on GitHub

Showing 16 of 16 total issues

File emailee.py has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import enum
import mimetypes
import re
import smtplib
from email.mime.application import MIMEApplication
Severity: Minor
Found in emailee/emailee.py - About 4 hrs to fix

    File emailee_async.py has 305 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import multiprocessing
    import threading
    import time
    from typing import Any, Dict, List, Union
    
    
    Severity: Minor
    Found in emailee/emailee_async.py - About 3 hrs to fix

      Function send has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def send(self, outputFile: str = "") -> bool:
              if self._authPassword and not self._authUsername and self._sender:
                  # this may happen if server methods are invoked before
                  #  the sender method AND the person has not added an
                  #  authUsername BUT has added an authPassword
      Severity: Minor
      Found in emailee/emailee.py - About 3 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 server has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def server(
              self,
              smtpServer: str,
              *,
              port: int = 0,
      Severity: Minor
      Found in emailee/emailee.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 _generate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def _generate(self) -> str:
              message = MIMEMultipart("mixed")
      
              message["to"] = ", ".join(self._to) if self._to else ""
      
      
      Severity: Minor
      Found in emailee/emailee.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 _addressCheck has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _addressCheck(
              self, emailList: List[str], type: str, ignoreErrors: bool
          ) -> List[str]:
              self._tempEmailList = []
              for email in emailList:
      Severity: Minor
      Found in emailee/emailee.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 _sendMailFunc has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def _sendMailFunc(
          mailItem: Dict,
          mailServer: Dict,
          processQueue: multiprocessing.Queue,
          outputFile: str,
      Severity: Minor
      Found in emailee/emailee_async.py - About 1 hr to fix

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

        def _helperOutputFileCheck(filename: str) -> bool:
            try:
                if Path(filename).is_file():
                    try:
                        fileSize: int = Path(filename).stat().st_size
        Severity: Minor
        Found in emailee/emailee.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 server has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def server(
        Severity: Major
        Found in emailee/emailee.py - About 50 mins to fix

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

              def __init__(
          Severity: Minor
          Found in emailee/emailee_async.py - About 45 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    if (
                        self._sender
                        and (self._to or self._cc or self._bcc)
                        and self._smtpServer
                        and self._port
            Severity: Major
            Found in emailee/emailee.py - About 40 mins to fix

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

                  def __init__(
              Severity: Minor
              Found in emailee/emailee_async.py - About 35 mins to fix

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

                def _sendMailFunc(
                Severity: Minor
                Found in emailee/emailee_async.py - About 35 mins to fix

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

                      def sendTo(
                          self,
                          to: List[str] = [],
                          cc: List[str] = [],
                          bcc: List[str] = [],
                  Severity: Minor
                  Found in emailee/emailee.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 attachmentFiles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def attachmentFiles(self, attachmentFiles: List[str] = []) -> None:
                          if not isinstance(attachmentFiles, list):
                              raise TypeError("attachmentFiles not in list format")
                  
                          for file in attachmentFiles:
                  Severity: Minor
                  Found in emailee/emailee.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 ready has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def ready(self) -> bool:
                          if self._authPassword and not self._authUsername and self._sender:
                              # this may happen if server methods are invoked before
                              #  the sender method AND the person has not added an
                              #  authUsername BUT has added an authPassword
                  Severity: Minor
                  Found in emailee/emailee.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