Showing 303 of 303 total issues
Function select
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
select = Sizzle.select = function(selector, context, results, seed) {
var i, tokens, token, type, find,
compiled = typeof selector === "function" && selector,
match = !seed && tokenize((selector = compiled.selector || selector));
Function data
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
data: function(key, value) {
var i, name, data,
elem = this[0],
attrs = elem && elem.attributes;
Function leverageNative
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function leverageNative(el, type, expectSync) {
// Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
if (!expectSync) {
if (dataPriv.get(el, type) === undefined) {
Function cancelUpload
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
value: function cancelUpload(file) {
if (file.status === Dropzone.UPLOADING) {
var groupedFiles = this._getFilesWithXhr(file.xhr);
for (var _iterator20 = groupedFiles, _isArray20 = true, _i21 = 0, _iterator20 = _isArray20 ? _iterator20 : _iterator20[Symbol.iterator]();;) {
var _ref19;
Function extend
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
Function setupHiddenFileInput
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
var setupHiddenFileInput = function setupHiddenFileInput() {
if (_this3.hiddenFileInput) {
_this3.hiddenFileInput.parentNode.removeChild(_this3.hiddenFileInput);
}
_this3.hiddenFileInput = document.createElement("input");
Function resize
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
resize: function resize(file, width, height, resizeMethod) {
var info = {
srcX: 0,
srcY: 0,
srcWidth: file.width,
Function access
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
var access = function(elems, fn, key, value, chainable, emptyGet, raw) {
var i = 0,
len = elems.length,
bulk = key == null;
Function stop
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
stop: function(type, clearQueue, gotoEnd) {
var stopQueue = function(hooks) {
var stop = hooks.stop;
delete hooks.stop;
stop(gotoEnd);
Method main
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
Method createAd
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
@PostMapping("/createAd")
public String createAd(@RequestParam(name = "payment_method", required = true) String payment_method,
@RequestParam(name = "ad_time", required = true) String time_choosed,
@RequestParam(name = "starting_time", required = true) Date starting_time,
@RequestParam(name = "file", required = true) MultipartFile file, HttpSession session, Model model)
Function adjustCSS
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function adjustCSS(elem, prop, valueParts, tween) {
var adjusted, scale,
maxIterations = 20,
currentValue = tween ?
function() {
Function style
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
style: function(elem, name, value, extra) {
// Don't set styles on text and comment nodes
if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
return;
Function toggleClass
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
toggleClass: function(value, stateVal) {
var type = typeof value,
isValidValue = type === "string" || Array.isArray(value);
if (typeof stateVal === "boolean" && isValidValue) {
Function on
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function on(elem, types, selector, data, fn, one) {
var origFn, type;
// Types can be a map of types/handlers
if (typeof types === "object") {
Method addMember
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
@PostMapping(value = "/group/addMember/{username}/{idGroup}", consumes = MediaType.ALL_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<TrawellGroup> addMember(@PathVariable(required = true, name = "username") String username,
@PathVariable(required = true, name = "idGroup") Long idGroup, HttpSession session) {
User user = (User) session.getAttribute("user");
TrawellGroup updatedGroup = null;
- 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 dispatch
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
dispatch: function(nativeEvent) {
// Make a writable jQuery.Event from the native event object
var event = jQuery.event.fix(nativeEvent);
Function _addFilesFromDirectory
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
value: function _addFilesFromDirectory(directory, path) {
var _this6 = this;
var dirReader = directory.createReader();
Function getElements
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Dropzone.getElements = function (els, name) {
var el = void 0,
elements = void 0;
if (els instanceof Array) {
elements = [];
Similar blocks of code found in 2 locations. Consider refactoring. Open
return "{" + " id='" + getId() + "'" + ", mail='" + getMail() + "'" + ", username='" + getUsername() + "'"
+ ", password='" + getPassword() + "'" + ", name='" + getName() + "'" + ", surname='" + getSurname()
+ "'" + ", birth='" + getBirth() + "'" + ", bio='" + getBio() + "'" + ", profilePhoto='"
- 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 102.
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