Showing 12 of 18 total issues
Method load_from_file
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def load_from_file(input_stream)
valid_lines = []
input_stream.readlines.each do |line|
line.strip!
- 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 load_from_file
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_from_file(input_stream)
valid_lines = []
input_stream.readlines.each do |line|
line.strip!
Method upload_submit
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def upload_submit
authorize! :upload, @sourcemod_plugin
if params[:sourcemod_plugin].nil? || params[:sourcemod_plugin][:file].nil?
flash[:error] = "Sorry, there was a problem with your upload."
- 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 index
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def index
@sourcemod_plugin = SourcemodPlugin.new
@sourcemod_plugin.name = params[:name] || ''
- 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 download
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def download
authorize! :download, @sourcemod_plugin
filename = params[:filename]
filename ||= "#{@sourcemod_plugin.filename}.translations.zip"
Method download
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def download
authorize! :download, @sourcemod_plugin
filename = params[:filename]
filename ||= "#{@sourcemod_plugin.filename}.translations.zip"
- 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 index
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
@sourcemod_plugin = SourcemodPlugin.new
@sourcemod_plugin.name = params[:name] || ''
Method generate_format_info
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def generate_format_info(list)
return if self.format.nil?
formats = self.format.split ','
- 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 upload_submit
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upload_submit
authorize! :upload, @sourcemod_plugin
if params[:sourcemod_plugin].nil? || params[:sourcemod_plugin][:file].nil?
flash[:error] = "Sorry, there was a problem with your upload."
Method random
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def random
if current_user.nil?
flash[:error] = "You must be logged in!"
redirect_to sourcemod_plugins_path and return
end
Method random
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def random
if current_user.nil?
flash[:error] = "You must be logged in!"
redirect_to sourcemod_plugins_path and return
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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
@translation = current_user.translations.new(translation_params)
@phrase = @translation.phrase
finished_lang_ids = @phrase.languages.collect{|o|o.id}
- 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"