Showing 64 of 64 total issues
Function exports
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Function multiLineChart
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function multiLineChart(xAxis, users, contributions){
$('#chart-container').highcharts({
chart: {
type: 'line'
},
Function userTrendChart
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function userTrendChart(xAxis, commits, points, username) {
$('#users-chart-container').highcharts({
chart: {
type: 'line'
},
Function renderTokens
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function renderTokens(tokens, writer, context, template) {
var buffer = '';
// This function is used to render an artbitrary template
// in the current context by higher-order functions.
Function init
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
var $element = $(element);
var config = ko.toJS(valueAccessor());
$element.multiselect(config);
Similar blocks of code found in 2 locations. Consider refactoring. Open
$tag = $('<option/>').attr({
value: option.value,
label: option.label || option.value,
title: option.title,
selected: !!option.selected,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
$tag.append($('<option/>').attr({
value: subOption.value,
label: subOption.label || subOption.value,
title: subOption.title,
selected: !!subOption.selected,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function showPointsChart
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showPointsChart(round, all_points, user_points){
var points = uniqueValues(all_points);
var pointGroups = buildPointGroups(all_points);
var profilePic = $('#profile-pic').attr('src') + '&s=25';
var tickInterval = 1;
Function createOptionValue
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
createOptionValue: function(element) {
var $element = $(element);
if ($element.is(':selected')) {
$element.prop('selected', true);
}
Function searchTimeout
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.searchTimeout = this.asyncFunction($.proxy(function() {
if (this.query !== event.target.value) {
this.query = event.target.value;
Method add_new
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.add_new(params, user)
repo = Repository.where(gh_id: params[:gh_id]).first
if repo
repo.users << user unless repo.users.include?(user)
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
$("option:enabled", this.$select).filter(function(index) {
return $.inArray($(this).val(), values) !== -1;
}).prop('selected', true);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 64.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
$("option:enabled", this.$select).filter(function(index) {
return $.inArray($(this).val(), values) !== -1;
}).prop('selected', false);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 64.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function dataprovider
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
dataprovider: function(dataprovider) {
var groupCounter = 0;
var $select = this.$select.empty();
Function refresh
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
refresh: function() {
$('option', this.$select).each($.proxy(function(index, element) {
var $input = $('li input', this.$ul).filter(function() {
return $(this).val() === $(element).val();
});
Method perform
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(repo_owner: , repo_name: , branch_name: , **options)
from_date = options[:from_date].presence || Date.yesterday.beginning_of_day
to_date = options[:to_date].presence || Date.yesterday.end_of_day
Sidekiq.logger.info "************************ Commit Job Logger Info **************************"
Function attachClickHandler
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var attachClickHandler = function($elements) {
$elements.on('click.barrating', function(event) {
var $a = $(this),
options = getData('userOptions'),
value,
Function buildSelectAll
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildSelectAll: function() {
if (typeof this.options.selectAllValue === 'number') {
this.options.selectAllValue = this.options.selectAllValue.toString();
}
Method add_repo
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_repo(gh_repo)
repo = Repository.new(name: gh_repo.name, owner: gh_repo.owner.login)
info = gh_repo.fork ? repo.info.source : gh_repo
#check if the repository is not soft deleted and
Function select
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
select: function(selectValues, triggerOnChange) {
if(!$.isArray(selectValues)) {
selectValues = [selectValues];
}