Showing 229 of 518 total issues
Function getAuthors
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
): Query0[(String, Option[Instant], Instant, Option[Role], Option[Role], Long)] = {
val (sort, reverse) = if (ordering.startsWith("-")) (ordering.substring(1), false) else (ordering, true)
val pageSize = config.ore.users.authorPageSize
val offset = (page - 1) * pageSize
Function saveTo
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
)(implicit service: ModelService[F], F: Monad[F]): EitherT[F, List[String], Unit] = {
val otherDbChannels = project.channels(ModelView.later(Channel)).filterView(_.name =!= oldName)
val query = project.channels(ModelView.raw(Channel)).filter(_.name === oldName).map { channel =>
(
channel,
Function diff_lineMode_
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {
// Scan the text on a line-by-line basis first.
var a = this.diff_linesToChars_(text1, text2);
text1 = a.chars1;
text2 = a.chars2;
- 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 updateVersionPost
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def updateVersionPost(project: Model[Project], version: Model[Version]): F[Boolean] = {
require(project.topicId.isDefined, "undefined topic id")
require(version.postId.isDefined, "undefined post id")
val topicId = project.topicId
Function run
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
override def run(): Unit = {
import cats.instances.vector._
Logger.debug("Running Discourse recovery task...")
def runUpdates[T, M, S[_], A](query: Query[T, M, S], error: String)(use: S[M] => F[A]): Unit =
Function showNotifications
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def showNotifications(notificationFilter: Option[String], inviteFilter: Option[String]): Action[AnyContent] = {
Authenticated.asyncF { implicit request =>
import cats.instances.vector._
val user = request.user
Function setVisible
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setVisible(author: String, slug: String, visibility: Int): Action[AnyContent] = {
AuthedProjectAction(author, slug, requireUnlock = true)
.andThen(ProjectPermissionAction(Permission.Reviewer))
.asyncF { implicit request =>
val newVisibility = Visibility.withValue(visibility)
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 next
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
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 startVersion
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
): Either[String, PendingVersion] = {
val metaData = plugin.data
if (!metaData.id.contains(pluginId))
Left("error.plugin.invalidPluginId")
else if (metaData.version.isEmpty)
Function approve
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def approve(author: String, slug: String, versionString: String, partial: Boolean): Action[AnyContent] = {
AuthedProjectAction(author, slug, requireUnlock = true)
.andThen(ProjectPermissionAction(Permission.Reviewer))
.asyncEitherT { implicit request =>
val newState = if (partial) ReviewState.PartiallyReviewed else ReviewState.Reviewed
Consider simplifying this complex logical expression. Open
if (lastEquality && ((pre_ins && pre_del && post_ins && post_del) ||
((lastEquality.length < this.Diff_EditCost / 2) &&
(pre_ins + pre_del + post_ins + post_del) == 3))) {
// Duplicate record.
diffs.splice(equalities[equalitiesLength - 1], 0,
Method listProjects
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
q: Option[String],
categories: Seq[Category],
tags: Seq[String],
owner: Option[String],
sort: Option[ProjectSortingStrategy],
Constructor has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
projectId: DbRef[Project],
homepage: Option[String] = None,
issues: Option[String] = None,
source: Option[String] = None,
support: Option[String] = None,
Function initChannelManager
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function initChannelManager(toggle, channelName, channelHex, title, call, method, submit, nonReviewed) {
Constructor has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
headerData: HeaderData,
user: Model[User],
isOrga: Boolean,
projectCount: Int,
orgas: Seq[(Model[Organization], Model[User], Model[OrganizationUserRole], Model[User])],
Constructor has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
val service: ModelService[IO],
val config: OreConfig,
val forums: OreDiscourseApi[IO],
val cacheApi: SyncCacheApi,
val actorSystem: ActorSystem,
Function toString
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
diff_match_patch.patch_obj.prototype.toString = function() {
var coords1, coords2;
if (this.length1 === 0) {
coords1 = this.start1 + ',0';
} else if (this.length1 == 1) {
- 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 diff_commonOverlap_
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
diff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {
// Cache the text lengths to prevent multiple calls.
var text1_length = text1.length;
var text2_length = text2.length;
// Eliminate the null case.
- 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"