Showing 100 of 340 total issues
Function reducer
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function reducer(
state = initialState,
action: ArticleActions
): State {
switch (action.type) {
File draft-edit.component.ts
has 422 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
Component,
OnInit,
ElementRef,
ViewChild,
File article.ts
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as mongoose from 'mongoose';
import * as http from 'http';
import { Router, Response } from 'express';
import { check, oneOf, body, param, validationResult } from 'express-validator/check';
Function extractCondition
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
function extractCondition(req: any, cb: (error: any, condition: ArticleCondition) => void): void {
const query = req.query;
const source = query.condition ?
JSON.parse(query.condition) :
{};
- 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 init
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init(isResume: boolean, _id: string): void {
if (isResume) {
this.action = '更新';
this.store.dispatch(new SetTitle({title: `下書きを${this.action}する`}));
Function extractCondition
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function extractCondition(req: any, cb: (error: any, condition: ArticleCondition) => void): void {
const query = req.query;
const source = query.condition ?
JSON.parse(query.condition) :
{};
Function reducer
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function reducer(
state = initialState,
action: DraftActions
): State {
switch (action.type) {
Function setForm
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setForm() {
// TODO ページング
if (this.data.idForUpdate) {
// 更新時
DraftEditComponent
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
selector: 'app-draft-edit',
templateUrl: './draft-edit.component.html',
styleUrls: ['./draft-edit.component.scss'],
})
Function constructor
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
private router: Router,
private actions$: Actions,
private route: ActivatedRoute,
private fb: FormBuilder,
File search-condition.ts
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as mongoose from 'mongoose';
import * as http from 'http';
import { Router, Response } from 'express';
import { check, oneOf, body, param, validationResult } from 'express-validator/check';
Function of
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
of(pattern: string, dateFrom: Date = null, dateTo: Date = null) {
const sysdate: moment.Moment = moment();
const todayStart: moment.Moment = sysdate.clone().startOf('day');
const todayEnd: moment.Moment = sysdate.clone().endOf('day');
File search-condition.dialog.ts
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Component, Inject, OnInit} from '@angular/core';
import {
FormGroup,
FormControl,
FormArray,
Function upsertArticle
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
upsertArticle(form: FormGroup): void {
if (!form.valid ) {
return;
}
Function getCondition
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getCondition(req: any, cb: Function): void {
const query = req.query;
const source = query.condition ?
JSON.parse(query.condition) :
{};
Function openSerchConditionDialog
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
openSerchConditionDialog(conditionForUpdate: SearchConditionModel = null) {
const dialogRef = this.dialog.open(SearchConditionDialogComponent, {
width: '810px',
data: { idForUpdate: conditionForUpdate && conditionForUpdate._id.toString() }
});
Function parse
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
parse(rawText: string, baseUrl: string = null): any {
const toc = [];
const renderer = new marked.Renderer();
renderer.heading = function(text, level) {
// domのidに使えない文字はハイフンに置換する
Function initDB
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private initDB(): void {
User
.findOne({ userId : ENV.ROOT_USER_ID })
.exec((err, user) => {
if (err) {
Function constructCondition
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function constructCondition(req: any, cb: Function): void {
const query = req.query;
const source = query.condition ?
JSON.parse(query.condition) :
{};
Function init
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private init(): void {
const _headings = document.querySelectorAll('.' + MARKDOWN_HEADER_CLASS);
const skipNoTocHeadings = (heading: HTMLHeadingElement) => !/(?:no-toc|notoc)/i.test(heading.className);
const headings = Array.prototype.filter.call(_headings, skipNoTocHeadings);
this.tocService.genToc(headings);