IlyaGusev/rulm

View on GitHub

Showing 204 of 260 total issues

Function improve_instructions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def improve_instructions(
    original_tasks_path,
    output_path,
    depth_template_path,
    depth_methods_path,
Severity: Minor
Found in self_instruct/src/data_processing/improve_instructions.py - About 1 hr 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 filter_claude has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def filter_claude(
    input_path: str,
    output_path: str,
    model_name: str = "claude-3-opus-20240229"
):
Severity: Minor
Found in self_instruct/src/data_processing/filter_claude.py - About 1 hr 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 fetch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def fetch(train_path, val_path, min_score: int = 9):
    records = []
    for row in load_dataset("IlyaGusev/saiga_scored", split="train"):
        score = row["opus_score"]
        is_bad_by_regex = row["is_bad_by_regex"]
Severity: Minor
Found in self_instruct/src/data_processing/fetch_slim.py - About 1 hr 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 fix_blocks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def fix_blocks(blocks):
    fixed_blocks = []
    for block in blocks:
        block_type = block["type"]
        assert block_type in ("i", "v", "t", "vf", "if"), block
Severity: Minor
Found in data_processing/convert_pikabu.py - About 1 hr 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 main has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def main(
    token,
    agg_output,
    raw_output,
    pools_file,
Severity: Minor
Found in self_instruct/crowd/aggregate.py - About 1 hr to fix

    Function preprocess_text has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def preprocess_text(text):
        for _ in range(10):
            text = text.replace("::", " ")
    
        text = TEXT_PROCESSOR(text)
    Severity: Minor
    Found in data_processing/convert_wiki.py - About 1 hr to fix

      Function main has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def main(
      Severity: Major
      Found in self_instruct/crowd/upload.py - About 1 hr to fix

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

            def __init__(
        Severity: Major
        Found in self_instruct/src/util/chat.py - About 1 hr to fix

          Function predict_rucos has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def predict_rucos(
          Severity: Major
          Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 1 hr to fix

            Function load_saiga has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def load_saiga(
            Severity: Major
            Found in self_instruct/src/util/load.py - About 1 hr to fix

              Function preprocess_text has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def preprocess_text(text, text_id):
                  text = TEXT_PROCESSOR(text)
                  if text is None:
                      print("Skipping id {}, pii/code/language/links".format(text_id))
                      return
              Severity: Minor
              Found in data_processing/create_librusec.py - About 55 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 fetch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def fetch(train_path, val_path):
                  records = []
                  for row in load_dataset("IlyaGusev/saiga_reward", split="train"):
                      if row["source"] != "gpt4_vs_saiga":
                          continue
              Severity: Minor
              Found in self_instruct/src/data_processing/fetch_reward.py - About 55 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 predict_parus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def predict_parus(
                  split,
                  predict_func,
                  output_path,
                  batch_size: int = 12,
              Severity: Minor
              Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 55 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_batch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def process_batch(batch, model_name, template_path):
                  prompts = [[
                      {"role": "user", "content": encode_prompt(r, template_path)}
                  ] for r in batch]
                  results = openai_batch_completion(
              Severity: Minor
              Found in self_instruct/src/data_processing/generate_char_topics.py - About 55 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 main has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def main(
                  model_name,
                  nrows: int = None,
                  template_path: str = "internal_prompts/saiga_v2.json",
                  split: str = "test",
              Severity: Minor
              Found in self_instruct/src/benchmarks/eval_lora_rsg.py - About 55 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 compose_sft_dataset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def compose_sft_dataset(config_path: str, train_path: str, val_path: str):
                  with open(config_path) as r:
                      config = json.load(r)
              
                  records = []
              Severity: Minor
              Found in self_instruct/src/data_processing/compose_pref_dataset.py - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __init__(
                      self,
                      original_records: List[Dict],
                      tokenizer: AutoTokenizer,
                      max_tokens_count: int,
              Severity: Minor
              Found in self_instruct/src/train_kto.py - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __init__(
                      self,
                      original_records: List[Dict],
                      tokenizer: AutoTokenizer,
                      max_tokens_count: int,
              Severity: Minor
              Found in self_instruct/src/train_orpo.py - About 55 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 main has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def main(output_path, visited_urls_path, sleep_time: int = 1):
                  urls = set()
                  if os.path.exists(visited_urls_path):
                      with open(visited_urls_path) as r:
                          lines = r.readlines()
              Severity: Minor
              Found in data_processing/create_ficbook.py - About 55 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 main has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def main(
                  input_path,
                  output_path,
                  num_perm
              ):
              Severity: Minor
              Found in data_processing/undup.py - About 55 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