Showing 2,194 of 2,194 total issues
File main.js
has 399 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* HYDE - markdown editor
* Copyright (c) 2017 Brett Stevenson <bstevensondev@gmail.com
*
* This program is free software: you can redistribute it and/or modify
File settings.js
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
const config = require('./js/config');
var menu = $('#appMenu'),
toolbar = $('#toolbar'),
leftFade = $('#leftFade'),
dragArea = $('#draggable'),
File bootstrap-notify.js
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Project: Bootstrap Notify = v3.1.5
* Description: Turns standard Bootstrap alerts into "Growl-like" notifications.
* Author: Mouse0270 aka Robert McIntosh
* License: MIT License
File app.js
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
const electron = require('electron');
const remote = electron.remote;
const dialog = electron.remote.dialog;
const shell = electron.shell;
File format.js
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
function toggleFormat(type) {
'use strict';
let modifiers;
if(type === 'strong')
Function parseExpression
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function parseExpression(raw, delimit, delimitEscaped, mathMode, finalPass) {
finalPass = finalPass || false;
var lines = raw.split('\n');
var output = '';
- 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 getState
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function getState(cm, pos) {
pos = pos || cm.getCursor('start');
var stat = cm.getTokenAt(pos);
if(!stat.type) return {};
var types = stat.type.split(' ');
- 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 _toggleHeading
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function _toggleHeading(direction) {
var startPoint = cm.getCursor('start'),
endPoint = cm.getCursor('end');
for(var i = startPoint.line; i <= endPoint.line; i++) {
var text = cm.getLine(i);
- 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 init
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function () {
var self = this;
this.buildNotify();
if(this.settings.content.icon) {
Function placement
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
placement: function () {
var self = this,
offsetAmt = this.settings.offset.y,
css = {
display: 'inline-block',
Similar blocks of code found in 2 locations. Consider refactoring. Open
if(luminosity >= 0.6) {
menuButton.css('color', 'rgba(50, 50, 50, 0.1)');
menuButton.mouseover(function() {
$(this).css('color', 'rgba(50, 50, 50, 0.3)');
}).mouseout(function() {
- 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 108.
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
} else {
menuButton.css('color', 'rgba(255, 255, 255, 0.07)');
menuButton.mouseover(function() {
$(this).css('color', 'rgba(255, 255, 255, 0.35)');
}).mouseout(function() {
- 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 108.
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 onload
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.onload = () => {
let themeColor = $('.cm-s-'+theme).css('background-color');
adaptTheme(themeColor, Color(themeColor).luminosity());
createModals();
fillEmojiModal();
Function formatHead
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
var formatHead = () => {
var textPanel = $('#textPanel'),
menuToggle = $('#menuToggle');
if(process.platfrom === 'darwin') {
preview.css('paddingTop', '25px');
- 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 update
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
update: function (command, update) {
var commands = {};
if(typeof command === 'string') {
commands[command] = update;
} else {
Function toggleState
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function toggleState(type, modifiers) {
if(modifiers.length === 0) return;
let startPoint = cm.getCursor('start');
let endPoint = cm.getCursor('end');
// get word at cursor if there's no selection
Function parseExpression
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseExpression(raw, delimit, delimitEscaped, mathMode, finalPass) {
finalPass = finalPass || false;
var lines = raw.split('\n');
var output = '';
Function getState
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getState(cm, pos) {
pos = pos || cm.getCursor('start');
var stat = cm.getTokenAt(pos);
if(!stat.type) return {};
var types = stat.type.split(' ');
Function formatHead
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
var formatHead = () => {
var textPanel = $('#textPanel'),
menuToggle = $('#menuToggle');
if(process.platfrom === 'darwin') {
preview.css('paddingTop', '25px');
Function createNotification
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createNotification(text, type) {
var head, icon;
if(type === 'success') {
head = '<strong>Success </strong>';
icon = 'fa fa-check-circle';