EventGhost/EventGhost

View on GitHub
plugins/Phoner/__init__.py

Summary

Maintainability
F
6 days
Test Coverage

File __init__.py has 778 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# /plugins/Phoner/__init__.py
#
# Copyright (C)  2009 Pako  <lubos.ruckl@quick.cz>
Severity: Major
Found in plugins/Phoner/__init__.py - About 1 day to fix

    Function OnChangeState has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def OnChangeState(self, call_id=None):
            """Statusnderung"""
            e = self.thread.phoner.GetState(call_id)
            if e !="":
                if call_id not in self.memo or (call_id in self.memo and self.memo[call_id]!=e):
    Severity: Minor
    Found in plugins/Phoner/__init__.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 __call__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def __call__(self):
            #If you run Phoner just over COM/API, a window of Phoner is not drawn !!
            flag = True
            hwnd = PhonerWin()
            if not hwnd:
    Severity: Minor
    Found in plugins/Phoner/__init__.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 Configure has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def Configure(self, path = None):
            path = None
            panel = eg.ConfigPanel(self)
            label1Text = wx.StaticText(panel, -1, self.text.label1)
            phPathCtrl = MyDirBrowseButton(
    Severity: Minor
    Found in plugins/Phoner/__init__.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 __call__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def __call__(self,call_id=""):
            attrib = self.__class__.__name__
            if eg.event.payload:
                call_id = str(eg.event.payload)
            if PhonerWin():
    Severity: Minor
    Found in plugins/Phoner/__init__.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 __call__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def __call__(self, call_id='', string=""):
            if eg.event.payload:
                call_id = str(eg.event.payload)
            if PhonerWin():
                if self.plugin.CheckWorkerThread():
    Severity: Minor
    Found in plugins/Phoner/__init__.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

    Avoid deeply nested control flow statements.
    Open

                            if call_id in self.memo:
                                del self.memo[call_id]
                    else:
    Severity: Major
    Found in plugins/Phoner/__init__.py - About 45 mins to fix

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

          def Configure(self, call_id='', string=""):
              panel = eg.ConfigPanel()
              labelText = wx.StaticText(panel, -1, self.plugin.text.call_id_label)
              w,h=labelText.GetSize()
              labelDtmf = wx.StaticText(panel, -1, self.text.dtmfLabel)
      Severity: Minor
      Found in plugins/Phoner/__init__.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

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

          def Configure(self, call_id=""):
              panel = eg.ConfigPanel()
              labelText = wx.StaticText(panel, -1, self.plugin.text.call_id_label)
              w,h=labelText.GetSize()
              textControl = wx.TextCtrl(panel, -1, call_id)
      Severity: Major
      Found in plugins/Phoner/__init__.py and 2 other locations - About 6 hrs to fix
      plugins/Phoner/__init__.py on lines 755..764
      plugins/Phoner/__init__.py on lines 781..790

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

      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

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

          def Configure(self, call_id=""):
              panel = eg.ConfigPanel()
              labelText = wx.StaticText(panel, -1, self.plugin.text.call_id_label)
              w,h=labelText.GetSize()
              textControl = wx.TextCtrl(panel, -1, call_id)
      Severity: Major
      Found in plugins/Phoner/__init__.py and 2 other locations - About 6 hrs to fix
      plugins/Phoner/__init__.py on lines 781..790
      plugins/Phoner/__init__.py on lines 866..875

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

      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

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

          def Configure(self, call_id=""):
              panel = eg.ConfigPanel()
              labelText = wx.StaticText(panel, -1, self.plugin.text.call_id_label)
              w,h=labelText.GetSize()
              textControl = wx.TextCtrl(panel, -1, call_id)
      Severity: Major
      Found in plugins/Phoner/__init__.py and 2 other locations - About 6 hrs to fix
      plugins/Phoner/__init__.py on lines 755..764
      plugins/Phoner/__init__.py on lines 866..875

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

      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 __call__(self, call_id='', msg=""):
              if eg.event.payload:
                  call_id = str(eg.event.payload)
              if PhonerWin():
                  if self.plugin.CheckWorkerThread():
      Severity: Major
      Found in plugins/Phoner/__init__.py and 1 other location - About 3 hrs to fix
      plugins/Phoner/__init__.py on lines 580..591

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

      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 __call__(self, call_id='', file=""):
              if eg.event.payload:
                  call_id = str(eg.event.payload)
              if PhonerWin():
                  if self.plugin.CheckWorkerThread():
      Severity: Major
      Found in plugins/Phoner/__init__.py and 1 other location - About 3 hrs to fix
      plugins/Phoner/__init__.py on lines 626..637

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

      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 __call__(self, number="", msn=""):
              if PhonerWin():
                  if self.plugin.CheckWorkerThread():
                      self.plugin.workerThread.CallWait(
                          partial(self.plugin.workerThread.MakeCallOver, number, msn),1000
      Severity: Major
      Found in plugins/Phoner/__init__.py and 1 other location - About 1 hr to fix
      plugins/Phoner/__init__.py on lines 662..671

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

      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 __call__(self, number="", msg=""):
              if PhonerWin():
                  if self.plugin.CheckWorkerThread():
                      self.plugin.workerThread.CallWait(partial(
                          self.plugin.workerThread.SendSMS,
      Severity: Major
      Found in plugins/Phoner/__init__.py and 1 other location - About 1 hr to fix
      plugins/Phoner/__init__.py on lines 467..474

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

      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

      class Transfer(eg.ActionBase):
          def __call__(self):
              if PhonerWin():
                  if self.plugin.CheckWorkerThread():
                      self.plugin.workerThread.CallWait(
      Severity: Major
      Found in plugins/Phoner/__init__.py and 1 other location - About 1 hr to fix
      plugins/Phoner/__init__.py on lines 511..519

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

      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

      class Conference(eg.ActionBase):
          def __call__(self):
              if PhonerWin():
                  if self.plugin.CheckWorkerThread():
                      self.plugin.workerThread.CallWait(
      Severity: Major
      Found in plugins/Phoner/__init__.py and 1 other location - About 1 hr to fix
      plugins/Phoner/__init__.py on lines 500..508

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

      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

      There are no issues that match your filters.

      Category
      Status