Showing 119 of 303 total issues
Function collectBlockFiles
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async collectBlockFiles(targetPath?: string): Promise<string[]> {
const finalTargetPath = targetPath || this.fs.getSourcePath();
const csvString = await fs.readFile(finalTargetPath);
const results: FvcExport[] = await csv.parse(csvString, {
delimiter: ";",
Function fillDeepLearningTable
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
fillDeepLearningTable(hitRows: HashRow[]): Promise<any> {
return Promise.all(
hitRows.map(async row => {
const fileInfo = DbService.rowToInfo(row, TYPE_IMAGE);
// TODO: version check?
Function searchAndGo
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
searchAndGo(
type: ClassifyType = TYPE_IMAGE,
processLimit: number = 1
): Promise<number> {
const limit = pLimit(this.config.maxWorkers);
Function result
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const result = await limitForPrepareFolder(async () => {
const directories = folderPath.replace(/(^\/|\/$)/g, "").split("/");
const fullPathDirectories = directories.map((d, i) => [
Array.from(Array(i + 1).keys()).map(j => directories[j]),
d
Function processAction
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async processAction(
fileInfo: FileInfo,
result: JudgeResult
): Promise<boolean> {
const [action, , reason, results] = result;
Function onload
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
img.onload = async () => {
const [c, ctx] = this.createCanvasAndContext(img.width, img.height);
ctx.drawImage(img, 0, 0);
// classify
if (!net) {
Function calculate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
calculate(targetPath: string): Promise<string> {
const classifyType = this.as.detectClassifyType(targetPath);
const shasum = crypto.createHash(this.config.hashAlgorithm);
if (
[
Function processImportedFile
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async processImportedFile(): Promise<boolean> {
const sourcePath = this.fileService.getSourcePath();
const toPath = FileNameMarkHelper.strip(sourcePath);
const type = AttributeService.detectClassifyTypeByConfig(this.config);
if (this.fileService.isLibraryPlace(toPath) === false) {
Function delete
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async delete(targetPath?: string, isRetry: boolean = false) {
const finalTargetPath = this.getSourcePath(targetPath);
if (!(await pathExists(finalTargetPath))) {
return;
}
- 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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async run() {
let isError = false;
this.registerErrorCallback();
- 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 escapeForQuery
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const escapeForQuery = (str: string) => {
let escapedStr = str;
[
" ",
"+",
Function queryByValue
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
queryByValue(
column: string,
$value: number | string,
type: ClassifyType
): Promise<HashRow[]> {
Function queryByValue
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
queryByValue(column: string, $value: number | string): Promise<FacePPRow[]> {
return new Promise((resolve, reject) => {
const db = this.spawnDb();
const rows = [];
db.serialize(async () => {
Function searchAndGo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
searchAndGo(
type: ClassifyType = TYPE_IMAGE,
processLimit: number = 1
): Promise<number> {
const limit = pLimit(parseInt(this.config.maxWorkers / 2, 10));
Function queryByValue
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
queryByValue(column: string, $value: number | string): Promise<any[]> {
return new Promise((resolve, reject) => {
const db = this.ss.spawn<any>(this.ss.detectDbFilePath(TYPE_IMAGE));
const rows = [];
db.serialize(async () => {
Function download
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async download(name: FaceApiModelName) {
const urls = this.getModelUrlsByName(name);
if (DeepLearningHelper.isFaceApiModelDownloaded(name)) {
return;
}
Function process
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async process(): Promise<boolean> {
let result;
if (await this.fileService.isDirectory()) {
result = (await this.processDirectory()).every(Boolean);
} else {
- 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 drawMask
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
canvas: any,
image: any,
maskImage: any,
maskOpacity: any,
maskBlurAmount: any,
Function processRegularFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async processRegularFile(preferFileInfo?: FileInfo): Promise<boolean> {
const fileInfo =
preferFileInfo || (await this.fileService.collectFileInfo());
try {
await this.lockForRead(fileInfo);
- 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 drawPoint
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ctx: any,
y: number,
x: number,
r: number,
color: string