giganticode/codeprep

View on GitHub

Showing 82 of 82 total issues

Avoid too many return statements within this function.
Open

            return '5'
Severity: Major
Found in codeprep/api/common.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return '9'
    Severity: Major
    Found in codeprep/api/common.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return preprocessing_result
      Severity: Major
      Found in codeprep/tokentypes/containers.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return ClosingBracket()
        Severity: Major
        Found in codeprep/parse/matchers.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return None
          Severity: Major
          Found in codeprep/prepconfig.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return '4'
            Severity: Major
            Found in codeprep/api/common.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return Operator(value)
              Severity: Major
              Found in codeprep/parse/matchers.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return '1'
                Severity: Major
                Found in codeprep/api/common.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return '2'
                  Severity: Major
                  Found in codeprep/api/common.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return '6'
                    Severity: Major
                    Found in codeprep/api/common.py - About 30 mins to fix

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

                          def get_word_splitter(self) -> Optional[Splitter]:
                              split_param_value = self.get_param_value(PrepParam.SPLIT)
                              if split_param_value in ['4', '5', '6', '7', '8', '9']:
                                  return lambda s, c: get_bpe_subwords(s, c)
                              elif split_param_value in ['1', '2']:
                      Severity: Minor
                      Found in codeprep/prepconfig.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 to_char_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def to_char_list(word: str):
                          i = 0
                          res = []
                          while i < len(word):
                              if word[i] != ESCAPE_CHAR or i+1 == len(word):
                      Severity: Minor
                      Found in codeprep/bpepkg/bpe_encode.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def create(cls: Type['Dataset'], path_to_dataset: str, prep_config: PrepConfig, extensions: Optional[str],
                                     custom_bpe_config: Optional[CustomBpeConfig],
                                     bpe_config: Optional[BpeConfig] = None,
                                     overriden_path_to_prep_dataset: Optional[str] = None, suppress_caching: bool = False) -> 'Dataset':
                              if not os.path.exists(path_to_dataset):
                      Severity: Minor
                      Found in codeprep/pipeline/dataset.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def create(merge_list_id: str, n_merges: int) -> 'CustomBpeConfig':
                              dataset_bpe_dir = get_dataset_bpe_dir(merge_list_id)
                              min_merges = get_min_merges(dataset_bpe_dir, limit=n_merges)
                              # check if not None?
                              dir_with_min_merges = os.path.join(dataset_bpe_dir, str(min_merges))
                      Severity: Minor
                      Found in codeprep/pipeline/bperegistry.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 from_suffix has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def from_suffix(suffix: str):
                              if suffix.find(BpeConfig.CASE_NO) != -1:
                                  case = 'no'
                              elif suffix.find(BpeConfig.CASE_PREFIX) != -1:
                                  case = 'prefix'
                      Severity: Minor
                      Found in codeprep/bpepkg/bpe_config.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 preprocess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def preprocess(text: str, config: PrepConfig, bpe_codes_id: Optional[str] = None, extension: Optional[str] = None,
                                     force_reinit_bpe_data: bool = True, append_eof: bool = False, path: Optional[Path] = None) \
                              -> Union[TokenSequence, Tuple[TokenSequence, SnippetStructure]]:
                          parsed = [parsed_token for parsed_token in convert_text(text, extension)]
                          parsed = remove_trailing_newline(parsed)
                      Severity: Minor
                      Found in codeprep/api/text.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 transform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def transform(self, value: str) -> Operator:
                              if value == ';':
                                  return Semicolon()
                              elif value == '{':
                                  return OpeningCurlyBracket()
                      Severity: Minor
                      Found in codeprep/parse/matchers.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

                      Method equals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          @Override
                          public boolean equals(Object o) {
                              if (this == o) return true;
                              if (o == null || this.getClass() != o.getClass()) return false;
                              MoveResult that = (MoveResult) o;

                      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

                      Method makeMove has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private MoveResult makeMove(Player player) {
                              PlayerStats playerStats = this.gameStats.getPlayerStats(player);
                              Set<Combination> availableCombinations = playerStats.getAvailableCombinations();
                      
                              DiceLayout fixedDiceLayout = DiceLayout.empty();

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

                          def __next__(self) -> 'CodeLocation':
                              try:
                                  return next(self.snippet_iterator)
                              except StopIteration:
                                  self.current_snippet += 1
                      Severity: Minor
                      Found in codeprep/preprocess/codestructure.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

                      Severity
                      Category
                      Status
                      Source
                      Language