Showing 714 of 714 total issues
Module has too many lines. [206/100] Open
module Command
def Command.sendAllSessions(cmd, wsList)
wsList.each_with_index {|_item, index|
Bbs::WebSocket.sendCommand(cmd, wsList[index])
}
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class has too many lines. [148/100] Open
class WebSocket
@@wsList = Array.new
@@selected = -1
def setSelected(newSelected)
@@selected = newSelected
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [62/10] Open
def cmdLine(log, wss, configfile, commands, infoCommands)
log.info("Command line started.")
begin
while cmdIn = Readline::readline("\nbbs > ".colorize(:cyan))
case cmdIn.split()[0]
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for cmdLine is too high. [58.86/15] Open
def cmdLine(log, wss, configfile, commands, infoCommands)
log.info("Command line started.")
begin
while cmdIn = Readline::readline("\nbbs > ".colorize(:cyan))
case cmdIn.split()[0]
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [35/10] Open
def Command.execCommand(log, wss, uglify, cmdIn)
selected = wss.getSelected()
wsList = wss.getWsList()
if cmdIn.length < 2
execCommandLoop(log, wss)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [34/10] Open
def startEM(log, host, port, secure, priv_key, cert_chain, response_limit, outLoc)
log.info("Listening on host #{host}:#{port}")
EM.run {
EM::WebSocket.run({
:host => host,
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for execCommand is too high. [32.71/15] Open
def Command.execCommand(log, wss, uglify, cmdIn)
selected = wss.getSelected()
wsList = wss.getWsList()
if cmdIn.length < 2
execCommandLoop(log, wss)
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [25/10] Open
def Command.execCommandLoop(log, wss)
puts "Commands are sent in anonymous functions wrapped in setTimeout(fn, 0) and the eval'd results are returned."
puts "Commands are also automatically wrapped in ws.send(), so omit any semicolons (;)."
puts "Enter the command to send (exit to return to the previous prompt)."
while cmdSend = Readline::readline("\ncmd ##{wss.getSelected()} > ".colorize(:magenta))
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for writeWebm is too high. [28.72/15] Open
def self.writeWebm(msg, ws, log, outLoc)
begin
encodedWebm = msg.gsub(/Webm data URL: data:(audio|video)\/webm;base64,/, "")
if encodedWebm == "" || encodedWebm == "Webm data URL: data:" then raise "Webm is empty" end
webm = Base64.strict_decode64(encodedWebm)
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Cyclomatic complexity for cmdLine is too high. [19/6] Open
def cmdLine(log, wss, configfile, commands, infoCommands)
log.info("Command line started.")
begin
while cmdIn = Readline::readline("\nbbs > ".colorize(:cyan))
case cmdIn.split()[0]
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Assignment Branch Condition size for lsCommand is too high. [28.02/15] Open
def Command.lsCommand(cmdIn)
if cmdIn.length < 2
puts Dir.glob('*').select{ |e| File.file? e }.join(' ')
puts Dir.glob('*').select{ |e| File.directory? e }.join(' ').colorize(:blue)
else
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for execCommandLoop is too high. [27.39/15] Open
def Command.execCommandLoop(log, wss)
puts "Commands are sent in anonymous functions wrapped in setTimeout(fn, 0) and the eval'd results are returned."
puts "Commands are also automatically wrapped in ws.send(), so omit any semicolons (;)."
puts "Enter the command to send (exit to return to the previous prompt)."
while cmdSend = Readline::readline("\ncmd ##{wss.getSelected()} > ".colorize(:magenta))
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for main is too high. [27.91/15] Open
def main()
begin
Bbs::Config.loadConfig()
Bbs::Config.loadLog()
configfile = Bbs::Config.getConfig()
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for sessionsCommand is too high. [25.16/15] Open
def Command.sessionsCommand(selected, wsList)
if wsList.length < 1
puts "No sessions"
return
end
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [18/10] Open
def main()
begin
Bbs::Config.loadConfig()
Bbs::Config.loadLog()
configfile = Bbs::Config.getConfig()
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [18/10] Open
def Command.modulesCommand()
puts "Modules with a star (*) afterwords are interactive modules."
puts
modules = Dir.glob("modules/*.js").select{ |e| File.file? e }
modules.each do |currModule|
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [18/10] Open
def self.writeWebm(msg, ws, log, outLoc)
begin
encodedWebm = msg.gsub(/Webm data URL: data:(audio|video)\/webm;base64,/, "")
if encodedWebm == "" || encodedWebm == "Webm data URL: data:" then raise "Webm is empty" end
webm = Base64.strict_decode64(encodedWebm)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Similar blocks of code found in 2 locations. Consider refactoring. Open
ws.send("Entire system (in kB)\n" + "\ntotalBytes: " + process.getSystemMemoryInfo().total + "\nfree: " + process.getSystemMemoryInfo().free + "\nswapTotal: " + process.getSystemMemoryInfo().swapTotal + "\nswapFree: " + process.getSystemMemoryInfo().swapFree);
- 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 86.
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
ws.send("Current process (in kB)\n" + "workingSetSize: " + process.getProcessMemoryInfo().workingSetSize + "\npeakWorkingSetSize: " + process.getProcessMemoryInfo().peakWorkingSetSize + "\nprivateBytes: " + process.getProcessMemoryInfo().privateBytes + "\nsharedBytes: " + process.getProcessMemoryInfo().sharedBytes);
- 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 86.
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
Assignment Branch Condition size for writeScreenshot is too high. [22.45/15] Open
def self.writeScreenshot(msg, ws, log, outLoc)
begin
encodedImage = msg.gsub(/Screenshot data URL: data:image\/png;base64,/, "")
if encodedImage == "" then raise "Screenshot is empty" end
image = Base64.strict_decode64(encodedImage)
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric