Showing 518 of 518 total issues
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,
Similar blocks of code found in 2 locations. Consider refactoring. Open
self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
- 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 55.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
- 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 55.
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
Similar blocks of code found in 5 locations. Consider refactoring. Open
package ore.db.impl.schema
import ore.db.DbRef
import ore.db.impl.OrePostgresDriver.api._
import ore.models.project.Project
- 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 90.
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
Similar blocks of code found in 5 locations. Consider refactoring. Open
package ore.db.impl.schema
import ore.db.DbRef
import ore.db.impl.OrePostgresDriver.api._
import ore.models.project.Project
- 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 90.
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