Showing 423 of 423 total issues
Function regChange
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function regChange(cm, from, to, lendiff) {
if (from == null) { from = cm.doc.first }
if (to == null) { to = cm.doc.first + cm.doc.size }
if (!lendiff) { lendiff = 0 }
File mixin.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Vue from "vue";
const { startOfDay, startOfHour, startOfWeek, endOfMonth, endOfHour, startOfToday, startOfTomorrow, startOfYesterday, endOfYesterday, endOfTomorrow, endOfToday, endOfDay, startOfMonth, lastDayOfMonth, subSeconds, getUnixTime, fromUnixTime, differenceInSeconds, formatDistance, addMonths, addSeconds, isWithinInterval } = require('date-fns')
import formatDistanceToNow from 'date-fns/formatDistanceToNow'
import format from 'date-fns/format'
import parseISO from 'date-fns/parseISO'
Function HttpRequest
has 80 lines of code (exceeds 50 allowed). Consider refactoring. Open
func HttpRequest(endpoint, method string, contentType interface{}, headers []string, body io.Reader, timeout time.Duration, verifySSL bool, customTLS *tls.Config) ([]byte, *http.Response, error) {
var err error
var req *http.Request
if method == "" {
method = "GET"
Function makeChangeFromHistory
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeChangeFromHistory(doc, type, allowSelectionOnly) {
var suppress = doc.cm && doc.cm.state.suppressEdits
if (suppress && !allowSelectionOnly) { return }
var hist = doc.history, event, selAfter = doc.sel
Function CheckHttp
has 78 lines of code (exceeds 50 allowed). Consider refactoring. Open
func CheckHttp(s *Service, record bool) (*Service, error) {
defer s.updateLastCheck()
timer := prometheus.NewTimer(metrics.ServiceTimer(s.Name))
defer timer.ObserveDuration()
Function markText
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function markText(doc, from, to, options, type) {
// Shared markers (across linked documents) are handled separately
// (markTextShared will call out to this again, once per
// document).
if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (sizes.right && sizes.bottom) {
d.scrollbarFiller.style.display = "block"
d.scrollbarFiller.style.height = sizes.bottom + "px"
d.scrollbarFiller.style.width = sizes.right + "px"
} else { d.scrollbarFiller.style.display = "" }
- 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 77.
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
if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
d.gutterFiller.style.display = "block"
d.gutterFiller.style.height = sizes.bottom + "px"
d.gutterFiller.style.width = measure.gutterWidth + "px"
} else { d.gutterFiller.style.display = "" }
- 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 77.
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 onDrop
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onDrop(e) {
var cm = this
clearDragCursor(cm)
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
{ return }
Function findPosH
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function findPosH(doc, pos, dir, unit, visually) {
var oldPos = pos
var origDir = dir
var lineObj = getLine(doc, pos.line)
function findNextLine() {
Function CodeMirror
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function CodeMirror(place, options) {
var this$1 = this;
if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }
Function tokenBase
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function tokenBase(stream, state) {
var ch = stream.next();
if (tokenHooks[ch]) {
var result = tokenHooks[ch](stream, state);
if (result !== false) return result;
Function moveVisually
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function moveVisually(cm, line, start, dir) {
var bidi = getOrder(line, cm.doc.direction)
if (!bidi) { return moveLogically(line, start, dir) }
if (start.ch >= line.text.length) {
start.ch = line.text.length
Function onScrollWheel
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onScrollWheel(cm, e) {
var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y
var display = cm.display, scroll = display.scroller
// Quit if there's nothing to scroll here
Function tokenBase
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function tokenBase(stream, state) {
var ch = stream.next();
if (tokenHooks[ch]) {
var result = tokenHooks[ch](stream, state);
if (result !== false) return result;
Function Display
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Display(place, doc, input) {
var d = this
this.input = input
// Covers bottom-right square when both scrollbars are present.
Consider simplifying this complex logical expression. Open
} else if (stream.match(".Id") || stream.match(".Domain") || stream.match(".CreatedAt") ||
stream.match(".Name") || stream.match(".Downtime.Human") || stream.match(".Issue") || stream.match(".LastStatusCode") ||
stream.match(".Port") || stream.match(".FailuresLast24Hours") || stream.match(".PingTime")) {
return "var-sub-highlight"
} else if (stream.match("{{") || stream.match("}}")) {
Function Samples
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func Samples() error {
log.Infoln("Inserting Sample Incidents...")
incident1 := &Incident{
Title: "Github Issues",
Description: "There are new features for Statping, if you have any issues please visit the Github Repo.",
Function updateDisplayIfNeeded
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateDisplayIfNeeded(cm, update) {
var display = cm.display, doc = cm.doc
if (update.editorIsHidden) {
resetView(cm)
Function locateNodeInLineView
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function locateNodeInLineView(lineView, node, offset) {
var wrapper = lineView.text.firstChild, bad = false
if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
if (node == wrapper) {
bad = true