Showing 506 of 506 total issues
Method aggressive
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def aggressive(target)
m = []
# the paths are relative to the url path if they don't start with /
# this path, with this md5 = this version
Method aggressive
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def aggressive(target)
m = []
# Check HTTP Header
if target.headers["server"] =~ /Conexant-EmWeb\/([^\r^\n]+)/ || target.headers["server"] =~ /Virata-EmWeb\/([^\r^\n]+)/
- 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 passive
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def passive(target)
m = []
# mosvisitor cookie # Also used by mambo
m << { certainty: 75, name: "mosvisitor cookie" } if target.headers["set-cookie"] =~ /mosvisitor=[0-9]+/
- 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 aggressive
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def aggressive(target)
m = []
url = URI.join(target.uri.to_s, "/contao/").to_s
new_target = WhatWeb::Target.new(url)
Method passive
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def passive(target)
m = []
# HTTP Server Header
if /^Virtual Web/.match?(target.headers["server"])
- 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 passive
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def passive(target)
m = []
# JSESSIONID Cookie
m << { name: "JSESSIONID Cookie" } if target.headers["set-cookie"] =~ /JSESSIONID=[^;]{0,32};[\s]?path=\//i
- 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 passive
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def passive(target)
m = []
regexps = [
/ids-policy rate-frame-type-param disassoc node-time-interval/,
- 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 passive
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def passive(target)
m = []
# No server HTTP header
if target.headers["server"].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 aggressive
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def aggressive(target)
m = []
# the paths are relative to the url path if they don't start with /
# this path, with this md5 = this version
Method passive
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def passive(target)
m = []
unless target.headers["server"].nil?
Similar blocks of code found in 2 locations. Consider refactoring. Open
if target.uri.to_s =~ /\/main\.htm/ && target.body =~ /\{set\("modelname", "([^"]+)"\);set\("mac", "([^"]+)"\);set\("serialno", "([^"]+)"\);set\("ver", "([^"]+)"\);setlabel\("([^"]+)"\);uptime\("([^"]+)"\);\}<\/Script>/
result = target.body.scan(/\{set\("modelname", "([^"]+)"\);set\("mac", "([^"]+)"\);set\("serialno", "([^"]+)"\);set\("ver", "([^"]+)"\);setlabel\("([^"]+)"\);uptime\("([^"]+)"\);\}<\/Script>/)[0]
device[:model] << result[0].to_s
- 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 67.
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 2 locations. Consider refactoring. Open
if target.uri.to_s =~ /\/main\.htm/ && target.body =~ /\{document.getElementById\("modelname"\).innerHTML="([^"]+)";document.getElementById\("mac"\).innerHTML="([^"]+)";document.getElementById\("serialno"\).innerHTML="([^"]+)";document.getElementById\("ver"\).innerHTML="([^"]+)";setlabel\("([^"]+)"\);uptime\("([^"]+)"\);\}<\/Script>/
result = target.body.scan(/\{document.getElementById\("modelname"\).innerHTML="([^"]+)";document.getElementById\("mac"\).innerHTML="([^"]+)";document.getElementById\("serialno"\).innerHTML="([^"]+)";document.getElementById\("ver"\).innerHTML="([^"]+)";setlabel\("([^"]+)"\);uptime\("([^"]+)"\);\}<\/Script>/)[0]
device[:model] << result[0].to_s
- 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 67.
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 aggressive
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def aggressive(target)
m = []
# the paths are relative to the url path if they don't start with /
# this path, with this md5 = this version
Method aggressive
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def aggressive(target)
m = []
# Extract details from /phpinfo.php
url = URI.join(target.uri.to_s, "/xampp/phpinfo.php").to_s
- 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 passive
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def passive(target)
m = []
# HTTP Server Header
if /^Axel Admin Server$/.match?(target.headers["server"])
- 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 startup
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def startup
# ok, set up @rfile. open once.
whatweb_folder = __dir__
country_db = whatweb_folder + "/country-ips.dat"
Method aggressive
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def aggressive(target)
m = []
# the paths are relative to the url path if they don't start with /
# this path, with this md5 = this version
Method aggressive
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def aggressive(target)
m = []
# the paths are relative to the url path if they don't start with /
# this path, with this md5 = this version
Method passive
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def passive(target)
m = []
found = []
normal_headers = %w|accept-ranges age allow cache-control cachecontrol connection content-disposition content-encoding content-language content-length content-location content-md5 content-range content-type date etag expires host last-modified location mime-version p3p pragma proxy-authenticate refresh server set-cookie status strict-transport-security trailer transfer-encoding vary via warning www-authenticate x-aspnet-version x-cache x-cache-lookup x-pad x-powered-by x-runtime x-ua-compatible x-frame-options x-xss-protection x-pingback keep-alive|
- 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 passive
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def passive(target)
m = []
# Extract plugin details
if target.body =~ /^# redistribution and commercial restrictions. Please see the WhatWeb/ || target.body =~ /^# This file is part of WhatWeb and may be subject to/
- 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"