Showing 118 of 280 total issues
Function onDrop
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
onDrop: function(e) {
e.preventDefault();
this.setState({
isDragActive: false,
- 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 onDrop
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
onDrop: function(e) {
e.preventDefault();
this.setState({
isDragActive: false,
- 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 onBlur
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
onBlur: function(e, dest) {
var self = this;
if (!self.isFocused) return;
self.isFocused = false;
Function highlight
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var highlight = function($element, pattern) {
if (typeof pattern === 'string' && !pattern.length) return;
var regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern;
var highlight = function(node) {
Function validate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
validate: function(postData){
if (postData.type == PostTypes.quotation && !postData.title.trim() )
return false;
if (postData.type == PostTypes.photo && !postData.photos.length )
return false;
Function refresh
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ScrollSpy.prototype.refresh = function () {
var that = this
var offsetMethod = 'offset'
var offsetBase = 0
Function next
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
Function search
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Sifter.prototype.search = function(query, options) {
var self = this, value, score, search, calculateScore;
var fn_sort;
var fn_score;
Function likePost
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
likePost: function(id) {
var posts = this.state.posts;
var likedPost = $.grep(posts, function(e){ return e.id == id; });
likedPost = likedPost[0];
CI('PostBox::likePost', id);
Function onDrop
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
onDrop: function(e) {
e.preventDefault();
this.setState({
isDragActive: false,
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
return (
<div className='new-post-buttons card-sp'>
<div className='new-post-wrap'>
<div className='new-post-label' onClick={this.onClickPhoto}>
Function hide
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Collapse.prototype.hide = function () {
if (this.transitioning || !this.$element.hasClass('in')) return
var startEvent = $.Event('hide.bs.collapse')
this.$element.trigger(startEvent)
Function onEndTransitionFn
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var onEndTransitionFn = function( ev ) {
if( support.transitions ) {
if( ev.propertyName.indexOf( 'transform' ) === -1 ) return false;
this.removeEventListener( transEndEventName, onEndTransitionFn );
}
Function onDrop
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
onDrop: function(e) {
e.preventDefault();
this.setState({
isDragActive: false,
Function render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render(){
if (!this.props.post) return null;
console.log(this.props.post)
var post = this.props.post;
var author = post.author;
- 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
Avoid deeply nested control flow statements. Open
for (var i = 0; i < target.length; ++i) {
temp[i] = target[i];
}
Method crop
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def crop(x, y, w, h, all_h, all_w)
Consider simplifying this complex logical expression. Open
if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 2)) {
throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3')
}
Function render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render: function() {
var className;
if (this.props.className) {
className = this.props.className;
- 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 render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render: function(){
photos = this.props.photos;
photos = photos.map(function (p, index) {
return (
<div key={index} className="usual-post-photo action-create-element-post">
- 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"