Showing 3,294 of 3,294 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
Menu.prototype.closeSubMenu = function() {
if (this.openSubMenu) {
this.openSubMenu.close();
this.openSubMenu = null;
}
- 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 60.
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
QuickSearchField.prototype._closeDropdown = function () {
if (this._$dropdown) {
this._$dropdown.remove();
this._$dropdown = null;
}
- 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 60.
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 filterWithQueryAndMatcher
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function filterWithQueryAndMatcher(hints, matcher) {
var matchResults = $.map(hints, function (hint) {
var searchResult = matcher.match(hint.value, query);
if (searchResult) {
searchResult.value = hint.value;
Function _onActiveEditorChange
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _onActiveEditorChange(event, current, previous) {
if (previous) {
previous.off(".statusbar");
previous.document.off(".statusbar");
previous.document.releaseRef();
Function removeMenu
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function removeMenu(id) {
var menu,
commandID = "";
if (!id) {
Function formatHints
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function formatHints(hints, query) {
var hasMetadata = hints.some(function (token) {
return token.type || token.description;
});
Function _send
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _send(method, signature, varargs) {
if (!_socket) {
console.log("You must connect to the WebSocket before sending messages.");
// FUTURE: Our current implementation closes and re-opens an inspector connection whenever
Function positionPreview
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function positionPreview(editor, xpos, ypos, ybot) {
var previewWidth = $previewContainer.outerWidth(),
top = ypos - $previewContainer.outerHeight() - POINTER_HEIGHT,
left = xpos - previewWidth / 2,
elementRect = {
Function readyToServe
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
StaticServer.prototype.readyToServe = function () {
var self = this;
var deferred = new $.Deferred();
function sanitizePort(port) {
Function onClose
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
onClose: function () {
var body = window.document.getElementsByTagName("body")[0],
overlay = window.document.createElement("div"),
background = window.document.createElement("div"),
status = window.document.createElement("div");
Function handlePointMove
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handlePointMove(e, x, y) {
var self = e.target,
bezierEditor = self.bezierEditor;
// Helper function to redraw curve
Function _possibleChars
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_possibleChars: function (format) {
var chars = '';
var literal = false;
// Check whether a format character is doubled
var lookAhead = function(match) {
Function serverOptions
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var serverOptions = function () {
return new Promise(function (resolve, reject) {
var server = net.createServer(function (socket) {
console.log('PHP process connected');
socket.on('end', function () {
Function getCurrentRange
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
InlineTimingFunctionEditor.prototype.getCurrentRange = function () {
var start, end;
start = this._startBookmark.find();
if (!start) {
Function indentFold
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function indentFold(cm, start) {
var lineText = cm.getLine(start.line), tabSize = cm.getOption("tabSize");
var lineIndent = cols(lineText, null, tabSize), collapsible = false, lineCount = cm.lineCount();
var token = cm.getTokenAt(pos(start.line, lineIndent + 1));
Function _updateProcessHandler
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _updateProcessHandler(updates) {
if (!updates) {
console.warn("AutoUpdate : updates information not available.");
return;
Function BezierCurveEditor
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function BezierCurveEditor($parent, bezierCurve, callback) {
// Create the DOM structure, filling in localized strings via Mustache
this.$element = $(Mustache.render(BezierCurveEditorTemplate, Strings));
$parent.append(this.$element);
Function _attachHandlers
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_attachHandlers: function(inst) {
var stepMonths = this._get(inst, 'stepMonths');
var id = '#' + inst.id;
inst.dpDiv.find('[data-handler]').map(function () {
var handler = {
Function offsetString
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var offsetString = function(offset) {
try {
return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
offset, $.datepicker._getFormatConfig(inst));
}
Function _hideDatepicker
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_hideDatepicker: function(input) {
var inst = this._curInst;
if (!inst || (input && inst != $.data(input, PROP_NAME)))
return;
if (this._datepickerShowing) {