HumanCellAtlas/ingest-validator

View on GitHub

Showing 8 of 22 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    constructor(rabbitConnectionProperties: RabbitConnectionProperties, rabbitMessagingProperties: RabbitMessagingProperties, handler: IHandler) {
        this.rabbitConnectionProperties = rabbitConnectionProperties;
        this.rabbitMessagingProperties = rabbitMessagingProperties;
        this.handler = handler;

Severity: Major
Found in src/listener/file-validation-listener.ts and 1 other location - About 3 hrs to fix
src/listener/document-update-listener.ts on lines 15..21

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    constructor(rabbitConnectionProperties: RabbitConnectionProperties, rabbitMessagingProperties: RabbitMessagingProperties, handler: IHandler) {
        this.rabbitConnectionProperties = rabbitConnectionProperties;
        this.rabbitMessagingProperties = rabbitMessagingProperties;
        this.handler = handler;
        this.listener = new Listener(rabbitConnectionProperties, rabbitMessagingProperties);
Severity: Major
Found in src/listener/document-update-listener.ts and 1 other location - About 3 hrs to fix
src/listener/file-validation-listener.ts on lines 15..22

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    static _getProtocolsForProcess(processUrl: string, ingestClient: IngestClient) : Promise<MetadataResource[]> {
        return new Promise<MetadataResource[]>((resolve, reject) => {
            ingestClient.retrieveEmbeddedEntities(processUrl, "protocols", "protocols").then(protocols => {
                resolve(R.map(derivedProcess => FastqValidator._parseMetadataResource(derivedProcess), protocols));
            });
Severity: Major
Found in src/validation/fastq/fastq-validator.ts and 1 other location - About 2 hrs to fix
src/validation/fastq/fastq-validator.ts on lines 127..133

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 81.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    static _getDerivedProcessesForFile(fileUrl: string, ingestClient: IngestClient) : Promise<MetadataResource[]> {
        return new Promise<MetadataResource[]>((resolve, reject) => {
            ingestClient.retrieveEmbeddedEntities(fileUrl, "derivedProcesses", "processes").then(derivedProcesses => {
                    resolve(R.map(derivedProcess => FastqValidator._parseMetadataResource(derivedProcess), derivedProcesses));
            });
Severity: Major
Found in src/validation/fastq/fastq-validator.ts and 1 other location - About 2 hrs to fix
src/validation/fastq/fastq-validator.ts on lines 135..141

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 81.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    getValidationJob(fileDocumentUrl: string) : Promise<ValidationJob> {
        return this
            .retrieveMetadataDocument(fileDocumentUrl)
            .then(fileResource => {return Promise.resolve(fileResource["validationJob"] as ValidationJob)});
    }
Severity: Major
Found in src/utils/ingest-client/ingest-client.ts and 1 other location - About 1 hr to fix
src/utils/ingest-client/ingest-client.ts on lines 241..245

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    getFileChecksums(fileDocumentUrl: string) : Promise<FileChecksums> {
        return this
            .retrieveMetadataDocument(fileDocumentUrl)
            .then(fileResource => {return Promise.resolve(fileResource["checksums"] as FileChecksums)});
    }
Severity: Major
Found in src/utils/ingest-client/ingest-client.ts and 1 other location - About 1 hr to fix
src/utils/ingest-client/ingest-client.ts on lines 247..251

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                                } catch (e) {
                                    console.error(`Logging unexpected exception: \n ${e.stack} \n ..for message: ${msg!.content}`);
                                    ch.ack(msg!)
                                }
Severity: Minor
Found in src/listener/listener.ts and 1 other location - About 50 mins to fix
src/listener/listener.ts on lines 45..48

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                                    }).catch(Error, err => {
                                        console.error(`Logging unexpected error: \n ${err.stack} \n ..for message: ${msg!.content}`);
                                        ch.ack(msg!);
                                    });
Severity: Minor
Found in src/listener/listener.ts and 1 other location - About 50 mins to fix
src/listener/listener.ts on lines 49..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language