christabor/namebot

View on GitHub

Showing 83 of 83 total issues

File latin_words.py has 3180 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""taken from
https://www.math.ubc.ca/~cass/frivs/latin/latin-dict-full.html
"""

words = {
Severity: Major
Found in namebot/latin_words.py - About 1 wk to fix

    File techniques.py has 716 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Primary techniques for the core functionality of namebot."""
    
    from __future__ import absolute_import
    from __future__ import division
    
    
    Severity: Major
    Found in namebot/techniques.py - About 1 day to fix

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

      class ScoringLengthTestCase(unittest.TestCase):
      
          def test_score_length1(self):
              self.assertEqual(sc.score_length('a really long company name'), 1)
      
      
      Severity: Major
      Found in namebot/tests/test_scoring.py and 1 other location - About 1 day to fix
      namebot/tests/test_scoring.py on lines 77..98

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

      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 ScoringSimplicityTestCase(unittest.TestCase):
      
          def test_score_simple1(self):
              self.assertEqual(sc.score_simplicity('a very poor name indeed'), 1)
      
      
      Severity: Major
      Found in namebot/tests/test_scoring.py and 1 other location - About 1 day to fix
      namebot/tests/test_scoring.py on lines 26..47

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

      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 FilterConsonantEndingTestCase(unittest.TestCase):
      
          def test_filter_none(self):
              words = ['foo', 'neato']
              res = [w for w in words if strain.filter_consonant_ending(w)]
      Severity: Major
      Found in namebot/tests/test_strainer.py and 1 other location - About 1 day to fix
      namebot/tests/test_strainer.py on lines 147..162

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

      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 FilterVowelEndingTestCase(unittest.TestCase):
      
          def test_filter_none(self):
              words = ['bar', 'baz']
              res = [w for w in words if strain.filter_vowel_ending(w)]
      Severity: Major
      Found in namebot/tests/test_strainer.py and 1 other location - About 1 day to fix
      namebot/tests/test_strainer.py on lines 165..180

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

      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 FilterNysiisTestCase(unittest.TestCase):
      
          def setUp(self):
              self.words = ['foo', 'bar', 'baz', 'quux', 'what', 'improbable']
      
      
      Severity: Major
      Found in namebot/tests/test_strainer.py and 1 other location - About 7 hrs to fix
      namebot/tests/test_strainer.py on lines 117..129

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

      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 FilterSoundexTestCase(unittest.TestCase):
      
          def setUp(self):
              self.words = ['foo', 'bar', 'baz', 'quux', 'what', 'improbable']
      
      
      Severity: Major
      Found in namebot/tests/test_strainer.py and 1 other location - About 7 hrs to fix
      namebot/tests/test_strainer.py on lines 132..144

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

      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 make_vowel has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

      def make_vowel(words, vowel_type, vowel_index):
          """Primary for all Portmanteau generators.
      
          This creates the portmanteau based on :vowel_index, and :vowel_type.
      
      
      Severity: Minor
      Found in namebot/techniques.py - About 5 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 metrics.py has 355 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """Metrics for measuring various aspects of words.
      
      Conventions used in this utility:
      1.  All functions return a dictionary,
          with key 'data' and/or 'summary':
      Severity: Minor
      Found in namebot/metrics.py - About 4 hrs to fix

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

        def filter_soundex(word, code=None):
            """Get soundex value, checking result against a given code.
        
            :param word (str): The word.
            :param code (str, optional): The soundex pronunciation code.
        Severity: Major
        Found in namebot/strainer.py and 1 other location - About 4 hrs to fix
        namebot/strainer.py on lines 116..126

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

        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 filter_nysiis(word, code=None):
            """Get nysiis value, checking score.
        
            :param word (str): The word.
            :param code (str, optional): The nysiis pronunciation code.
        Severity: Major
        Found in namebot/strainer.py and 1 other location - About 4 hrs to fix
        namebot/strainer.py on lines 102..113

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

        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 test_phrase(self):
                res = metrics.categorize_word_type(self.words)
                self.assertEqual(res[0][1]['real'], 50)
                self.assertEqual(res[0][1]['phrase'], 0)
        Severity: Major
        Found in namebot/tests/test_metrics.py and 1 other location - About 4 hrs to fix
        namebot/tests/test_metrics.py on lines 167..170

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

        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 test_not_phrase(self):
                res = metrics.categorize_word_type(self.words)
                self.assertEqual(res[1][1]['real'], 0)
                self.assertEqual(res[1][1]['phrase'], 50)
        Severity: Major
        Found in namebot/tests/test_metrics.py and 1 other location - About 4 hrs to fix
        namebot/tests/test_metrics.py on lines 172..175

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

        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

        File test_techniques.py has 332 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """Techniques module tests."""
        
        import unittest
        
        from namebot import techniques
        Severity: Minor
        Found in namebot/tests/test_techniques.py - About 4 hrs to fix

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

          class SpoonerismTestCase(unittest.TestCase):
          
              def test_simple(self):
                  self.assertEqual(
                      techniques.spoonerism(['flim', 'boom', 'dang', 'dune']),
          Severity: Major
          Found in namebot/tests/test_techniques.py and 2 other locations - About 3 hrs to fix
          namebot/tests/test_techniques.py on lines 90..99
          namebot/tests/test_techniques.py on lines 102..111

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

          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 3 locations. Consider refactoring.
          Open

          class ForkerismTestCase(unittest.TestCase):
          
              def test_simple(self):
                  self.assertEqual(
                      techniques.forkerism(['flim', 'boom', 'dang', 'dune']),
          Severity: Major
          Found in namebot/tests/test_techniques.py and 2 other locations - About 3 hrs to fix
          namebot/tests/test_techniques.py on lines 78..87
          namebot/tests/test_techniques.py on lines 90..99

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

          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 3 locations. Consider refactoring.
          Open

          class KniferismTestCase(unittest.TestCase):
          
              def test_simple(self):
                  self.assertEqual(
                      techniques.kniferism(['flim', 'boom', 'dang', 'dune']),
          Severity: Major
          Found in namebot/tests/test_techniques.py and 2 other locations - About 3 hrs to fix
          namebot/tests/test_techniques.py on lines 78..87
          namebot/tests/test_techniques.py on lines 102..111

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

          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

          File nlp.py has 319 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """Functions that use Natural Language Processing.
          
          Word relationships found (via NLTK and other libraries)
          to find and generate related words.
          """
          Severity: Minor
          Found in namebot/nlp.py - About 3 hrs to fix

            Function suffixify has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

            def suffixify(words):
                """Apply a suffix technique to a set of words.
            
                :param words (list) - The list of words to operate on.
                :rtype new_arr (list): the updated *fixed words
            Severity: Minor
            Found in namebot/techniques.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

            Severity
            Category
            Status
            Source
            Language