Method create
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def create
@project = Project.find_by(id: query_dataset_params[:project_id])
if @project.nil?
redirect_to projects_path
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
Method list_query_datasets
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def list_query_datasets
if params[:project_id]
@project = Project.find(params[:project_id])
qd = params[:all] ? @project.query_datasets.all :
QueryDataset.by_user_and_project(current_user, @project)
- 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 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@project = Project.find_by(id: query_dataset_params[:project_id])
if @project.nil?
redirect_to projects_path
else
Method result
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def result
qd = @query_dataset
m = qd.miga
res = m.result(params[:result])
if res.nil?
- 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 list_query_datasets
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_query_datasets
if params[:project_id]
@project = Project.find(params[:project_id])
qd = params[:all] ? @project.query_datasets.all :
QueryDataset.by_user_and_project(current_user, @project)
Method result
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def result
qd = @query_dataset
m = qd.miga
res = m.result(params[:result])
if res.nil?
Avoid deeply nested control flow statements. Open
if saved_cnt == 1
redirect_to @query_dataset
else
redirect_to project_query_datasets_url(@project)
end