Showing 178 of 178 total issues
Consider simplifying this complex logical expression. Open
if linux == 0 &&
osx == 0 &&
freebsd == 0 &&
netbsd == 0 &&
cisco == 0 &&
Method load_config
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def load_config file=CONFIG_FILE, in_memory_config=false
if File.exist?(file) == true or in_memory_config == true
begin
if in_memory_config
yaml = YAML::load(file)
- 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 migrate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def migrate direction
begin
if @database["adapter"] == nil
return false, "[!] Invalid database adapter, please check your configuration file"
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 db_connect
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def db_connect
begin
if @database["adapter"] == nil
puts "[!] #{@database['adapter']}" if @options[:debug]
- 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 initialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@info =
{
:description => "Adobe Shockwave Player Patch Rollup",
:plugin_id => -99991,
Method render
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render output
output.text Report.classification.upcase, :align => :center
output.text "\n"
output.font_size(22) { output.text Report.title, :align => :center }
Similar blocks of code found in 3 locations. Consider refactoring. Open
def render output
text Report.classification.upcase, :align => :center
text "\n"
report_title Report.title
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
def render output
text Report.classification.upcase, :align => :center
text "\n"
report_title Report.title
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
def render output
text Report.classification.upcase, :align => :center
text "\n"
report_title Report.title
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method initialize
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@info =
{
:description => "Microsoft Office Patch Rollup",
:plugin_id => -99946,
Method render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render output
output.image "#{File.expand_path(File.dirname(__FILE__))}/data/nessuslogo.jpg", :scale => 0.2, :position => :left, :vposition => :top
text "\n"
text "\n"
Method initialize
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@info =
{
:description => "VMware vCenter Patch Rollup",
:plugin_id => -99979,
Method render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render output
@output.text Report.classification.upcase, :align => :center
@output.text "\n"
report_title Report.title
Method windows_os_graph_text
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def windows_os_graph_text
nt = Host.os_windows_nt.to_a.size
w2k = Host.os_windows_2k.to_a.size
xp = Host.os_windows_xp.to_a.size
w2k3 = Host.os_windows_2k3.to_a.size
Method windows_os_graph_text
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def windows_os_graph_text
nt = Host.os_windows_nt.to_a.size
w2k = Host.os_windows_2k.to_a.size
xp = Host.os_windows_xp.to_a.size
w2k3 = Host.os_windows_2k3.to_a.size
- 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 print_technical_findings
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def print_technical_findings(risks, text, color, last=false)
if risks.length > 0
title text, 18, color
risks.each do |f|
Method initialize
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@info =
{
:description => "OpenSSH Patch Rollup",
:plugin_id => -99995,
Method text
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def text
nt = Host.os_windows_nt.to_a.count
w2k = Host.os_windows_2k.to_a.count
xp = Host.os_windows_xp.to_a.count
w2k3 = Host.os_windows_2k3.to_a.count
Method db_connect
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def db_connect
begin
if @database["adapter"] == nil
puts "[!] #{@database['adapter']}" if @options[:debug]
Method initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@info =
{
:description => "Cisco IOS Patch Rollup",
:plugin_id => -99965,