lowdefy/lowdefy

View on GitHub

Showing 9,050 of 9,129 total issues

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

    if (!type.isArray(arr) || from < 0 || to < 0 || from >= arr.length || to >= arr.length) {
      return;
    }
Severity: Major
Found in packages/engine/src/State.js and 1 other location - About 1 hr to fix
packages/utils/helpers/src/swap.js on lines 20..22

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 58.

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

  if (!type.isArray(arr) || from < 0 || to < 0 || from >= arr.length || to >= arr.length) {
    return;
  }
Severity: Major
Found in packages/utils/helpers/src/swap.js and 1 other location - About 1 hr to fix
packages/engine/src/State.js on lines 69..71

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 58.

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 fetch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Confirmed

  async fetch(request) {
    request.loading = true;
    const startTime = Date.now();

    try {
Severity: Minor
Found in packages/engine/src/Requests.js - About 1 hr to fix

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

      return async function wrappedHandler(req, res) {
        const context = {
          // Important to give absolute path so Next can trace build files
          rid: crypto.randomUUID(),
          buildDirectory: path.join(process.cwd(), 'build'),
    Severity: Minor
    Found in packages/servers/server-enterprise/lib/server/apiWrapper.js - About 1 hr to fix

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

        return async function wrappedHandler(req, res) {
          const context = {
            // Important to give absolute path so Next can trace build files
            rid: crypto.randomUUID(),
            buildDirectory: path.join(process.cwd(), 'build'),
      Severity: Minor
      Found in packages/servers/server-dev/lib/server/apiWrapper.js - About 1 hr to fix

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

        const PaginationBlock = ({ blockId, loading, methods, properties, value }) => {
          const [state, setState] = useState(() =>
            calculateState({
              defaultCurrent: 1,
              defaultPageSize: properties.pageSizeOptions?.[0] ?? 10,

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

        const MultipleSelector = ({
          blockId,
          components: { Icon },
          events,
          loading,

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

        function _nunjucks({ location, params, state, payload, runtime }) {
          let templateString;
          let on;
          if (type.isObject(params) && type.isString(params.template)) {
            templateString = params.template;

        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 _random has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Confirmed

        function _random({ location, params }) {
          if (!type.isString(params) && !type.isObject(params)) {
            throw new Error(
              `Operator Error: _random takes an string or object type. Received: ${JSON.stringify(
                params

        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 _regex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Confirmed

        function _regex({ location, params, state }) {
          const pattern = type.isObject(params) ? params.pattern : params;
          if (!type.isString(pattern)) {
            throw new Error(
              `Operator Error: _regex.pattern must be a string. Received: ${JSON.stringify(

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

        async function validateVersion({ cliVersion, lowdefyVersion, print, requiresLowdefyYaml }) {
          if (!requiresLowdefyYaml) {
            return;
          }
          if (lowdefyVersion === 'local') {
        Severity: Minor
        Found in packages/cli/src/utils/validateVersion.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 dateFilter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        const dateFilter = (date, format, ...args) => {
          // for no date, return undefined.
          if (type.isNone(date)) {
            return '';
          }
        Severity: Minor
        Found in packages/utils/nunjucks/src/dateFilter.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 apiWrapper has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function apiWrapper(handler) {
          return async function wrappedHandler(req, res) {
            const context = {
              // Important to give absolute path so Next can trace build files
              rid: crypto.randomUUID(),
        Severity: Minor
        Found in packages/servers/server-community/lib/server/apiWrapper.js - About 1 hr to fix

          Function constructor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Confirmed

            constructor({ arrayIndices = [], areas, context }) {
              this.id = Math.random()
                .toString(36)
                .replace(/[^a-z]+/g, '')
                .substring(0, 5);
          Severity: Minor
          Found in packages/engine/src/Blocks.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Confirmed

                if (type.isObject(item)) {
                  let path = `${key}.${nextKey}[${index}]`;
                  // TODO: Convert all artifacts to not modify id.
                  const id =
                    item.blockId ??
            Severity: Major
            Found in packages/build/src/build/addKeys.js - About 1 hr to fix

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

                if (!pageConfig) {
                  logger.info({ event: 'redirect_page_not_found', pageId: home.pageId });
                  return {
                    redirect: {
                      destination: '/404',
              Severity: Major
              Found in packages/servers/server-community/pages/index.js and 1 other location - About 1 hr to fix
              packages/servers/server-enterprise/pages/index.js on lines 30..38

              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 55.

              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

                if (!pageConfig) {
                  logger.info({ event: 'redirect_page_not_found', pageId: home.pageId });
                  return {
                    redirect: {
                      destination: '/404',
              Severity: Major
              Found in packages/servers/server-enterprise/pages/index.js and 1 other location - About 1 hr to fix
              packages/servers/server-community/pages/index.js on lines 36..44

              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 55.

              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

              function AuthNotConfigured({ authConfig, children }) {
                const auth = {
                  authConfig,
                  getSession: authNotConfigured,
                  signIn: authNotConfigured,
              packages/servers/server-dev/lib/client/auth/AuthNotConfigured.js on lines 22..31

              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 55.

              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

              function AuthNotConfigured({ authConfig, children }) {
                const auth = {
                  authConfig,
                  getSession: authNotConfigured,
                  signIn: authNotConfigured,
              packages/servers/server-enterprise/lib/client/auth/AuthNotConfigured.js on lines 17..26

              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 55.

              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 5 locations. Consider refactoring.
              Open

              const DateRangeSelector = ({
                blockId,
                components: { Icon },
                events,
                loading,
              packages/plugins/blocks/blocks-antd/src/blocks/DateSelector/DateSelector.js on lines 26..85
              packages/plugins/blocks/blocks-antd/src/blocks/DateTimeSelector/DateTimeSelector.js on lines 26..114
              packages/plugins/blocks/blocks-antd/src/blocks/MonthSelector/MonthSelector.js on lines 28..89
              packages/plugins/blocks/blocks-antd/src/blocks/MultipleSelector/MultipleSelector.js on lines 46..188

              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 54.

              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

              Severity
              Category
              Status
              Source
              Language