IlyaGusev/rulm

View on GitHub
data_processing/save_hf.py

Summary

Maintainability
D
2 days
Test Coverage

Function dump_pikabu has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

def dump_pikabu(archive):
    post_text_processor = TextProcessor(
        min_chars=50,
        min_text_part=0.7,
        fix_punct=False,
Severity: Minor
Found in data_processing/save_hf.py - About 7 hrs 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

File save_hf.py has 333 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import argparse
import json
import random
from collections import defaultdict

Severity: Minor
Found in data_processing/save_hf.py - About 4 hrs to fix

    Function dump_stackoverflow has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def dump_stackoverflow(archive):
        text_processor = TextProcessor(
            min_chars=100,
            min_text_part=0.0,
            fix_punct=False,
    Severity: Minor
    Found in data_processing/save_hf.py - About 3 hrs 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 dump_habr has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    def dump_habr(archive):
        text_processor = TextProcessor()
        habr = load_dataset('IlyaGusev/habr', split="train", streaming=True)
        text_processor = TextProcessor(
            min_chars=100,
    Severity: Minor
    Found in data_processing/save_hf.py - About 3 hrs 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 dump_librusec has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def dump_librusec(archive, sample_rate=0.15):
        max_sentences_count = 100
        text_processor = TextProcessor()
        librusec = load_dataset("IlyaGusev/librusec", split="train", streaming=True)
        for row in tqdm(librusec):
    Severity: Minor
    Found in data_processing/save_hf.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

    There are no issues that match your filters.

    Category
    Status