snakazawa/github2slack

View on GitHub
src/serializer/serializer_master.js

Summary

Maintainability
C
1 day
Test Coverage

Showing 9 of 9 total issues

Function serialize has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async serialize (eventName: string, body: any): Promise<Message> {
if (!body) {
throw new Error('invalid body: (empty)');
}
 
 
Severity: Minor
Found in src/serializer/serializer_master.js - About 1 hr to fix

    Function serialize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    async serialize (eventName: string, body: any): Promise<Message> {
    if (!body) {
    throw new Error('invalid body: (empty)');
    }
     
     
    Severity: Minor
    Found in src/serializer/serializer_master.js - About 1 hr to fix

    Avoid too many return statements within this function.
    Open

    return this.serializers.projectColumn.serialize(new ProjectColumnPayload(body));
    Severity: Major
    Found in src/serializer/serializer_master.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

      return this.serializers.projectCard.serialize(new ProjectCardPayload(body));
      Severity: Major
      Found in src/serializer/serializer_master.js - About 30 mins to fix

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

        case 'issue_comment':
        if (!this.serializers.issueComment) {
        throw new Error(`serializer was not found: ${this.packageName}.IssueCommentEvent`);
        }
        return this.serializers.issueComment.serialize(new IssueCommentPayload(body));
        Severity: Major
        Found in src/serializer/serializer_master.js and 4 other locations - About 1 hr to fix
        src/serializer/serializer_master.js on lines 51..55
        src/serializer/serializer_master.js on lines 63..67
        src/serializer/serializer_master.js on lines 69..73
        src/serializer/serializer_master.js on lines 75..79

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

        case 'project_column':
        if (!this.serializers.projectColumn) {
        throw new Error(`serializer was not found: ${this.packageName}.ProjectColumnEvent`);
        }
        return this.serializers.projectColumn.serialize(new ProjectColumnPayload(body));
        Severity: Major
        Found in src/serializer/serializer_master.js and 4 other locations - About 1 hr to fix
        src/serializer/serializer_master.js on lines 51..55
        src/serializer/serializer_master.js on lines 57..61
        src/serializer/serializer_master.js on lines 63..67
        src/serializer/serializer_master.js on lines 69..73

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

        case 'project':
        if (!this.serializers.project) {
        throw new Error(`serializer was not found: ${this.packageName}.ProjectEvent`);
        }
        return this.serializers.project.serialize(new ProjectPayload(body));
        Severity: Major
        Found in src/serializer/serializer_master.js and 4 other locations - About 1 hr to fix
        src/serializer/serializer_master.js on lines 51..55
        src/serializer/serializer_master.js on lines 57..61
        src/serializer/serializer_master.js on lines 63..67
        src/serializer/serializer_master.js on lines 75..79

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

        case 'issues':
        if (!this.serializers.issues) {
        throw new Error(`serializer was not found: ${this.packageName}.IssuesEvent`);
        }
        return this.serializers.issues.serialize(new IssuesPayload(body));
        Severity: Major
        Found in src/serializer/serializer_master.js and 4 other locations - About 1 hr to fix
        src/serializer/serializer_master.js on lines 57..61
        src/serializer/serializer_master.js on lines 63..67
        src/serializer/serializer_master.js on lines 69..73
        src/serializer/serializer_master.js on lines 75..79

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

        case 'gollum':
        if (!this.serializers.gollum) {
        throw new Error(`serializer was not found: ${this.packageName}.GollumEvent`);
        }
        return this.serializers.gollum.serialize(new GollumPayload(body));
        Severity: Major
        Found in src/serializer/serializer_master.js and 4 other locations - About 1 hr to fix
        src/serializer/serializer_master.js on lines 51..55
        src/serializer/serializer_master.js on lines 57..61
        src/serializer/serializer_master.js on lines 69..73
        src/serializer/serializer_master.js on lines 75..79

        There are no issues that match your filters.

        Category
        Status