Showing 204 of 260 total issues
Function anthropic_completion
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def anthropic_completion(
Function main
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def main(input_path, output_path):
with open(input_path, "r") as r, open(output_path, "w") as w:
def flush(text_id, fragments):
text = " ".join(fragments)
text = preprocess_text(text, text_id)
- Read upRead up
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()
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if current_agent and current_message:
if current_agent != "bot":
is_bad_record = True
break
messages.append({
Function interact
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def interact(
Function predict
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def predict(k_shots: pd.DataFrame, test_data: pd.DataFrame, task_name: str, predict_func, batch_size):
if task_name in ['ru_worldtree', 'ru_openbook']:
k_shots_pairs = [(OPENBOOK_PROMPT, "B")]
for row in k_shots.to_dict(orient="records"):
question = row["question"]
- Read upRead up
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_danetqa
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def predict_danetqa(
split,
predict_func,
output_path,
batch_size: int = 4,
- Read upRead up
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
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if current_agent and current_message:
if current_agent != "user":
is_bad_record = True
break
messages.append({
Function generate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def generate(
Function predict_lidirus
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def predict_lidirus(
Function get_pool
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_pool(pool_id, toloka_client):
records = []
for assignment in toloka_client.get_assignments(pool_id=pool_id):
solutions = assignment.solutions
if not solutions:
- Read upRead up
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 8 (exceeds 5 allowed). Consider refactoring. Open
def main(
input_path,
output_path,
template_path,
model_name="gpt-3.5-turbo",
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if host in record.url:
is_bad_host = True
if is_bad_host:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, posts_path, users_path, comments_path, output_path, min_score=-1000, max_responses=1000):
Avoid deeply nested control flow statements. Open
with connection.cursor() as comments_cursor:
comments_cursor.execute("SELECT * FROM pikabu_comments WHERE story_id = {}".format(record["id"]))
for row in comments_cursor:
header = [desc.name for desc in comments_cursor.description]
comment = dict(zip(header, row))
Avoid deeply nested control flow statements. Open
if clean_section:
clean_sections.append(clean_section)
record["sections"] = clean_sections
Function main
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def main(
Function split
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def split(
Function train_tokenizer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def train_tokenizer(
dataset_path,
train_path,
output_dir,
sample_rate,
- Read upRead up
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"