src/api/app/controllers/webui/request_controller.rb
Class RequestController
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Webui::RequestController < Webui::WebuiController
include Webui::NotificationsHandler
include Webui::RequestsFilter
include BuildNewComment
Method changerequest
has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring. Open
Open
def changerequest
changestate = (%w[accepted commented declined revoked new] & params.keys).last
if changestate == 'commented'
- 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 prepare_request_data
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Wontfix
Wontfix
def prepare_request_data
@is_target_maintainer = @bs_request.is_target_maintainer?(User.session)
@my_open_reviews = ReviewsFinder.new(@bs_request.reviews).open_reviews_for_user(User.session).reject(&:staging_project?)
# Handling request actions
- 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
Avoid deeply nested control flow statements. Confirmed
Confirmed
target.add_maintainer(@bs_request.creator) if target.can_be_modified_by?(User.possibly_nobody)
Avoid deeply nested control flow statements. Confirmed
Confirmed
target = if tpkg
Package.find_by_project_and_name(tprj, tpkg)
else
Project.find_by_name(tprj)
end