src/api/app/models/bs_request_action_submit.rb
Method execute_accept
has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring. Open
Open
def execute_accept(opts)
# create package unless it exists already
target_project = Project.get_by_name(self.target_project)
# FIXME: when this code is moved to conditional assigment, it causes ambiguity between target_package and self.target_package.
- 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 execute_accept
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def execute_accept(opts)
# create package unless it exists already
target_project = Project.get_by_name(self.target_project)
# FIXME: when this code is moved to conditional assigment, it causes ambiguity between target_package and self.target_package.
Method forward
has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring. Open
Open
def forward
forward_object = nil
target_package_object = Package.find_by_project_and_name(target_project, target_package)
if target_package_object
- 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 forward
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def forward
forward_object = nil
target_package_object = Package.find_by_project_and_name(target_project, target_package)
if target_package_object
Avoid deeply nested control flow statements. Open
Open
if forward[:project] == lprj && forward[:package] == lpkg
link_is_already_devel = true
break
end