Showing 90 of 90 total issues
Method to_s_raw
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_s_raw
# Assume one date only, equal start/end
start_format_list = [nil, :wday, :month, :day, :year, :at, :hour, :min, :suffix, nil]
start_details = time_details(@start_time)
Function bind_proposal_generic_control
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bind_proposal_generic_control(kind, elements) {
if (! elements) {
elements = $('.proposal_'+kind+'_control');
}
elements.removeAttr('disabled').change(function(event) {
Method time_details
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def time_details(t)
# Get the parts for formatting this time, as a hash of
# strings: keys (roughly) match the equivalent methods on DateTime, but only
# relevant keys will be filled in. If relative is true (the default):
# - if it's today, tomorrow, or yesterday, :wday will be eg "today"
- 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 user_favorites_contention_report
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def user_favorites_contention_report
# Prepare
event = OpenConferenceWare::Event.current
proposals = event.proposals.accepted
- 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 update
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
# @proposal and @event set via #assign_proposal_and_event filter
# If proposal title editing is locked, prevent non-admin from modifying title.
if params[:proposal] && @event.proposal_titles_locked? && ! admin?
Method index
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def index
warn_about_incomplete_event
@kind = :proposals
- 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 user_favorites_contention_report
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def user_favorites_contention_report
# Prepare
event = OpenConferenceWare::Event.current
proposals = event.proposals.accepted
Similar blocks of code found in 2 locations. Consider refactoring. Open
def update
respond_to do |format|
if @schedule_item.update_attributes(schedule_item_params)
flash[:notice] = 'ScheduleItem was successfully updated.'
format.html { redirect_to(@schedule_item) }
- 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 57.
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
def update
respond_to do |format|
if @session_type.update_attributes(session_type_params)
flash[:notice] = 'Session type was successfully updated.'
format.html { redirect_to(@session_type) }
- 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 57.
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 related_proposals
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def related_proposals(some_proposals)
[].tap do |related|
parent = self.parent_or_self
for proposal in some_proposals
catch :found do
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
unless @event
flash[:failure] = "Can't display selector votes without an event!"
return redirect_back_or_to(root_path)
end
Method get_current_event_and_assignment_status
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_current_event_and_assignment_status
invalid = false
# Try finding event using params:
event_id_key = controller_name == "events" ? :id : :event_id
Similar blocks of code found in 2 locations. Consider refactoring. Open
def create
@track = @event.tracks.new(track_params)
respond_to do |format|
if @track.save
- 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 52.
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
def create
@room = @event.rooms.new(room_params)
respond_to do |format|
if @room.save
- 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 52.
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 to_icalendar
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.to_icalendar(items, opts={})
title = opts[:title] || "Schedule"
url_helper = opts[:url_helper]
calendar = Vpim::Icalendar.create2(Vpim::PRODID)
Method can_edit?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def can_edit?(record)
raise ArgumentError, "No record specified" unless record
if logged_in?
if current_user.admin?
- 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_fixtures
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.load_from_fixtures(overwrite = false)
[].tap do |records|
data = YAML::load(ERB.new(File.read(OpenConferenceWare::Engine.root.join("spec", "fixtures", "open_conference_ware_snippets.yml"))).result(binding))
for attributes in data.values
record = self.find_by_slug(attributes["slug"].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 base_show
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def base_show
if selector? && @event.accept_selector_votes?
@selector_vote = @proposal.selector_votes.find_or_initialize_by(user_id: current_user.id)
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 subnav_kind
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def subnav_kind
if @event
if @event.proposal_status_published?
proposal_related_action? ? :proposals : :sessions
else
- 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 activate_menu_item
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function activate_menu_item () {
var should_log = false;
var debug = function (message) {
if(should_log && (typeof console == "object")) console.log('activate_menu_item: ' + message);