Showing 1,642 of 1,642 total issues
Function requestAnimationFrame
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
requestAnimationFrame: (function() {
// Check for request animation Frame support
var requestFrame = global.requestAnimationFrame || global.webkitRequestAnimationFrame || global.mozRequestAnimationFrame || global.oRequestAnimationFrame;
var isNative = !!requestFrame;
Function compile
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
compile: function(tElement) {
tElement.addClass(isHeader ? 'bar bar-header' : 'bar bar-footer');
// top style tabs? if so, remove bottom border for seamless display
$timeout(function() {
if (isHeader && $document[0].getElementsByClassName('tabs-top').length) tElement.addClass('has-tabs-top');
Function prepareFromToAnchorAnimation
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function prepareFromToAnchorAnimation(from, to, classes, anchors) {
var fromAnimation = prepareRegularAnimation(from);
var toAnimation = prepareRegularAnimation(to);
var anchorAnimations = [];
Function ios
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
provider.transitions.navBar.ios = function(enteringHeaderBar, leavingHeaderBar, direction, shouldAnimate) {
function setStyles(ctrl, opacity, titleX, backTextX) {
var css = {};
css[ionic.CSS.TRANSITION_DURATION] = d.shouldAnimate ? '' : '0ms';
Function ArrayType
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ArrayType(type, mode) {
function bindTo(type, callbackName) {
return function() {
return type[callbackName].apply(type, arguments);
};
Function format
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
UrlMatcher.prototype.format = function (values) {
values = values || {};
var segments = this.segments, params = this.parameters(), paramset = this.params;
if (!this.validates(values)) return null;
Function scrollTo
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
scrollTo: function(left, top, animate, zoom, wasResize) {
var self = this;
// Stop deceleration
if (self.__isDecelerating) {
Function _startDrag
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
_startDrag: function(e) {
var self = this;
self._isDragging = false;
Function select
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
self.select = function(tab, shouldEmitEvent) {
var tabIndex;
if (isNumber(tab)) {
tabIndex = tab;
if (tabIndex >= self.tabs.length) return;
Function updateSlidesVisibility
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateSlidesVisibility() {
// Select all slides and convert the NodeList result to
// an array
var horizontalSlides = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ),
Function load
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function load() {
var scripts = [],
scriptsAsync = [],
scriptsToPreload = 0;
Function scrollTo
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
scrollTo: function(left, top, animate) {
var self = this;
if (!animate) {
self.el.scrollTop = top;
self.el.scrollLeft = left;
Function activateOverview
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function activateOverview() {
// Only proceed if enabled in config
if( config.overview ) {
Function hiliteWords
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.hiliteWords = function(node)
{
if(node == undefined || !node) return;
if(!matchRegex) return;
if(skipTags.test(node.nodeName)) return;
Function __cleanup
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
__cleanup: function() {
var self = this;
var container = self.__container;
container.removeEventListener('touchstart', self.touchStart);
Similar blocks of code found in 2 locations. Consider refactoring. Open
app.get('/', function( req, res ) {
res.writeHead( 200, { 'Content-Type': 'text/html' } );
fs.createReadStream( opts.baseDir + '/index.html' ).pipe( res );
- 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
app.get("/", function(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
fs.createReadStream(opts.baseDir + '/index.html').pipe(res);
});
- 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 colorToRgb
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function colorToRgb( color ) {
var hex3 = color.match( /^#([0-9a-f]{3})$/i );
if( hex3 && hex3[1] ) {
hex3 = hex3[1];
Function $$rAFSchedulerFactory
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
var $$rAFSchedulerFactory = ['$$rAF', function($$rAF) {
var tickQueue = [];
var cancelFn;
function scheduler(tasks) {
Function scrollChildIntoView
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
self.scrollChildIntoView = function(e) {
//console.log("scrollChildIntoView at: " + Date.now());
// D
var scrollBottomOffsetToTop = container.getBoundingClientRect().bottom;