qlik-oss/sn-action-button

View on GitHub

Showing 54 of 203 total issues

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

    component() {
      const element = useElement();
      const theme = useTheme();

      useMemo(() => {
Severity: Minor
Found in src/index.js - About 1 hr to fix

    Function onclick has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      button.onclick = async () => {
        if (isClickable) {
          const actionCallList = [];
          const { actions } = layout;
          actions.forEach((action) => {
    Severity: Minor
    Found in src/components/action-button.js - About 1 hr to fix

      Function navigationCall has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          navigationCall: async ({ websiteUrl, sameWindow }) => {
            try {
              if (websiteUrl) {
                const protocol = getCurrentProtocol(websiteUrl);
                const url = removeProtocolHttp(websiteUrl);
      Severity: Minor
      Found in src/utils/navigation-actions.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

      Function oldAutomationRun has a Cognitive Complexity of 11 (exceeds 5 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

      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 validateFiles has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const validateFiles = (pkg) => {
        const whitelist = [
          "name",
          "version",
          "description",
      Severity: Minor
      Found in tools/validate-nebula-package.js - About 1 hr to fix

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

          createLabelAndIcon({ button, theme, style = {}, isSense }) {
            const { icon = {}, font = {}, label = DEFAULTS.LABEL, showLabel = true } = style;
            // text element wrapping label and icon
            const text = document.createElement("text");
            text.style.whiteSpace = "nowrap";
        Severity: Minor
        Found in src/utils/style-formatter.js - About 1 hr to fix

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

          export function convertAction(action, newProperties) {
            const newAction = {
              actionType: action.actionType,
              bookmark: action.selectedBookmark,
              // Will need to convert field selected by expression
          Severity: Minor
          Found in src/utils/conversion.js - About 1 hr to fix

            Function parseOutput has 28 lines of code (exceeds 25 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 1 hr to fix

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

                createLabelAndIcon({ button, theme, style = {}, isSense }) {
                  const { icon = {}, font = {}, label = DEFAULTS.LABEL, showLabel = true } = style;
                  // text element wrapping label and icon
                  const text = document.createElement("text");
                  text.style.whiteSpace = "nowrap";
              Severity: Minor
              Found in src/utils/style-formatter.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

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

              export default function ext({ translator, shouldHide, senseNavigation, theme, isGoToChartEnabled }) {
                const multiUserAutomation =
                  shouldHide.isEnabled && shouldHide.isEnabled("SENSECLIENT_IM_1855_AUTOMATIONS_MULTI_USER");
                return {
                  definition: {
              Severity: Minor
              Found in src/ext.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

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

                getFadedColor(color) {
                  const percent = 0.15;
                  let f;
                  let R;
                  let B;
              Severity: Minor
              Found in src/utils/color-utils.js - About 1 hr to fix

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

                export const getStyleEditorDefinition = ({ flags, theme, translator }) => {
                  const fontResolver = createFontResolver({
                    theme,
                    translator,
                    flags,
                Severity: Minor
                Found in src/styling-panel-definition.js - 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 getAutomationProps has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                const getAutomationProps = (multiUserAutomation, getAutomations) => ({
                  // adds automation to actions and adds a dropdown property panel
                  // item to select the automation for the button to trigger
                
                  // Boolean property to instruct the automation action to create a
                Severity: Minor
                Found in src/utils/automation-props.js - 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 setTextFontSize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export const setTextFontSize = (text, font, textFontSize, hasIcon) => {
                  if (font.style && font.style.italic) {
                    if (hasIcon) {
                      text.style.fontSize = `${trimDecimal(Math.max(textFontSize * 0.84, 8))}px`;
                      text.children[0].style.marginRight = `${trimDecimal(text.offsetWidth * 0.04)}px`;
                Severity: Minor
                Found in src/utils/style-utils.js - 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 resolveExpression has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  resolveExpression: (input) => {
                    // rgb
                    let matches = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(input);
                    if (matches) {
                      return `rgb(${matches[1]},${matches[2]},${matches[3]})`;
                Severity: Minor
                Found in src/utils/color-utils.js - 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 getFadedColor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  getFadedColor(color) {
                    const percent = 0.15;
                    let f;
                    let R;
                    let B;
                Severity: Minor
                Found in src/utils/color-utils.js - 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

                Avoid too many return statements within this function.
                Open

                        return { message: data };
                Severity: Major
                Found in src/utils/automation-helper.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return defaultMessage;
                  Severity: Major
                  Found in src/utils/automation-helper.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return resolve({ ...parseOutput(automationRun.title, translator), ok: true });
                    Severity: Major
                    Found in src/utils/automation-helper.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return resolve({
                              message: getDefaultMessage(translator),
                              ok: true,
                            });
                      Severity: Major
                      Found in src/utils/automation-helper.js - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language