qlik-oss/sn-org-chart

View on GitHub

Showing 79 of 79 total issues

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

    settings.items.styling.items.backgroundColor = {
      type: "items",
      items: {
        useColorExpression: {
          ref: "style.backgroundColor.colorType",
Severity: Major
Found in src/extension/ext-raw.js and 1 other location - About 1 day to fix
src/extension/ext-raw.js on lines 192..222

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 195.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    settings.items.styling.items.fontColor = {
      type: "items",
      items: {
        useColorExpression: {
          ref: "style.fontColor.colorType",
Severity: Major
Found in src/extension/ext-raw.js and 1 other location - About 1 day to fix
src/extension/ext-raw.js on lines 160..190

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 195.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

            dataMatrix: [
              [
                {
                  qText: "CEO",
                  qNum: "NaN",
Severity: Major
Found in nebula.config.js and 1 other location - About 7 hrs to fix
nebula.config.js on lines 114..171

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 190.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                qMatrix: [
                  [
                    {
                      qText: "CEO",
                      qNum: "NaN",
Severity: Major
Found in nebula.config.js and 1 other location - About 7 hrs to fix
nebula.config.js on lines 243..300

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 190.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function createStylingDefinition has 191 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createStylingDefinition(theme, flags, translator) {
  const fontResolver = createFontResolver({
    theme,
    translator,
    flags,
Severity: Major
Found in src/extension/styling-definitions/styling-definition.js - About 7 hrs to fix

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

                  {
                    qFallbackTitle: "Boss",
                    qApprMaxGlyphCount: 3,
                    qCardinal: 6,
                    qSortIndicator: "A",
    Severity: Major
    Found in nebula.config.js and 1 other location - About 7 hrs to fix
    nebula.config.js on lines 32..69

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 181.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

                  {
                    qFallbackTitle: "Employee",
                    qApprMaxGlyphCount: 4,
                    qCardinal: 16,
                    qSortIndicator: "A",
    Severity: Major
    Found in nebula.config.js and 1 other location - About 7 hrs to fix
    nebula.config.js on lines 70..107

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 181.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function getSettings has 155 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const getSettings = (translator, flags, anything) => {
      const theme = anything?.sense?.theme;
      const settings = {
        uses: "settings",
        items: {
    Severity: Major
    Found in src/extension/ext-raw.js - About 6 hrs to fix

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      const nodes = {
        id: "1",
        elemNo: 1,
        rowNo: 0,
        children: [
      Severity: Major
      Found in src/tree/__tests__/render.spec.js and 1 other location - About 5 hrs to fix
      src/__tests__/snapshot.spec.js on lines 14..53

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 137.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

            nodes = {
              id: "1",
              elemNo: 1,
              rowNo: 0,
              children: [
      Severity: Major
      Found in src/__tests__/snapshot.spec.js and 1 other location - About 5 hrs to fix
      src/tree/__tests__/render.spec.js on lines 4..43

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 137.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      export default function supernova(env) {
        return {
          qae: {
            properties,
            data,
      Severity: Major
      Found in src/index.js - About 4 hrs to fix

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

            component: () => {
              const layout = useStaleLayout();
              const model = useModel();
              const element = useElement();
              const Theme = useTheme();
        Severity: Major
        Found in src/index.js - About 3 hrs to fix

          File nebula.config.js has 324 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // nebula.config.js
          module.exports = {
            build: {},
            serve: {
              open: false,
          Severity: Minor
          Found in nebula.config.js - About 3 hrs to fix

            Function selectionHandler has 80 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function selectionHandler(translator) {
              const [singleSelect, setSingleSelect] = useState(false);
              const selectionsAPI = useSelections();
              const isInSelections = !!useLayout().qSelectionInfo.qInSelections;
              const [selectionObj] = useState({
            Severity: Major
            Found in src/selections-handler.js - About 3 hrs to fix

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

              import DEFAULTS from "../style-defaults";
              import propertyResolver from "../utils/property-resolver";
              import migrateStyle from "./migration";
              import createStylingDefinition from "./styling-definitions/styling-definition";
              
              
              Severity: Minor
              Found in src/extension/ext-raw.js - About 3 hrs to fix

                Function createNodes has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function createNodes(matrix, attributeIndecies, status, navigationMode, translator) {
                  const nodeMap = {};
                  const allNodes = [];
                  for (let i = 0; i < matrix.length; ++i) {
                    const row = matrix[i];
                Severity: Major
                Found in src/utils/tree-utils.js - About 2 hrs to fix

                  Function select has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                    select: (node, selectionObj) => {
                      const { api, state, singleSelect, setState } = selectionObj;
                      if (node && api) {
                        let newState;
                        if (node.data.elemNo < 0 && node.data.elemNo !== -3) {
                  Severity: Minor
                  Found in src/utils/selections.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

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

                      it("should return all ids in tree and activate", () => {
                        const result = getAllTreeElemNo(defaultValues.nodes, true);
                        expect(result).toEqual([2, 3, 798, 88]);
                        expect(defaultValues.nodes.children[0].data.selected).toEqual(true);
                      });
                  Severity: Major
                  Found in src/utils/__tests__/tree-utils.spec.js and 1 other location - About 2 hrs to fix
                  src/utils/__tests__/tree-utils.spec.js on lines 225..229

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 84.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                      it("should return all ids in tree and de-activate", () => {
                        const result = getAllTreeElemNo(defaultValues.nodes, false);
                        expect(result).toEqual([2, 3, 798, 88]);
                        expect(defaultValues.nodes.children[0].data.selected).toEqual(false);
                      });
                  Severity: Major
                  Found in src/utils/__tests__/tree-utils.spec.js and 1 other location - About 2 hrs to fix
                  src/utils/__tests__/tree-utils.spec.js on lines 219..223

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 84.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                  export function getPoints(d, topId, { depthSpacing, isVertical, x, y }, navigationMode) {
                    // TODO: Generalize to make all directions work, currently on only ttb working
                    const { cardWidth, cardHeight, buttonHeight, cardPadding, buttonMargin } = constants;
                    const points = [];
                    const halfCard = { x: cardWidth / 2, y: cardHeight / 2 };
                  Severity: Minor
                  Found in src/tree/path.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

                  Severity
                  Category
                  Status
                  Source
                  Language