piobyte/flamingo

View on GitHub

Showing 22 of 52 total issues

Function exports has 133 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (suiteConfig: any) {
  return function (suiteName: string, description: string, filePath: string) {
    let server: IServer;
    let prom: Promise<any> = simpleServer(
      function (req, res) {
Severity: Major
Found in packages/flamingo/targets/bench/suites/convert-remote.ts - About 5 hrs to fix

    Function convertRemote has 111 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const convertRemote = function (profileName: string) {
          return new Promise(function (resolve) {
            new Benchmark.Suite(description)
              .add("GM", {
                defer: true,
    Severity: Major
    Found in packages/flamingo/targets/bench/suites/convert-remote.ts - About 4 hrs to fix

      Function banner has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function banner(route: Route, operation: FlamingoOperation) {
        let html = `
          <!doctype html><html lang=""><head><link rel="icon" href="${BASE64_ICON}">
          <title>${pkg.name}@${pkg.version}</title>
          <meta name="viewport" content="width=device-width, initial-scale=1">
      Severity: Major
      Found in packages/flamingo/src/routes/index.ts - About 3 hrs to fix

        Function Convert has 74 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export = function Convert<T extends Constructor<Route>>(Base: T) {
          /**
           * Basic mixin that represents the flamingo conversation process.
           * @mixin
           */
        Severity: Major
        Found in packages/flamingo/src/mixins/convert.ts - About 2 hrs to fix

          Function exports has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (suiteConfig: any) {
            return function (suiteName: string, description: string, filePath: string) {
              let prom: Promise<any> = Promise.resolve();
          
              function streamFunction(deferred: Deferred) {
          Severity: Major
          Found in packages/flamingo/targets/bench/suites/convert-local.ts - About 2 hrs to fix

            Function preview-image has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              "preview-image"(request, config: Config): Promise<ProfileInstruction> {
                let { width, height } = extractDimension(
                  request.query,
                  DEFAULT_PREVIEW_IMAGE_SIZE
                );
            Severity: Minor
            Found in packages/flamingo/src/profiles/examples.ts - About 1 hr to fix

              Function avatar-image has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                "avatar-image"(request, config: Config): Promise<ProfileInstruction> {
                  let { width, height } = extractDimension(
                    request.query,
                    DEFAULT_AVATAR_SIZE
                  );
              Severity: Minor
              Found in packages/flamingo/src/profiles/examples.ts - About 1 hr to fix

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

                            fn: function (deferred: Deferred) {
                              const op = new FlamingoOperation();
                              op.input = PARSED_HOST;
                              op.config = {
                                ACCESS: { HTTPS: { ENABLED: false } },
                Severity: Minor
                Found in packages/flamingo/targets/bench/suites/convert-remote.ts - About 1 hr to fix

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

                              fn: function (deferred: Deferred) {
                                const op = new FlamingoOperation();
                                op.input = PARSED_HOST;
                                op.config = {
                                  ACCESS: { HTTPS: { ENABLED: false } },
                  Severity: Minor
                  Found in packages/flamingo/targets/bench/suites/convert-remote.ts - About 1 hr to fix

                    Function debug-avatar-image has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      "debug-avatar-image"(request, config): Promise<ProfileInstruction> {
                        const dim = clamp(
                          envParser.objectInt("width", 200)(request.query),
                          10,
                          1024
                    Severity: Minor
                    Found in packages/flamingo/src/profiles/debug.ts - About 1 hr to fix

                      Function debug-preview-image has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        "debug-preview-image"(request, config): Promise<ProfileInstruction> {
                          const dim = clamp(
                            envParser.objectInt("width", 200)(request.query),
                            10,
                            1024
                      Severity: Minor
                      Found in packages/flamingo/src/profiles/debug.ts - About 1 hr to fix

                        Function storeResults has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function storeResults(
                          suite: Suite & { name: string },
                          suiteName: string,
                          profileName: string
                        ) {
                        Severity: Minor
                        Found in packages/flamingo/targets/bench/index.ts - About 1 hr to fix

                          Function videoProcessor has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function videoProcessor(input: stream.Readable): Promise<stream.Readable> {
                                return new Promise(function (resolve, reject) {
                                  ffmpeg.ffprobe(input, function (err: Error, meta: any) {
                                    if (err) {
                                      reject(new InvalidInputError(err.message, err));
                          Severity: Minor
                          Found in packages/flamingo/src/preprocessor/video/index.ts - About 1 hr to fix

                            Function constructor has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              constructor(
                                config: Config = {},
                                method: Hapi.Util.HTTP_METHODS_PARTIAL = "GET",
                                path = "/_debug",
                                description = "Debug"
                            Severity: Minor
                            Found in packages/flamingo/src/routes/debug.ts - About 1 hr to fix

                              Function extractDimension has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function extractDimension(
                                query: Record<string, any> = {},
                                defaultSize: number
                              ) {
                                let width;
                              Severity: Minor
                              Found in packages/flamingo/src/profiles/examples.ts - About 1 hr to fix

                                Function S3Mixin has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export = function S3Mixin<T extends Constructor<Route>>(SuperClass: T) {
                                  /**
                                   * Mixin that adds a video preprocessor which creates an image from a given video
                                   * @mixin
                                   */
                                Severity: Minor
                                Found in packages/flamingo-s3/src/mixin.ts - About 1 hr to fix

                                  Function httpsReader has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const httpsReader: Reader = function (
                                    operation: FlamingoOperation
                                  ): Promise<ReaderResult> {
                                    const conf = operation.config;
                                    const input = operation.input;
                                  Severity: Minor
                                  Found in packages/flamingo/src/reader/https.ts - About 1 hr to fix

                                    Function convertLocal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        function convertLocal(profileName: string) {
                                          return new Promise(function (resolve) {
                                            const gmOptions = { DEFAULT_MIME: "image/png" };
                                            const gmRequest = { headers: {}, query: { processor: "gm" } };
                                            const vipsOptions = { DEFAULT_MIME: "image/png" };
                                    Severity: Minor
                                    Found in packages/flamingo/targets/bench/suites/convert-local.ts - About 1 hr to fix

                                      Function avatar-image has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        "avatar-image"(request, config: Config): Promise<ProfileInstruction> {
                                          let { width, height } = extractDimension(
                                            request.query,
                                            DEFAULT_AVATAR_SIZE
                                          );
                                      Severity: Minor
                                      Found in packages/flamingo/src/profiles/examples.ts - About 45 mins to fix

                                      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 preview-image has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        "preview-image"(request, config: Config): Promise<ProfileInstruction> {
                                          let { width, height } = extractDimension(
                                            request.query,
                                            DEFAULT_PREVIEW_IMAGE_SIZE
                                          );
                                      Severity: Minor
                                      Found in packages/flamingo/src/profiles/examples.ts - About 45 mins to fix

                                      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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language