Showing 45 of 138 total issues
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
Method check_tools
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def check_tools(tool)
case tool.name
when 'amass'
value = tool.infos['config_value']
return 'amass_invalid' unless base64?(value)
- 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 parse_reports_infos
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_reports_infos(platform, reports, collab, report_id)
report_infos = { reward: 0, collab: collab }
reports.each do |item|
next unless item
- 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 provider_is_valid?
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def provider_is_valid?(providers_params)
case providers_params[:name]
when 'scaleway'
path = '/root/.config/scw/config.yaml'
dir = File.dirname(path)
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 generate
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate
platform = Platform.find_by_name(params[:name])
unless allowed_platform?(platform)
return render status: 422, json: { message: I18n.t('errors.controllers.admin.invoices.unsupported_platform') }
end
Method parse_scopes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_scopes(scopes, slug, platform)
program = Program.find_by(slug: slug)
scopes.each do |scope|
next unless scope['attributes']['eligible_for_submission']
- 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
Function exports
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
Function globalStat
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
globalStat(scope:any,platform:'YWH'|'INTI'|'H1'):any{
let returnData:{report_by_month:any,earn_by_month:any,report_by_status:any,earnedEuro:number,collab_number:number,rapport_severity:any,average_per_rapport:number,total_rapports:number}={
"report_by_month":{},
"earn_by_month":{},
"report_by_status":{},
Function ngOnInit
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
async ngOnInit() {
this.screen = window.screen.width
if(this.screen < 960){
this.toggleLeft()
}
Function getPlatform
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
getPlatform(){
this.intigriti = {
"email":"",
"hunter_username":"",
"password":"",
Method provider_is_valid?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def provider_is_valid?(providers_params)
case providers_params[:name]
when 'scaleway'
path = '/root/.config/scw/config.yaml'
dir = File.dirname(path)
- 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
Function addScan
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
addScan(domain:any){
this.loadingModal=true
let scanProperties:AddScanData;
let scanFound=false
this.enginesList.forEach((element)=>{
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 cost
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cost
last_update = if state == 'Finished' || state == 'Stopped'
updated_at.to_i
else
Time.now.to_i