Showing 14 of 22 total issues
Function _generateKeywordFunction
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
static _generateKeywordFunction() : SchemaValidateFunction {
const olsConnectionConfig: any = config.get("OLS_API.connection");
const olsSearchUrl = olsConnectionConfig["scheme"] + "://" + olsConnectionConfig["host"] + ":" + olsConnectionConfig["port"] + "/api/search?q="
const cachedOlsResponses: {[key: string]: Promise<any>} = {};
IngestClient
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class IngestClient extends Client {
constructor(connectionConfig: IngestConnectionProperties) {
const ingestUrl = `${connectionConfig.scheme}://${connectionConfig.host}:${connectionConfig.port}`;
super(ingestUrl);
Function findChildTerm
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
const findChildTerm = (schema: any, data: any, parentSchema:any, dataPath:any) => {
return new Promise((resolve, reject) => {
let parentTerms = schema.classes;
const ontologyIds = schema.ontologies;
let errors: ErrorObject[] = [];
Function _generateKeywordFunction
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
static _generateKeywordFunction() : SchemaValidateFunction {
const olsConnectionConfig: any = config.get("OLS_API.connection");
const olsSearchUrl = olsConnectionConfig["scheme"] + "://" + olsConnectionConfig["host"] + ":" + olsConnectionConfig["port"] + "/api/search?q="
const cachedOlsResponses: {[key: string]: Promise<any>} = {};
- 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 handle
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
handle(msg: string): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
let msgContent: any = null;
try {
msgContent = JSON.parse(msg);
Function constructUserFriendlyMessage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
constructUserFriendlyMessage() : void {
if(this.absoluteDataPath === null) {
throw new Error("Can't construct a user friendly message: absoluteDataPath of error not set");
} else if(!this.message) {
throw new Error("Can't construct a user friendly message: error message not set");
- 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 attemptFileValidation
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
attemptFileValidation(contentValidationReport: ValidationReport, fileDocument: any, documentType: string) : Promise<ValidationReport> {
// proceed with data file validation if metadata doc validation passes
if(documentType.toUpperCase() === 'FILE' && contentValidationReport.validationState.toUpperCase() == "VALID") {
const fileName = fileDocument['fileName'];
const fileFormat = IngestValidator.fileFormatFromFileName(fileName);
Function start
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
start(){
amqp.connect(String(this.rabbitUrl)).then((conn) => {
return conn.createChannel();
}).then(ch => {
ch.assertExchange(this.rabbitMessagingProperties.exchange, this.rabbitMessagingProperties.exchangeType).then(() => {
Function validateFile
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
validateFile(fileResource: any, fileFormat: string, fileName: string) : Promise<ValidationJob> {
const validationJob = fileResource["validationJob"];
const fileChecksums = fileResource["checksums"];
Function _handle
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
_handle(msgJson: any): Promise<any> {
const callbackLink = msgJson['callbackLink'];
const documentUrl = this.ingestClient.urlForCallbackLink(callbackLink);
const documentType = msgJson['documentType'].toUpperCase();
Function validateSingleSchema
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
validateSingleSchema(inputSchema: any, inputObject: any) : Promise<ErrorObject[]> {
inputSchema["$async"] = true;
const schemaId: string = inputSchema['$id'];
return new Promise((resolve, reject) => {
Function expandCurie
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
expandCurie(term: string) {
const termUri = encodeURIComponent(term);
const url = olsSearchUrl + termUri
+ "&exact=true&groupField=true&queryFields=obo_id";
Function validateFile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
validateFile(fileResource: any, fileFormat: string, fileName: string) : Promise<ValidationJob> {
const validationJob = fileResource["validationJob"];
const fileChecksums = fileResource["checksums"];
- 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 _isResourceEligible
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static _isResourceEligible(resource: any, resourceType: string): boolean {
if(! FastqValidator._isFile(resourceType)) {
return false;
} else {
try {
- 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"