IlyaGusev/rulm

View on GitHub
self_instruct/src/data_processing/convert_rsg.py

Summary

Maintainability
B
5 hrs
Test Coverage

Function convert_rsg has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def convert_rsg(split, output_path, tasks: List[str] = ALL_TASKS, use_short: bool = True):
    functions = []
    if "danetqa" in tasks:
        functions.append(get_danetqa(split))
    if "muserc" in tasks:
Severity: Minor
Found in self_instruct/src/data_processing/convert_rsg.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 get_parus has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def get_parus(split):
    dataset = load_dataset(HF_DATASET, "parus", split=split)
    for row in dataset:
        is_cause = row["question"] == "cause"
        c1 = row["choice1"].rstrip(".").lower()
Severity: Minor
Found in self_instruct/src/data_processing/convert_rsg.py - About 45 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 get_russe has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def get_russe(split, sample_rate: float = 0.1):
    dataset = load_dataset(HF_DATASET, "russe", split=split)
    for row in dataset:
        if split != "test" and random.random() > sample_rate:
            continue
Severity: Minor
Found in self_instruct/src/data_processing/convert_rsg.py - About 45 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 get_muserc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_muserc(split):
    dataset = load_dataset(HF_DATASET, "muserc", split=split)
    for row in dataset:
        record = {
            "task": "muserc",
Severity: Minor
Found in self_instruct/src/data_processing/convert_rsg.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 get_terra has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_terra(split):
    dataset = load_dataset(HF_DATASET, "terra", split=split)
    for row in dataset:
        record = {
            "task": "terra",
Severity: Minor
Found in self_instruct/src/data_processing/convert_rsg.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 get_lidirus has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_lidirus():
    dataset = load_dataset(HF_DATASET, "lidirus", split="test")
    for row in dataset:
        record = {
            "task": "terra",
Severity: Minor
Found in self_instruct/src/data_processing/convert_rsg.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 get_rucos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_rucos(split, sample_rate: float = 0.05):
    dataset = load_dataset(HF_DATASET, "rucos", split=split)
    for row in dataset:
        if split != "test" and random.random() > sample_rate:
            continue
Severity: Minor
Found in self_instruct/src/data_processing/convert_rsg.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 get_danetqa has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_danetqa(split):
    dataset = load_dataset(HF_DATASET, "danetqa", split=split)
    for row in dataset:
        record = {
            "task": "parus",
Severity: Minor
Found in self_instruct/src/data_processing/convert_rsg.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

There are no issues that match your filters.

Category
Status