src/api/app/controllers/build_controller.rb
Method project_index
has a Cognitive Complexity of 44 (exceeds 8 allowed). Consider refactoring. Open
Open
def project_index
prj = nil
prj = Project.get_by_name(params[:project]) unless params[:project] == '_dispatchprios'
if request.get?
- 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 project_index
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def project_index
prj = nil
prj = Project.get_by_name(params[:project]) unless params[:project] == '_dispatchprios'
if request.get?
Avoid deeply nested control flow statements. Confirmed
Confirmed
unless allowed
render_error status: 403, errorcode: 'execute_cmd_no_permission',
message: "No permission to execute command on package #{pack_name}"
return
end
Avoid deeply nested control flow statements. Confirmed
Confirmed
unless allowed
render_error status: 403, errorcode: 'execute_cmd_no_permission',
message: "No permission to execute command on package #{pack_name} in project #{prj.name}"
return
end
Method buildinfo
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
Open
def buildinfo
required_parameters :project, :repository, :arch, :package
# just for permission checking
if request.post? && Package.striping_multibuild_suffix(params[:package]) == '_repository'
# for osc local package build in this repository
- 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"