Method build_nuclei_scan_cmd
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def build_nuclei_scan_cmd(scan, scan_cmd)
scan_cmd[:cmd] += " --nuclei #{scan.nuclei}"
unless (scan.custom_templates && !scan.custom_templates.empty?) || scan.all_templates
scan_cmd[:errors] = 'no_nuclei_templates'
- Read upRead up
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
File scans_controller.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ScansController < ApplicationController
before_action :authenticate_user, except: %i[update_outside]
# GET /scans
def index
Method build_nuclei_scan_cmd
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_nuclei_scan_cmd(scan, scan_cmd)
scan_cmd[:cmd] += " --nuclei #{scan.nuclei}"
unless (scan.custom_templates && !scan.custom_templates.empty?) || scan.all_templates
scan_cmd[:errors] = 'no_nuclei_templates'
Method build_recon_scan_cmd
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def build_recon_scan_cmd(scan, scan_cmd)
scan_cmd[:errors] = 'missing_amass' unless File.exist?(File.join(scan_config_files, 'amass/config.ini'))
scan_cmd = build_recon_scan_leak_cmd(scan_cmd) if scan.leak
scan_cmd = build_recon_scan_intel_cmd(scan_cmd) if scan.intel
- Read upRead up
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 launch_scan
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def launch_scan(cmd, scan, server, base_domain)
if scan.type_scan == 'recon'
domain = Domain.find_by(name: scan.domain)
domain.nil? ? Domain.create(name: scan.domain) : domain.update(updated_at: Time.now)
end
- Read upRead up
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 launch_server
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def launch_server(scan)
server_infos = {}
unless scan.provider == 'scaleway' || scan.provider == 'aws'
server_infos[:error] = 'unknown_provider'
Method launch_server
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def launch_server(scan)
server_infos = {}
unless scan.provider == 'scaleway' || scan.provider == 'aws'
server_infos[:error] = 'unknown_provider'
- Read upRead up
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 create
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
scan_infos = params.require(:scan).permit(
:domain, :meshs, :type_scan, :instance_type, :provider, :notifs, :active_recon, :intel, :leak, :nuclei,
:all_templates, :custom_interactsh, :permutation, :gau, excludes: [], nuclei_severity: [], custom_templates: []
)
Method build_scan_cmd
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_scan_cmd(scan)
scan_cmd = { cmd: 'ruby /tmp/tools/scan.rb' }
hunt3r_token = Tool.find_by(name: 'hunt3r_token')&.infos
scan_cmd[:errors] = 'hunt3r_token' if hunt3r_token.nil?
- Read upRead up
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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
scan_infos = params.require(:scan).permit(
:domain, :meshs, :type_scan, :instance_type, :provider, :notifs, :active_recon, :intel, :leak, :nuclei,
:all_templates, :custom_interactsh, :permutation, :gau, excludes: [], nuclei_severity: [], custom_templates: []
)
- Read upRead up
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"