IlyaGusev/rulm

View on GitHub

Showing 204 of 260 total issues

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

def main(output_path):

    with open(output_path, "w") as w:
        with psycopg2.connect("dbname=pikabu user=postgres password=postgres") as connection:
            with connection.cursor(name="stories") as cursor:
Severity: Minor
Found in data_processing/convert_pikabu.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_saiga_k_shots has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def predict_saiga_k_shots(
Severity: Major
Found in self_instruct/src/benchmarks/eval_zs_tape.py - About 50 mins to fix

    Function predict_rwsd has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def predict_rwsd(
    Severity: Major
    Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 50 mins to fix

      Function predict_terra has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def predict_terra(
      Severity: Major
      Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 50 mins to fix

        Function generate_answers has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def generate_answers(
        Severity: Major
        Found in self_instruct/src/infer_llama3.py - About 50 mins to fix

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

              def __init__(
          Severity: Major
          Found in self_instruct/src/data_processing/embedder.py - About 50 mins to fix

            Function predict_saiga_zero_shot has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def predict_saiga_zero_shot(
            Severity: Major
            Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 50 mins to fix

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

              def main(
              Severity: Major
              Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 50 mins to fix

                Function predict_russe has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def predict_russe(
                Severity: Major
                Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 50 mins to fix

                  Function predict_muserc has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def predict_muserc(
                  Severity: Major
                  Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 50 mins to fix

                    Function predict_parus has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def predict_parus(
                    Severity: Major
                    Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 50 mins to fix

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

                      def main(
                      Severity: Major
                      Found in self_instruct/src/benchmarks/eval_lora_rsg.py - About 50 mins to fix

                        Function predict_danetqa has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def predict_danetqa(
                        Severity: Major
                        Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 50 mins to fix

                          Function predict_rcb has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def predict_rcb(
                          Severity: Major
                          Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 50 mins to fix

                            Function custom_prepare_model_for_int8_training has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def custom_prepare_model_for_int8_training(
                                model,
                                output_embedding_layer_name="lm_head",
                                layer_norm_names=["layer_norm"]
                            ):
                            Severity: Minor
                            Found in self_instruct/src/train.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 generate_answers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def generate_answers(
                                model_name: str,
                                input_path: str,
                                output_path: str,
                                batch_size: int = 1,
                            Severity: Minor
                            Found in self_instruct/src/infer_llama3.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 to_alpaca_eval has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def to_alpaca_eval(
                                input_files: str,
                                output_path: str,
                            ):
                                input_files = input_files.split(",")
                            Severity: Minor
                            Found in self_instruct/src/to_alpaca_eval.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 interact has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            def interact(
                            Severity: Minor
                            Found in self_instruct/src/interact_mistral_llamacpp.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  for dialogue in record["dialogues"]:
                                                      topic = dialogue["topic"]
                                                      existing_keys.add(get_dialogue_key(record, topic))
                                          output_records = {get_char_key(char): char for char in output_records}
                              Severity: Major
                              Found in self_instruct/src/data_processing/generate_char_chats.py - About 45 mins to fix

                                Function interact has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                def interact(
                                Severity: Minor
                                Found in self_instruct/src/interact_llama3_llamacpp.py - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language