unclesp1d3r/CipherSwarm

View on GitHub

Showing 34 of 475 total issues

Method hashcat_parameters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def hashcat_parameters
    parameters = []
    parameters << attack_mode_param
    parameters << markov_threshold_param if classic_markov
    parameters << "-O" if optimized
Severity: Minor
Found in app/models/attack.rb - 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

Method update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    if hash_list_params[:file].present?
      @hash_list.processed = false
    end

Severity: Minor
Found in app/controllers/hash_lists_controller.rb - 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 method.
Open

      return nil if patch_match.empty?
Severity: Major
Found in app/models/cracker_binary.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return tasks.create(attack: attack, start_date: Time.zone.now) if meets_performance_threshold?(attack.hash_mode)
Severity: Major
Found in app/models/agent.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return nil if latest.nil?
Severity: Major
Found in app/models/cracker_binary.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return pending_task if pending_task
Severity: Major
Found in app/models/agent.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return head :gone if @task.paused?
Severity: Major
Found in app/controllers/api/v1/client/tasks_controller.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return
Severity: Major
Found in app/controllers/api/v1/client/crackers_controller.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

    return unless task.completed?
Severity: Major
Found in app/controllers/api/v1/client/tasks_controller.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return patch_match.first if patch_match.first.patch_version > sem_version.patch
Severity: Major
Found in app/models/cracker_binary.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return head :no_content
Severity: Major
Found in app/controllers/api/v1/client/tasks_controller.rb - About 30 mins to fix

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

  def sidebar_link(name, path, icon)
    class_name = current_page?(path) ? "active" : ""
    content_tag :li, class: "nav-item" do
      link_to path, class: "nav-link #{class_name}" do
        if icon.nil?
Severity: Minor
Found in app/helpers/nav_helper.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(builder, attribute_name, column, input_type, options = {}) # rubocop:disable Metrics/ParameterLists
    raise ArgumentError, "EnumInput requires an enum column." unless column.is_a? ActiveRecord::Enum::EnumType

    # Enum's are only required if we do not allow nil values
    inclusion_validator = builder.object.class.validators_on(attribute_name).find { |v| v.kind == :inclusion }
Severity: Minor
Found in app/inputs/EnumInput.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    respond_to do |format|
      if @attack.update(attack_params)
        @attack.abandon! if @attack.can_abandon?
        format.html { redirect_to campaigns_path(@attack.campaign), notice: "Attack was successfully updated." }
Severity: Minor
Found in app/controllers/attacks_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