qomoteam/qomo

View on GitHub

Showing 66 of 97 total issues

Avoid too many return statements within this function.
Open

            return options.messages[check];
Severity: Major
Found in app/assets/javascripts/rails.validations.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return 0
    Severity: Major
    Found in scripts/scholar.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return True
      Severity: Major
      Found in scripts/scholar.py - About 30 mins to fix

        Method read_last has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def read_last(path, boffset, len)
            File.open(path) do |file|
              boffset ||= file.size
              len ||= 1.kilobytes
              if file.is_rdout?
        Severity: Minor
        Found in app/services/reader/text_reader.rb - About 25 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

        Method run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def run
            tool = Tool.find(params[:id])
        
            not_found unless tool
            unauthorized unless tool.runnable
        Severity: Minor
        Found in app/controllers/tools_controller.rb - About 25 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

        Method toogle_shared has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def toogle_shared
            pipeline = Pipeline.find params[:id]
            authorize! :manage, pipeline
        
            pipeline.update shared: params[:shared].to_bool
        Severity: Minor
        Found in app/controllers/pipelines_controller.rb - About 25 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

        Severity
        Category
        Status
        Source
        Language