qlik-oss/sn-action-button

View on GitHub

Showing 54 of 203 total issues

File lui-icons.js has 792 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export default [
  {
    value: "image",
    icon: "image",
    label: "Image",
Severity: Major
Found in src/utils/lui-icons.js - About 1 day to fix

    File actions.spec.js has 552 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import actions, { checkShowAction, getActionsList, getValueList } from "../actions";
    
    describe("actions", () => {
      const qStateName = "someState";
      let app;
    Severity: Major
    Found in src/utils/__tests__/actions.spec.js - About 1 day to fix

      File automation-helper.js has 512 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { encodeForHTML } from "./html-encoder";
      import { encodeUrl, getCurrentProtocol, removeProtocolHttp } from "./url-encoder";
      import { inIframe } from "./url-utils";
      
      const TRANSITION_TIME = 400;
      Severity: Major
      Found in src/utils/automation-helper.js - About 1 day to fix

        File ext.spec.js has 506 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import ext from "../ext";
        import objectProperties from "../object-properties";
        
        describe("ext", () => {
          const translator = {
        Severity: Major
        Found in src/__tests__/ext.spec.js - About 1 day to fix

          File style-formatter.spec.js has 483 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* eslint-disable prefer-destructuring */
          import defaultValues from "../../__tests__/default-button-props";
          import { getStyleEditorDefinition } from "../../styling-panel-definition";
          import styleFormatter from "../style-formatter";
          
          
          Severity: Minor
          Found in src/utils/__tests__/style-formatter.spec.js - About 7 hrs to fix

            File ext.js has 436 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { getStylingPanelDefinition } from "./styling-panel-definition";
            import actions, { checkShowAction, getActionsList } from "./utils/actions";
            import getAutomationProps from "./utils/automation-props";
            import importProperties from "./utils/conversion";
            import luiIcons from "./utils/lui-icons";
            Severity: Minor
            Found in src/ext.js - About 6 hrs to fix

              File actions.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {
                getAutomationData,
                getAutomationUrl,
                getPostOptions,
                getTemporaryBookmark,
              Severity: Minor
              Found in src/utils/actions.js - About 5 hrs to fix

                Function getInputBlocks has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const getInputBlocks = (bookmark) => {
                  const inputBlocks = {
                    blocks: [
                      {
                        id: "EB6A372B-3312-4E90-8E8F-88F2A889B4CF",
                Severity: Major
                Found in src/utils/automation-helper.js - About 4 hrs to fix

                  Function run has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  (function run() {
                    function connect() {
                      const schemaPromise = fetch("https://unpkg.com/enigma.js/schemas/3.2.json").then((response) => response.json());
                  
                      const openDoc = (appId) =>
                  Severity: Major
                  Found in example/index.js - About 3 hrs to fix

                    File navigation-actions.spec.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import defaultValues from "../../__tests__/default-button-props";
                    import navigationActions, {
                      checkShowNavigation,
                      getNavigationsList,
                      getOrderedSheets,
                    Severity: Minor
                    Found in src/utils/__tests__/navigation-actions.spec.js - About 3 hrs to fix

                      File styling-panel-definition.js has 313 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { fontResolver as createFontResolver } from "qlik-chart-modules";
                      import styleDefaults from "./style-defaults";
                      import propertyResolver from "./utils/property-resolver";
                      import { colorOptions, sizeBehaviorOptions, toggleOptions } from "./utils/style-utils";
                      
                      
                      Severity: Minor
                      Found in src/styling-panel-definition.js - About 3 hrs to fix

                        Function parseOutput has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const parseOutput = (data, translator) => {
                          const defaultMessage = { message: getDefaultMessage(translator) };
                          if (typeof data !== "undefined") {
                            if (typeof data === "object") {
                              if (Array.isArray(data)) {
                        Severity: Minor
                        Found in src/utils/automation-helper.js - About 3 hrs 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 pollAutomationAndGetMsg has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const pollAutomationAndGetMsg = async (automationId, triggered, response, translator) => {
                          let message;
                          switch (response.status) {
                            case 200:
                            case 201: {
                        Severity: Major
                        Found in src/utils/automation-helper.js - About 2 hrs to fix

                          Function renderButton has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const renderButton = ({
                            layout,
                            theme,
                            app,
                            interactions,
                          Severity: Minor
                          Found in src/components/action-button.js - About 2 hrs 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 automationRunPolling has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const automationRunPolling = async (automationId, runId, translator, polTimes, resolve) => {
                            const automationRun = await getAutomationRun(automationId, runId);
                            switch (automationRun.status) {
                              case "queued":
                              case "running":
                          Severity: Major
                          Found in src/utils/automation-helper.js - About 2 hrs to fix

                            Function supernova has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export default function supernova(env) {
                              const {
                                sense,
                                translator,
                                flags: { isEnabled },
                            Severity: Major
                            Found in src/index.js - About 2 hrs to fix

                              Function createSnackbar has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const createSnackbar = (msg, automationOpenLinkSameWindow, error) => {
                                const { message, url, urlText } = msg;
                                const encodedMessage = encodeForHTML(message);
                                const snackContainer = document.createElement("div");
                                const randomId = (Math.random() + 1).toString(36).substring(7);
                              Severity: Major
                              Found in src/utils/automation-helper.js - About 2 hrs to fix

                                Function oldAutomationRun has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const oldAutomationRun = async (automation, automationPostData, app) => {
                                  try {
                                    automation = encodeURIComponent(automation);
                                    const itemInfo = await fetch(`../api/v1/items/${automation}`).then((response) => response.json());
                                    const autoInfo = await fetch(`../api/v1/automations/${itemInfo.resourceId}`).then((response) => response.json());
                                Severity: Minor
                                Found in src/utils/automation-helper.js - About 1 hr to fix

                                  Function importProperties has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const importProperties = (exportedFmt, initialProperties) => {
                                    const newPropertyTree = { qChildren: [] };
                                    const newProperties = {
                                      actions: [],
                                      // Adding props to avoid errors from old navigation button. Converting to any other chart will still give these errors
                                  Severity: Minor
                                  Found in src/utils/conversion.js - About 1 hr to fix

                                    Function automationRunPolling has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    export const automationRunPolling = async (automationId, runId, translator, polTimes, resolve) => {
                                      const automationRun = await getAutomationRun(automationId, runId);
                                      switch (automationRun.status) {
                                        case "queued":
                                        case "running":
                                    Severity: Minor
                                    Found in src/utils/automation-helper.js - 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language