Showing 13 of 17 total issues
Function detect
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async detect(option?: faceapi.FaceDetectionOptions): Promise<any> {
let t: faceapi.DetectAllFacesTask | faceapi.DetectSingleFaceTask;
if (this.type === 'all') {
t = faceapi.detectAllFaces(await this.target, option || undefined);
} else {
Function detect
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
public async detect(option?: faceapi.FaceDetectionOptions): Promise<any> {
let t: faceapi.DetectAllFacesTask | faceapi.DetectSingleFaceTask;
if (this.type === 'all') {
t = faceapi.detectAllFaces(await this.target, option || undefined);
} 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 draw
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async draw(results: any[]) {
const target = await this.task.target;
let { width, height } = target;
if (target instanceof HTMLVideoElement) {
height = target.videoHeight;
Function addCdkOverlayPrebuiltCssToAppStyles
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function addCdkOverlayPrebuiltCssToAppStyles(options: Schema): Rule {
return (host: Tree, _: SchematicContext) => {
const workspace = getWorkspace(host);
const project = getProjectFromWorkspace(workspace, options.project);
const styleFilePath = getProjectStyleFile(project);
Function draw
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
private async draw(results: any[]) {
const target = await this.task.target;
let { width, height } = target;
if (target instanceof HTMLVideoElement) {
height = target.videoHeight;
- 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 getLatestNodeVersion
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function getLatestNodeVersion(
packageName: string,
): Promise<NpmRegistryPackage> {
const DEFAULT_VERSION = 'latest';
Avoid too many return
statements within this function. Open
Open
return t.run();
Avoid too many return
statements within this function. Open
Open
return t
.withFaceLandmarks()
.withFaceExpressions()
.run();
Avoid too many return
statements within this function. Open
Open
return t
.withFaceLandmarks()
.withFaceExpressions()
.withAgeAndGender()
.run();
Avoid too many return
statements within this function. Open
Open
return t.withFaceExpressions().run();
Avoid too many return
statements within this function. Open
Open
return t.withFaceLandmarks().run();
Avoid too many return
statements within this function. Open
Open
return t
.withFaceLandmarks()
.withAgeAndGender()
.run();
Avoid too many return
statements within this function. Open
Open
return t
.withFaceExpressions()
.withAgeAndGender()
.run();