elninotech/uppload

View on GitHub

Showing 35 of 92 total issues

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

  constructor(apiKey: string) {
    super({
      apiKey,
      name: "pexels",
      icon: `<svg aria-hidden="true" viewbox="0 0 256 256" xmlns="http://www.w3.org/2000/svg"><path d="M21 0h-4v255l72 1h71v-35l1-35 4-1a97 97 0 0053-33 81 81 0 0013-22l7-22v-3-23-2l-1-3v-2a95 95 0 00-42-60l-3-3-13-6a98 98 0 00-30-6H21zm130 37a85 85 0 008 1l11 5a57 57 0 0131 62c-5 23-23 41-45 45l-20 1h-12v68H53v-91l1-91h97z" fill="#000" fill-rule="nonzero"/></svg>`,
Severity: Minor
Found in src/services/search/pexels.ts - About 1 hr to fix

    Function clickPhoto has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      clickPhoto(params: IHandlersParams) {
        this.canvas = document.createElement("canvas");
        const video = params.uppload.container.querySelector(
          "video.camera-stream"
        ) as HTMLVideoElement | null;
    Severity: Minor
    Found in src/services/camera.ts - About 1 hr to fix

      Function getEffectsNavbar has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private getEffectsNavbar() {
          return `<div class="effects-continue">
          <button class="effects-continue--cancel">${translate("cancel")}</button>
        </div><div class="effects-tabs"><div class="effects-tabs-flow">
            ${this.effects
      Severity: Minor
      Found in src/uppload.ts - About 1 hr to fix

        Function showHelp has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          showHelp(url: string) {
            this.emitter.emit("help", url);
            const aside = this.container.querySelector("aside");
            if (aside) aside.style.display = "none";
            const section = this.container.querySelector("section");
        Severity: Minor
        Found in src/uppload.ts - About 1 hr 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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          private render() {
            return `
              ${this.error ? `<div class="uppload-error">${this.error}</div>` : ""}
              ${
                this.activeEffect
        Severity: Minor
        Found in src/uppload.ts - About 1 hr 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 compressImage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        export const compressImage = (
          file: Blob,
          settings: IUpploadSettings
        ): Promise<Blob> =>
          new Promise(resolve => {
        Severity: Minor
        Found in src/helpers/elements.ts - About 1 hr 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 constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor(apiKey: string) {
            super({
              apiKey,
              name: "unsplash",
              icon: `<svg aria-hidden="true" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg"><path d="M81 113v72h94v-72h81v143H0V113h81zM175 0v71H81V0h94z" fill="#000" fill-rule="evenodd"/></svg>`,
        Severity: Minor
        Found in src/services/search/unsplash.ts - About 1 hr to fix

          Function renderActiveEffect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private renderActiveEffect(file: IUpploadFile) {
              const activeEffects = this.effects.filter(
                effect => effect.name === this.activeEffect
              );
              if (!activeEffects.length) {
          Severity: Minor
          Found in src/uppload.ts - About 1 hr to fix

            Function linkFunction has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  const linkFunction = (e: Event) => {
                    const service = link.getAttribute("data-uppload-service");
                    if (service) {
                      this.navigate(service);
                      const serviceDiv = this.container.querySelector(
            Severity: Minor
            Found in src/uppload.ts - About 1 hr to fix

              Function install has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                private install(plugin: UpploadService | UpploadEffect) {
                  // Check if the browser supports this plugin
                  if (!plugin.supports()) return;
                  if (plugin.type === "service") {
                    // Install this service if it isn't already installed
              Severity: Minor
              Found in src/uppload.ts - About 35 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                update(params: IHandlersParams) {
                  this.updateImages(params);
                  if (params) this.handlers(params);
                  const loader = params.uppload.container.querySelector(
                    ".search-loader"
              Severity: Minor
              Found in src/helpers/search.ts - About 35 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 fitImageToContainer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              export const fitImageToContainer = (
                params: IHandlersParams,
                image: HTMLImageElement | HTMLVideoElement
              ): Promise<void> => {
                return new Promise(resolve => {
              Severity: Minor
              Found in src/helpers/elements.ts - About 35 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 helper has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                helper: (text: string) => {
                  // Replace all instances of $A$ with "a" or "an"
                  const AAN = "$A$";
                  while (text.indexOf(AAN) !== -1) {
                    const index = text.indexOf(AAN);
              Severity: Minor
              Found in src/i18n/en.ts - About 35 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 handlers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                private handlers() {
                  const openFunction = () => this.open();
                  const closeFunction = () => this.close();
              
                  /**
              Severity: Minor
              Found in src/uppload.ts - About 25 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                update(params: IHandlersParams) {
                  const loader = params.uppload.container.querySelector(
                    ".microlink-loader"
                  ) as HTMLDivElement;
                  const container = params.uppload.container.querySelector(
              Severity: Minor
              Found in src/helpers/microlink.ts - About 25 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