Showing 41 of 41 total issues
Function Modernizr
has 605 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.Modernizr = (function( window, document, undefined ) {
var version = '2.7.1',
Modernizr = {},
Function Modernizr
has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring. Open
window.Modernizr = (function( window, document, undefined ) {
var version = '2.7.1',
Modernizr = {},
- 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
Function Dropdown
has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring. Open
var Dropdown = (function(){
// the delay, in milliseconds
var DELAY = 250;
- 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
File modernizr.js
has 607 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* Modernizr v2.7.1
* www.modernizr.com
*
* Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
Function Dropdown
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Dropdown = (function(){
// the delay, in milliseconds
var DELAY = 250;
Function searchBar
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
var searchBar = (function() {
// set options for the control
var searchBar = $('.search-bar'),
searchButton = $('.search-button'),
searchButtonIcon = $('.search-button i'),
Function placeholder
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.placeholder = function() {
// Browser natively supports placeholders? Bail.
if (typeof (document.createElement('input')).placeholder != 'undefined')
return $(this);
Function panel
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.panel = function(userConfig) {
// No elements?
if (this.length == 0)
return $this;
File util.js
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
(function($) {
/**
* Generate an indented list of links from a nav. Meant for use with panel().
* @return {jQuery} jQuery object.
Function releaseLink
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
var releaseLink = (function() {
function init() {
// show '.os-win', '.os-linux', '.os-osx', '.os-other'
showClass('.os-' + RELEASE_OS_CLASS);
Function downloadCarousel
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
var downloadCarousel = (function() {
// set options for the control
var carousel = $('.download-carousel'),
stable = $('#icon-version-stable'),
stableIcon = $('#icon-version-stable i'),
Function init
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
var init = function() {
searchInput.val("");
// show/hide search bar
searchButton.click(function(e){
Similar blocks of code found in 2 locations. Consider refactoring. Open
$this.on('click', 'a[href="#' + id + '"]', function(event) {
event.preventDefault();
event.stopPropagation();
- 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 71.
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
$body.on('click', 'a[href="#' + id + '"]', function(event) {
event.preventDefault();
event.stopPropagation();
- 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 71.
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
Consider simplifying this complex logical expression. Open
if (config.hideOnSwipe) {
var result = false,
boundary = 20,
delta = 50;
Function attachInstallInstructions
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function attachInstallInstructions(selector) {
// show a modal dialog with the install instructions
$(selector).on('click', function (event) {
var $this = $(this);
var url = $('#language-current').attr('hreflang') + '/home/install-instructions';
Function clipboardButton
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
var clipboardButton = (function() {
var attach = function(elem) {
var clipInit = false;
$(elem).each(function () {
var code = $(this),
Function attach
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
var attach = function(elem) {
var clipInit = false;
$(elem).each(function () {
var code = $(this),
text = code.text();
Function webforms
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function webforms() {
/*>>input*/
// Run through HTML5's new input attributes to see if the UA understands any.
// We're using f which is the <input> element created early on
// Mike Taylr has created a comprehensive resource for testing these attributes
Function stateHandler
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
stateHandler: function() {
var config,
attachments = [],
x, id, s, s1, s2;