Showing 216 of 688 total issues
Function exports
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
- Create a ticketCreate a ticket
Class UsersController
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class UsersController < ApplicationController
before_action :require_no_user, only: [:new]
before_action :require_user, only: %i(edit update save_settings settings)
before_action :set_user, only: %i(info followed following followers)
- Create a ticketCreate a ticket
Method handle_site_login_flow
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_site_login_flow
username = params[:user_session][:username] if params[:user_session]
u = User.find_by(username: username) || User.find_by(email: username)
if u && u.password_checker != 0
n = u.password_checker
- Create a ticketCreate a ticket
Method show_for_author
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def show_for_author
# try for a matching /wiki/_TAGNAME_ or /_TAGNAME_
@wiki = Node.where(path: "/wiki/#{params[:id]}").try(:first) || Node.where(path: "/#{params[:id]}").try(:first)
@wiki = Node.find(@wiki.power_tag('redirect')) if @wiki&.has_power_tag('redirect')
- Read upRead up
- Create a ticketCreate a ticket
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
Method handle_social_login_flow
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_social_login_flow(auth)
# Find an identity here
@identity = UserTag.find_with_omniauth(auth)
return_to = request.env['omniauth.origin'] || root_url
return_to += '?_=' + Time.now.to_i.to_s
- Create a ticketCreate a ticket
Class WikiController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class WikiController < ApplicationController
before_action :require_user, only: %i(new create edit update delete replace)
def subdomain
url = "//#{request.host}/wiki/"
- Create a ticketCreate a ticket
Class AdminController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class AdminController < ApplicationController
before_action :require_user, only: %i(spam spam_revisions mark_comment_spam publish_comment spam_comments)
# intended to provide integration tests for assets
def assets; end
- Create a ticketCreate a ticket
Class TagController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class TagController < ApplicationController
respond_to :html, :xml, :json, :ics
before_action :require_user, only: %i(create delete)
include Pagy::Backend
- Create a ticketCreate a ticket
Method new_note
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def self.new_note(params)
saved = false
author = User.find(params[:uid])
node = Node.new(uid: author.uid,
title: params[:title],
- Read upRead up
- Create a ticketCreate a ticket
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 CommentsList
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
const CommentsList = ({
commentFormsVisibility,
comments,
currentUser,
dispatch,
- Read upRead up
- Create a ticketCreate a ticket
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 generateCommentComponents
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
const generateCommentComponents = (commentsArray) => {
return commentsArray.map((comment) => {
// these props are common to all forms
const commentFormProps = {
commentId: comment.commentId,
- Create a ticketCreate a ticket
Function reducer
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
const reducer = (state, action) => {
switch(action.type) {
// COMMENT actions
case "CREATE COMMENT":
return {
- Create a ticketCreate a ticket
Method delete
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def delete
@comment = Comment.find params[:id]
comments_node_and_path
- Read upRead up
- Create a ticketCreate a ticket
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
Method create
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def create
if current_user.status == 1
# we no longer allow custom urls, just titles which are parameterized automatically into urls
# slug = params[:title].parameterize
# slug = params[:id].parameterize if params[:id] != "" && !params[:id].nil?
- Read upRead up
- Create a ticketCreate a ticket
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
Method add_tag
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_tag(tagname, user)
if user.status == 1
tagname = tagname.downcase
unless has_tag_without_aliasing(tagname)
saved = false
- Create a ticketCreate a ticket
Method index
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
@toggle = params[:sort] || "uses"
@title = I18n.t('tag_controller.tags')
@paginated = true
- Create a ticketCreate a ticket
File validation.js
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
$(document).ready(function() {
$("#edit-form").validate({
rules: {
'user[email]': {
required: true,
- Create a ticketCreate a ticket
Method check_and_add_tweets
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.check_and_add_tweets(tweets)
tweets.each do |tweet|
next unless tweet.reply?
in_reply_to_tweet_id = tweet.in_reply_to_tweet_id
- Read upRead up
- Create a ticketCreate a ticket
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
Method show
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@node = if params[:lang]
Node.find_wiki(params[:lang] + '/' + params[:id])
else
Node.find_wiki(params[:id])
- Create a ticketCreate a ticket
Method parse_comment_from_email
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_comment_from_email(mail, node_id, user, reply_to = [false, nil])
node = Node.where(nid: node_id).first
if node && mail&.html_part
mail_doc = Nokogiri::HTML(mail&.html_part&.body&.decoded) # To parse the mail to extract comment content and reply content
domain = get_domain mail.from.first
- Read upRead up
- Create a ticketCreate a ticket
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"