IlyaGusev/rulm

View on GitHub

Showing 260 of 260 total issues

Function predict has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def predict(k_shots: pd.DataFrame, test_data: pd.DataFrame, task_name: str, predict_func, batch_size):
Severity: Minor
Found in self_instruct/src/benchmarks/eval_zs_tape.py - About 35 mins to fix

    Function train has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def train(
    Severity: Minor
    Found in self_instruct/src/train_reward.py - About 35 mins to fix

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

      def main(
      Severity: Minor
      Found in self_instruct/src/data_processing/generate_char_image_prompts.py - About 35 mins to fix

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

        def main(
        Severity: Minor
        Found in self_instruct/src/data_processing/generate_chat.py - About 35 mins to fix

          Function train_tokenizer has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def train_tokenizer(
          Severity: Minor
          Found in rulm/train_tokenizer.py - About 35 mins to fix

            Function add has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def add(self, task, task_type, inputs, outputs, source):
            Severity: Minor
            Found in data_processing/hf_to_instruct.py - About 35 mins to fix

              Function preprocess has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def preprocess(
              Severity: Minor
              Found in rulm/preprocess.py - About 35 mins to fix

                Function predict_rwsd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

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

                    def __call__(self, texts):
                        embeddings = torch.zeros((len(texts), self.model.config.hidden_size))
                        total = len(texts) // self.batch_size + 1
                        desc = "Calc embeddings"
                        if self.text_prefix:
                Severity: Minor
                Found in self_instruct/src/data_processing/embedder.py - About 35 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 find_lcs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def find_lcs(s1, s2):
                    max_lcs = ""
                    for i in range(len(s1)):
                        for j in range(i + 1, len(s1)):
                            ss1 = s1[i:j]
                Severity: Minor
                Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def main(
                    chars_path,
                    output_path,
                    template_path,
                    model_name="gpt-4",
                Severity: Minor
                Found in self_instruct/src/data_processing/generate_char_topics.py - About 35 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 set_regex_flag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def set_regex_flag(records):
                    new_records = []
                    for record in records:
                        messages = record["messages"]
                        user_messages = [m for m in messages if m["role"] == "user"]
                Severity: Minor
                Found in self_instruct/src/data_processing/clean_user_conversations.py - About 35 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 7 (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/dataset.py - About 35 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_terra has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

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

                def analyze(input_path, tasks_path):
                    with open(input_path) as r:
                        annotations = json.load(r)
                    with open(tasks_path) as r:
                        tasks = [json.loads(line) for line in r]
                Severity: Minor
                Found in self_instruct/src/analyze_alpaca_eval.py - About 35 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 openai_completion has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def openai_completion(
                    messages,
                    decoding_args,
                    model_name,
                    sleep_time
                Severity: Minor
                Found in self_instruct/src/util/openai.py - About 35 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 normalize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def normalize(self, text):
                        text = unicodedata.normalize(self.normalization, text)
                
                        for old, new in HTML_ARTEFACTS.items():
                            text = text.replace(old, new)
                Severity: Minor
                Found in data_processing/util.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def main(
                    input_path,
                    output_path,
                    sample_rate
                ):
                Severity: Minor
                Found in data_processing/convert_wiki.py - About 35 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 parse_poem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def parse_poem(self, poem):
                        # poemType
                        # https://github.com/gribuser/fb2/blob/master/FictionBook.xsd#L321
                        title = poem.find("./fb:title", NS)
                        title_str = self.parse_content(title) if title is not None else None
                Severity: Minor
                Found in data_processing/parse_fb2.py - About 35 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

                Avoid too many return statements within this function.
                Open

                            return None
                Severity: Major
                Found in self_instruct/src/data_processing/generate_char_chats.py - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language