IlyaGusev/rulm

View on GitHub
self_instruct/src/benchmarks/eval_zs_rsg.py

Summary

Maintainability
F
4 days
Test Coverage

File eval_zs_rsg.py has 698 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from typing import Tuple, Callable
import re
import copy
from pathlib import Path
from tqdm import tqdm
Severity: Major
Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 1 day to fix

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

    def main(
        model_name,
        nrows: int = None,
        template_path: str = "internal_prompts/saiga_v2.json",
        split: str = "test",
    Severity: Minor
    Found in self_instruct/src/benchmarks/eval_zs_rsg.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 predict_muserc has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def predict_muserc(
        split,
        predict_func,
        output_path,
        batch_size: int = 2,
    Severity: Minor
    Found in self_instruct/src/benchmarks/eval_zs_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 predict_rucos has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def predict_rucos(
        split,
        predict_func,
        output_path,
        batch_size: int = 4,
    Severity: Minor
    Found in self_instruct/src/benchmarks/eval_zs_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 predict_rucos has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def predict_rucos(
    Severity: Major
    Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 1 hr to fix

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

      def predict_parus(
          split,
          predict_func,
          output_path,
          batch_size: int = 12,
      Severity: Minor
      Found in self_instruct/src/benchmarks/eval_zs_rsg.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_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 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 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 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,
                        Severity: Minor
                        Found in self_instruct/src/benchmarks/eval_zs_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 predict_lidirus has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def predict_lidirus(
                        Severity: Minor
                        Found in self_instruct/src/benchmarks/eval_zs_rsg.py - About 45 mins to fix

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

                          def generate(
                          Severity: Minor
                          Found in self_instruct/src/benchmarks/eval_zs_rsg.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 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 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

                            There are no issues that match your filters.

                            Category
                            Status