Showing 229 of 518 total issues
Function diff_compute_
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,
deadline) {
var diffs;
if (!text1) {
- 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
Constructor has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
pluginId: String,
name: String,
namespace: ProjectNamespace,
recommendedVersion: Option[String],
recommendedVersionTags: Option[List[APIV2QueryVersionTag]],
Constructor has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
joinable: Model[Project],
projectOwner: Model[User],
publicVersions: Int, // project.versions.count(_.visibility === VisibilityTypes.Public)
settings: Model[ProjectSettings],
members: Seq[(Model[ProjectUserRole], Model[User])],
Constructor has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
namespace: ProjectNamespace,
visibility: Visibility,
views: Long,
downloads: Long,
stars: Long,
Function diff_cleanupSemanticScore_
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function diff_cleanupSemanticScore_(one, two) {
if (!one || !two) {
// Edges are the best.
return 6;
}
Function applyPlacement
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Tooltip.prototype.applyPlacement = function (offset, placement) {
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
Function show
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Tab.prototype.show = function () {
var $this = this.element
var $ul = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')
Function initColorPicker
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function initColorPicker() {
var modal = getModal();
// Initialize popover to stay opened when hovered over
modal.find(".color-picker").popover({
html: true,
Function updateProjectTopic
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def updateProjectTopic(project: Model[Project]): F[Boolean] = {
require(project.topicId.isDefined, "undefined topic id")
require(project.postId.isDefined, "undefined post id")
val topicId = project.topicId
Function provideOreDiscourseApi
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
): OreDiscourseApi[IO] = {
val forums = config.forums
if (forums.api.enabled) {
val api = forums.api
Function takeoverReview
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def takeoverReview(author: String, slug: String, versionString: String): Action[String] = {
Authenticated
.andThen(PermissionAction(Permission.Reviewer))
.asyncEitherT(parse.form(forms.ReviewDescription)) { implicit request =>
for {
Function patch_addContext_
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
diff_match_patch.prototype.patch_addContext_ = function(patch, text) {
if (text.length == 0) {
return;
}
if (patch.start2 === null) {
Function diff_commonOverlap_
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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.
Function getData
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
override def getData(bufferedReader: BufferedReader): Seq[DataValue] = {
val dataValues = new ArrayBuffer[DataValue]
try {
val info = McModInfo.DEFAULT.read(bufferedReader).asScala
if (info.lengthCompare(1) < 0) Nil
Constructor has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private val id: ObjId[User],
fullName: Option[String] = None,
name: String = "",
email: Option[String] = None,
tagline: Option[String] = None,
Method rawApply
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
id: Option[DbRef[LoggedActionModel[Ctx]]],
createdAt: Option[Instant],
userId: DbRef[User],
address: InetString,
action: LoggedAction[Ctx],
Constructor has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
api: DiscourseApi[F],
categoryDefault: Int,
categoryDeleted: Int,
topicTemplatePath: Path,
versionReleasePostTemplatePath: Path,
Method getHomeProjects
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
currentUserId: Option[DbRef[User]],
canSeeHidden: Boolean,
platformNames: List[String],
categories: List[Category],
query: Option[String],
Function apiV2Request
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function apiV2Request(url, method = "GET", data = {}) {
return getApiSession().then(function (session) {
return new Promise(function (resolve, reject) {
const isFormData = data instanceof FormData;
const isBodyRequest = (method === "POST" || method === "PUT" || method === "PATCH");
Function checkPosition
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var height = this.$element.height()
var offset = this.options.offset