Showing 17 of 66 total issues
Function d3_sunburst_chart
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.d3_sunburst_chart = function(selector, data_file = "/d3js/flare.json") {
var target = d3.select(selector);
var width = target[0][0].parentNode.clientWidth - 40 ;
var height = width + 40;
var radius = (Math.min(width, height) - 50) / 2;
Function d3_multi_line_chart
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.d3_multi_line_chart = function(selector, data_file = "/d3js/line_graph_multi.tsv"){
var target = d3.select(selector);
var parentWidth = target[0][0].parentNode.clientWidth;
var margin = {top: 20, right: 120, bottom: 50, left: 50};
Function d3_calendar_chart
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.d3_calendar_chart = function(selector, data_file = "/d3js/dji.csv"){
var target = d3.select(selector);
var parentWidth = target[0][0].parentNode.clientWidth;
var width = parentWidth;
Function d3_stacked_area_chart
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.d3_stacked_area_chart = function(selector, data_file){
var target = d3.select(selector);
var parentWidth = target[0][0].parentNode.clientWidth;
var margin = {top: 20, right: 20, bottom: 30, left: 50};
File register_report.rb
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
module RegisterReport
extend ActiveSupport::Concern
def get_metrics
Dir.chdir Rails.root
Function d3_bar_chart
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.d3_bar_chart = function(selector, data_file = "/d3js/bar_graph.tsv"){
var target = d3.select(selector);
var parentWidth = target[0][0].parentNode.clientWidth;
var margin = {top: 20, right: 20, bottom: 30, left: 40};
Function d3_line_chart
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.d3_line_chart = function(selector = "#line-graph", data_file = "/d3js/line_graph.tsv"){
var target = d3.select(selector);
var parentWidth = target[0][0].parentNode.clientWidth;
var margin = {top: 20, right: 80, bottom: 30, left: 50};
Method register_flogs
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def register_flogs
report = MetricFuReport::FlogParser.new report_directory
score_category = ScoreCategory.find_or_create_by name: "COMPLEXITY"
score_source = ScoreSource.find_or_create_by name: "FLOG"
- 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 register_reeks
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def register_reeks
report = MetricFuReport::ReekParser.new report_directory
smell_category = SmellCategory.find_or_create_by name: "SMELL"
smell_source = SmellSource.find_or_create_by name: "REEK"
Function d3_pie_chart
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.d3_pie_chart = function(selector, data_file = "/d3js/pie.csv"){
var target = d3.select(selector);
var parentWidth = target[0][0].parentNode.clientWidth;
var width = parentWidth;
Method register_flogs
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def register_flogs
report = MetricFuReport::FlogParser.new report_directory
score_category = ScoreCategory.find_or_create_by name: "COMPLEXITY"
score_source = ScoreSource.find_or_create_by name: "FLOG"
Function d3_donut_chart
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.d3_donut_chart = function(selector, data_file = "/d3js/donut.csv"){
var target = d3.select(selector);
var parentWidth = target[0][0].parentNode.clientWidth;
var width = parentWidth - 20;
Function d3_icecle_chart
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.d3_icecle_chart = function(selector, data_file = "/d3js/flare.json"){
var target = d3.select(selector);
var width = target[0][0].parentNode.clientWidth - 40 ;
var height = width /2;
var color = d3.scale.category20c();
Method register_saikuro
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def register_saikuro
report = MetricFuReport::SaikuroParser.new report_directory
score_category = ScoreCategory.find_or_create_by name: "COMPLEXITY"
score_category_loc = ScoreCategory.find_or_create_by name: "LOC"
score_source = ScoreSource.find_or_create_by name: "SAIKURO"
Method recursive_search_ast
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def recursive_search_ast(ast, name)
ast.children.each do |child|
if child.class.to_s == "Parser::AST::Node"
if (child.type.to_s == "def" or child.type.to_s == "defs") and (child.children[0].to_s == name or child.children[1].to_s == name)
@method = child.source_map.expression.to_source
- 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 register_class_score
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def register_class_score(category, source)
category = ScoreCategory.find_by(name: category) if category.instance_of?(String)
source = ScoreSource.find_by(name: source) if source.instance_of?(String)
target_classes.includes(:target_methods).each do |klass|
- 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 register_reeks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def register_reeks
report = MetricFuReport::ReekParser.new report_directory
smell_category = SmellCategory.find_or_create_by name: "SMELL"
smell_source = SmellSource.find_or_create_by name: "REEK"
- 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"