lowdefy/lowdefy

View on GitHub

Showing 9,449 of 9,537 total issues

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

const BrandTag = () => {
  const [showBranding, setShowBranding] = useState(false);
  useEffect(() => {
    checkEntitlement({ setShowBranding });
  }, []);
Severity: Minor
Found in packages/client/src/BrandTag.js - About 1 hr to fix

    Function reducer has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Confirmed

    function reducer(state, action) {
      switch (action.type) {
        case 'increment':
          return {
            ...state,
    Severity: Minor
    Found in packages/client/src/ProgressBarController.js - About 1 hr to fix

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

      const hasValues = (val) => {
        switch (type.typeOf(val)) {
          case 'boolean':
          case 'date':
          case 'function':
      Severity: Minor
      Found in packages/utils/helpers/src/unset.js - About 1 hr to fix

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

        async function build(options) {
          const context = createContext(options);
          const components = await buildRefs({ context });
          testSchema({ components, context });
          buildApp({ components, context });
        Severity: Minor
        Found in packages/build/src/index.js - About 1 hr to fix

          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

          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

          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-dev/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-enterprise/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 _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 _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 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 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 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 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 provideDocumentLinks has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public async provideDocumentLinks(
                      document: vscode.TextDocument,
                      token: vscode.CancellationToken
                    ): Promise<vscode.DocumentLink[] | undefined> {
                      let links: vscode.DocumentLink[] = [];
                  Severity: Minor
                  Found in packages/ides/vscode/src/language/RefLinkProvider.ts - 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
                        Severity
                        Category
                        Status
                        Source
                        Language