BLKSerene/Wordless

View on GitHub

Showing 205 of 205 total issues

Avoid deeply nested control flow statements.
Open

                        if line and line not in items_cur:
                            items_to_imp.append(line)

Severity: Major
Found in wordless/wl_widgets/wl_lists.py - About 45 mins to fix

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

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

      Avoid deeply nested control flow statements.
      Open

                      for encoding, trs in TRS_ENCODINGS.items():
                          if encoding in tr:
                              tr = tr.replace(encoding, trs[0])
      
                              break
      Severity: Major
      Found in utils/wl_trs_translate.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                for token in sentence_seg:
                                    refs = head_refs[i_token]
        
                                    if refs is not None:
                                        token.head = self.tokens_multilevel[refs[0]][refs[1]][refs[2]][refs[3]]
        Severity: Major
        Found in wordless/wl_nlp/wl_texts.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      for token in copy.deepcopy(parallel_unit):
                                          parallel_unit_tokens_search.append(token)
          
                                          if token.punc_mark:
                                              parallel_unit_tokens_search.append(wl_texts.Wl_Token(token.punc_mark, lang = token.lang))
          Severity: Major
          Found in wordless/wl_concordancer_parallel.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if lens.any():
                                            self.set_item_num(row, i, numpy.mean(lens))
                                            self.set_item_num(row + 1, i, numpy.std(lens))
                                            self.set_item_num(row + 2, i, numpy.var(lens))
                                            self.set_item_num(row + 3, i, numpy.min(lens))
            Severity: Major
            Found in wordless/wl_profiler.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              for util, trs in TRS_NLP_UTILS.items():
                                  # Only replace language utility names after language names or at the end of text
                                  if f' - {util}' in tr or tr.endswith(util):
                                      if f' - {util}' in tr:
                                          tr = tr.replace(f' - {util}', f' - {trs[0]}', 1)
              Severity: Major
              Found in utils/wl_trs_translate.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            for j, collocate in enumerate(reversed(tags_left)):
                                                if wl_matching.check_context(
                                                    i, tokens,
                                                    context_settings = settings['search_settings']['context_settings'],
                                                    search_terms_incl = search_terms_incl,
                Severity: Major
                Found in wordless/wl_colligation_extractor.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if tuple(tokens[i + j : i + j + len(search_term)]) == tuple(search_term):
                                          excl_matched = False
                  
                                          break
                      # Search terms to be excluded not found in texts
                  Severity: Major
                  Found in wordless/wl_nlp/wl_matching.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        for sentence in doc.sents:
                                            displacy_dict = spacy.displacy.parse_deps(sentence, options = options)
                    
                                            if token_properties:
                                                for token, word in zip(sentence, displacy_dict['words']):
                    Severity: Major
                    Found in wordless/wl_nlp/wl_dependency_parsing.py - About 45 mins to fix

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

                      def wl_test_pos_tag_models(lang, pos_tagger, test_sentence, tokens, results, results_universal):
                      Severity: Minor
                      Found in tests/tests_nlp/test_pos_tagging.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        for j, cell in enumerate(row):
                                            for cell_tr, trs in ACKS_TRS.items():
                                                if cell == cell_tr:
                                                    row[j] = trs[i - 1]
                        
                        
                        Severity: Major
                        Found in utils/wl_generate_acks.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      if ngram == search_term:
                                                          colligations_freqs_file_filtered[(node, collocate)] = freqs
                          
                          
                          Severity: Major
                          Found in wordless/wl_colligation_extractor.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                for item in range(100):
                                                    item = wl_texts.Wl_Token(str(item))
                                                    freq_1, freq_2 = random.sample(range(100), 2)
                            
                                                    freq_files_items[item] = [
                            Severity: Major
                            Found in tests/tests_figs/test_figs_freqs.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if token.lemma_:
                                                      lemmas.append(token.lemma_)
                                                  else:
                                                      lemmas.append(token.text)
                                  # Stanza
                              Severity: Major
                              Found in wordless/wl_nlp/wl_lemmatization.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                for file_type, trs in TRS_FILE_TYPES.items():
                                                    if tr == file_type:
                                                        tr = trs[0]
                                
                                                        break
                                Severity: Major
                                Found in utils/wl_trs_translate.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      for token, lemma_search in set(zip(tokens, lemmas_search)):
                                                          if re_match(lemma_matched, lemma_search, flags = re_flags):
                                                              search_results.add(token)
                                  
                                  
                                  Severity: Major
                                  Found in wordless/wl_nlp/wl_matching.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                    if tr_raw != tr:
                                                        # Do not replace parentheses in file type filters
                                                        if element_src.text not in TRS_FILE_TYPES:
                                                            # Parentheses
                                                            tr = re.sub(r'\s*\(', r'(', tr)
                                    Severity: Major
                                    Found in utils/wl_trs_translate.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if self.settings_tags == 'body_tag_settings' and tag_name == '*':
                                                                  opening_tag_text = opening_tag_text.replace('*', _tr('Wl_Table_Tags', 'TAG'))
                                                                  closing_tag_text = self.model().item(row, 3).text().replace('*', _tr('Wl_Table_Tags', 'TAG'))
                                                                  preview.setText(opening_tag_text + _tr('Wl_Table_Tags', 'token') + closing_tag_text)
                                                              else:
                                      Severity: Major
                                      Found in wordless/wl_settings/wl_settings_files.py - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                                    for j, collocate in enumerate(tags_right):
                                                                        if wl_matching.check_context(
                                                                            i, tokens,
                                                                            context_settings = settings['search_settings']['context_settings'],
                                                                            search_terms_incl = search_terms_incl,
                                        Severity: Major
                                        Found in wordless/wl_colligation_extractor.py - About 45 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language