Showing 118 of 280 total issues
Function slide
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Carousel.prototype.slide = function (type, next) {
var $active = this.$element.find('.item.active')
var $next = next || this.getItemForDirection(type, $active)
var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right'
Method update
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def update
@post.update_attributes post_params
@post.bind_tags(params[:post][:tags])
@post.attachment_ids = params[:post][:attachment_ids]
element_ids = params[:post][:text_elements].values.map{|e| e[:id]}.compact
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
Open
render: function(){
var style = {
background: 'url(' + this.props.comment.author.avatar + ') no-repeat',
backgroundSize: 'cover'
};
- 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 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
var elements = this.props.text_elements;
var length = elements.length;
rendered_elements = elements.map(function (e, position) {
switch (e.type) {
Function update
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var update = function(e, options) {
var value, keyCode, printable, placeholder, width;
var shift, character, selection;
e = e || window.event || {};
options = options || {};
Function addItem
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addItem: function(value, silent) {
var events = silent ? [] : ['change'];
debounce_events(this, events, function() {
var $item, $option, $options;
Function render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
var tags = this.props.post.tags.map(function(name, i){
return <a key={i} href={'/explore?tag_name=' + name}>{'#'+name}</a>
});
if (window.currentUser && window.currentUser.admin)
Function backdrop
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Modal.prototype.backdrop = function (callback) {
var that = this
var animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
Function show
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Modal.prototype.show = function (_relatedTarget) {
var that = this
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
Function activate
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
Function updateOption
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
updateOption: function(value, data) {
var self = this;
var $item, $item_new;
var value_new, index_item, cache_items, cache_options, order_old;
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
var className;
if (this.props.className) {
className = this.props.className;
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function () {
var comments = this.props.comments;
if (!this.state.show_all){
comments = comments.slice(-3);
}
Function onChangeLink
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onChangeLink: function(event) {
url = event.target.value;
console.log(url);
if (this.state.timeout_id)
clearTimeout(this.state.timeout_id);
Function createItem
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
createItem: function(input, triggerDropdown) {
var self = this;
var caret = self.caretPos;
input = input || $.trim(self.$control_input.val() || '');
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
return (
<ReactBootstrap.Modal
onHide={this.hide}
backdrop='static'
Method update
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def update
@post.update_attributes post_params
@post.bind_tags(params[:post][:tags])
@post.attachment_ids = params[:post][:attachment_ids]
element_ids = params[:post][:text_elements].values.map{|e| e[:id]}.compact
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function () {
var self = this;
var childElements = this.state.posts.map(function(post, i){
return (
<ExplorePost
Function show
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Collapse.prototype.show = function () {
if (this.transitioning || this.$element.hasClass('in')) return
var activesData
var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
Function componentDidMount
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
componentDidMount() {
$(this.refs.input).selectize({
splitOn: /#/,
delimiters_array: [',', "#"],
persist: false,