Showing 119 of 303 total issues
Function factors
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
storedFileInfos.map(async info => {
let isSameDir = false;
let isAccessible = false;
if (this.as.isSameDir(info.from_path)) {
isSameDir = true;
Function default
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function(config: Config): any {
const streamFlag = false;
const router = express.Router();
const log = log4js.getLogger("sqliteAll");
const ds = new DbService(config);
Function detect
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
async detect(
fileInfo: FileInfo,
storedFileInfoByHash: ?HashRow,
storedFileInfoByPHashs: HashRow[],
storedFileInfoByNames: HashRow[] = []
File ACDSyncService.js
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
import path from "path";
import pLimit from "p-limit";
import typeof { Logger } from "log4js";
import TagDbService from "../db/TagDbService";
File FaceSpinnerService.js
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
// import cv from "opencv4nodejs-prebuilt";
import pLimit from "p-limit";
import FormData from "form-data";
import axios from "axios";
File ProcessStateDbService.js
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
import typeof { Logger } from "log4js";
import type { Database } from "./SQLiteService";
import DeepLearningHelper from "../../helpers/DeepLearningHelper";
import DbHelper from "../../helpers/DbHelper";
Function handleFileNameMark
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
async handleFileNameMark(
fileInfo: FileInfo,
storedFileInfoByHash: ?HashRow,
storedFileInfoByPHashs: HashRow[],
storedFileInfoByNames: HashRow[],
- 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 parseBody
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const parseBody = (body: any, table: string): any => {
const stringColumns = ["meta", "trim"];
const numberColumns = [
"missing",
"orientation",
Function default
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function(config: Config): any {
const router = express.Router();
// const log = log4js.getLogger("sqliteChannelCrud");
const cds = new ChannelDbService(config);
cds.init();
FileService
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export default class FileService {
log: typeof Logger;
config: Config;
Function rename
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
async rename(
from: string,
to?: string,
isRetry: boolean = false,
isCopy: boolean = false
- 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 fillField
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fillField = async (items: { hash: string }[], param: any) => {
if (items.length && param.type === "TYPE_IMAGE") {
const hashs = items.map(i => i.hash);
let columns = [
"distinct hash.hash",
Function toColoredPartMask
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export function toColoredPartMask(
partSegmentation: any,
passedPartColors: any
): ImageData | null {
let partColors = passedPartColors;
- 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 colorizeReasonType
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
static colorizeReasonType(type: string): string {
const typeLabel = type.padStart(TYPE_P_HASH_REJECT_LOW_RESOLUTION.length);
switch (type) {
// may be result
case TYPE_P_HASH_MAY_BE:
Function results
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const results = factors.map((factor): JudgeResultSimple => {
this.log.trace(JSON.stringify(factor, null, 2));
if (factor.isValidDistance === false) {
return [TYPE_HOLD, factor.info, TYPE_PROCESS_ERROR];
}
Function readInfo
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
async readInfo(): Promise<ImageContentsInfo> {
switch (this.as.detectClassifyType()) {
case TYPE_IMAGE: {
const info = await this.imageMagickService.identify(
this.as.getSourcePath()
Function detect
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
async detect(
fileInfo: FileInfo,
storedFileInfoByHash: ?HashRow,
storedFileInfoByPHashs: HashRow[],
storedFileInfoByNames: HashRow[] = []
- 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 processRegularFile
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async processRegularFile(preferFileInfo?: FileInfo): Promise<boolean> {
const fileInfo =
preferFileInfo || (await this.fileService.collectFileInfo());
try {
await this.lockForRead(fileInfo);
Function constructor
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
constructor() {
this.cli = new Cli();
const userConfig = EnvironmentHelper.loadUserConfig();
- 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 logResult
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
logResult(
{ from_path: fromPath, size, width, height, p_hash: pHash }: FileInfo,
result: JudgeResultSimple | JudgeResult
): JudgeResult {
let message = null;