BLKSerene/Wordless

View on GitHub
utils/wl_trs_translate.py

Summary

Maintainability
B
5 hrs
Test Coverage

Avoid deeply nested control flow statements.
Open

                for lang, trs in TRS_LANGS.items():
                    # Language names
                    if tr == lang:
                        tr = trs[0]
                    # Encoding names
Severity: Major
Found in utils/wl_trs_translate.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                    if any((text in tr for text in [])):
                        # Flag translation as unfinished to be reviewed manually
                        unfinished = True
    
    
    Severity: Major
    Found in utils/wl_trs_translate.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

                        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 item, trs in TRS_MISC.items():
                              if tr == item:
                                  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 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 util, trs in TRS_NLP_UTILS.items():
                                  # Only replace language util 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

                There are no issues that match your filters.

                Category
                Status