IlyaGusev/rupo

View on GitHub

Showing 117 of 117 total issues

Avoid deeply nested control flow statements.
Open

                        if phonemes[i] in CMUDict.diphtongs:
                            diphtongs_count += 1
                p = "".join([CMUDict.aprabet2ipa[phoneme] for phoneme in phonemes])
Severity: Major
Found in rupo/dict/cmu.py - About 45 mins to fix

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

        def __init__(self, language="ru", raw_dict_path=None, trie_path=None,
    Severity: Minor
    Found in rupo/stress/predictor.py - About 35 mins to fix

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

          def __init__(self, line_number: int, word_number: int, syllable_number: int,
      Severity: Minor
      Found in rupo/metre/metre_classifier.py - About 35 mins to fix

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

            def __init__(self, node: TreeNode, string_pos: int, strong_errors: int, weak_errors: int, pattern: str):
        Severity: Minor
        Found in rupo/metre/pattern_analyzer.py - About 35 mins to fix

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

              def __init__(self, begin: int, end: int, number: int, text: str, stress: int=-1) -> None:
          Severity: Minor
          Found in rupo/main/markup.py - About 35 mins to fix

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

                def __init__(self, syllable_count: int, stressed_syllable_number: int,
            Severity: Minor
            Found in rupo/rhymes/rhymes.py - About 35 mins to fix

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

                  def __init__(self, text: str, token_type: TokenType, begin: int, end: int):
              Severity: Minor
              Found in rupo/main/tokenizer.py - About 35 mins to fix

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

                    def get_improved_markup(markup: Markup, result: ClassificationResult) -> Markup:
                        """
                        Улучшаем разметку после классификации метра.
                
                        :param markup: начальная разметка.
                Severity: Minor
                Found in rupo/metre/metre_classifier.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

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

                    @classmethod
                    def setUpClass(cls):
                        cls.stress_predictor = CombinedStressPredictor(
                Severity: Minor
                Found in rupo/main/test_markup.py and 1 other location - About 35 mins to fix
                rupo/stress/test_predictor.py on lines 13..15

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

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

                    @classmethod
                    def setUpClass(cls):
                        cls.stress_predictor = CombinedStressPredictor(
                Severity: Minor
                Found in rupo/stress/test_predictor.py and 1 other location - About 35 mins to fix
                rupo/main/test_markup.py on lines 15..17

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

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

                    def __get_rhyme_profile(word: StressedWord) -> 'RhymeProfile':
                        """
                        Получение профиля рифмовки (набора признаков для сопоставления).
                
                        :param word: уже акцентуированное слово (Word).
                Severity: Minor
                Found in rupo/rhymes/rhymes.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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(self,
                                 stress_vocabulary: StressVocabulary,
                                 metre_pattern: str,
                                 rhyme_pattern: str,
                                 n_syllables: int,
                Severity: Minor
                Found in rupo/generate/transforms.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 process_text has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def process_text(text: str, stress_predictor) -> 'Markup':
                        """
                        Получение начального варианта разметки по слогам и ударениям.
                
                        :param text: текст для разметки
                Severity: Minor
                Found in rupo/main/markup.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

                Function parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def parse(self, markup_path: str, from_voc: bool=False):
                         if from_voc:
                            word_indexes = Reader.read_vocabulary(markup_path)
                            for word, index in word_indexes:
                                self.add_word(word.to_stressed_word(), index)
                Severity: Minor
                Found in rupo/main/vocabulary.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

                Function count_vowels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def count_vowels(self):
                        num_vowels = 0
                        for word in self.words:
                            for syllable in word.syllables:
                                if get_first_vowel_position(syllable.text) != -1:
                Severity: Minor
                Found in rupo/main/markup.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

                TODO found
                Open

                                    # TODO: ленивый парсинг
                Severity: Minor
                Found in rupo/files/reader.py by fixme

                TODO found
                Open

                        # TODO: Переход на фонетическое слово, больше признаков.
                Severity: Minor
                Found in rupo/rhymes/rhymes.py by fixme
                Severity
                Category
                Status
                Source
                Language