Performance Issue: SonarCloud Analysis of Large Vue.js TypeScript Codebase

FYI, I’m using Vite + Vue 3.3 + TypeScript + Vitest. Bitbucket as a git-based source code repo.

I have around 2k files and lately, I’ve been starting to see that my sonarcloud build step runs for 30+ minutes each time SonarCloud build step is execued.

I found relevant problem as stated here: Sonar analysis running very slow on .vue files

The sonar analysis is really slow on .vue and the analyse happens file by file, it does not pick up files by chunks :frowning:

sonar-project.properties file:

sonar.organization=my-proj
sonar.projectKey=my-key
sonar.projectVersion="1.2"
sonar.javascript.lcov.reportPaths="test-reports/coverage/lcov.info"
sonar.typescript.tsconfigPath="tsconfig.sonar.json"
sonar.javascript.node.maxspace=8192
sonar.host.url=https://sonarcloud.io
sonar.sources=src

tsconfig.sonar.json file:

{
  "compilerOptions": {
    "module": "ESNext",
    "target": "ESNext",
    "lib": ["DOM", "ESNext"],
    "strict": true,
    "noImplicitAny": false,
    "esModuleInterop": true,
    "jsx": "preserve",
    "skipLibCheck": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "noUnusedLocals": true,
    "strictNullChecks": true,
    "allowJs": true,
    "forceConsistentCasingInFileNames": true,
    "typeRoots": ["./node_modules/@types", "./src/types"],
    "types": ["vitest", "vitest/globals", "vite/client", "vue/ref-macros"]
  }
}

File to include/exclude I have configured within SonarCloud GUI panel.

Here is how my bitbucket-pipelines.yml sonarcloud step is configured:

definitions:
  services:
    docker:
      memory: 4096
 ... rest code
  - step: &scan-sonarcloud
        name: Run SonarCloud scan
        services:
          - docker
        caches:
          - sonar
        size: 2x
        script:
          - pipe: sonarsource/sonarcloud-scan:1.4.0
            variables:
              SONAR_SCANNER_OPTS: -Xmx4096m
              EXTRA_ARGS: -Dproject.settings=sonar-project.properties
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.6
        artifacts:
          - test-reports/**
          - .env

What else could be going wrong with my bitbucket build sonarcloud step execution time being so long?

Hi @ThedX,

From what I see your configuration seems fine. Can you please try increasing memory for docker?

      services:
        docker:
          memory: 7168

Please let me know if that helps.

Victor

Unfortunately, this does not solve my issue.

Increased docker memory did not had any of impact related to the count of files being analysed per single iteration. At the moment, single iteration scans between 1-20 files so it takes a huge amount of time for the actual scan to complete.

Could you elaborate, who determines the quantity of files to be analysed per single iteration? As I’m trying to find out the way to reduce the time Sonar analyses spends per single deployment, as of now, it takes around 30-50 minutes for analyses to be completed.

P.S. Forgot to mention, that my BE repo Sonar analyses for laravel project, it takes around 5 minutes and the analyzed files per single iteration is around 200-500.

Hello @ThedX,

sorry, I don’t understand what you mean by iteration. If you mean the diff in analyzed files between logged lines, that’s just printing the status every 10 seconds. Files are always analyzed one by one. So the problem is that each file is taking too long.

Could you please enable debug logs and share them with me? You can send them privately to me if you prefer.

Thanks,
Victor

Here are some of the logs that appear after the scanner starts. I’ve tried to pick the relevant ones

13:52:24.580 INFO: 2287 source files to be analyzed
13:52:24.580 DEBUG: Files which didn't change will be part of UCFG generation only, other rules will not be executed
13:52:24.581 INFO: Resolving TSConfig files using 'tsconfig.sonar.json' from property sonar.typescript.tsconfigPaths
13:52:24.581 DEBUG: Using 'tsconfig.sonar.json' to resolve TSConfig file(s)
13:52:24.583 INFO: Found 1 TSConfig file(s): [/opt/atlassian/pipelines/agent/build/tsconfig.sonar.json]
13:52:24.609 DEBUG: Initializing linter "default" with no-vue-bypass-sanitization,hashing,for-loop-increment-sign,no-globals-shadowing,null-dereference,unverified-hostname,no-extra-arguments,no-redeclare,constructor-for-side-effects,post-message,cookie-no-httponly,weak-ssl,no-useless-increment,no-throw-literal,no-ignored-exceptions,pseudo-random,no-use-of-empty-return-value,session-regeneration,no-associative-arrays,no-weak-keys,confidential-information-logging,no-ip-forward,single-character-alternation,unused-named-groups,aws-ec2-unencrypted-ebs-volume,single-char-in-character-classes,dns-prefetching,arguments-order,inconsistent-function-call,no-same-argument-assert,certificate-transparency,file-uploads,no-inverted-boolean-check,sonar-no-misleading-character-class,duplicates-in-character-class,todo-tag,fixme-tag,aws-s3-bucket-public-access,aws-s3-bucket-granted-access,no-mixed-content,anchor-precedence,frame-ancestors,no-angular-bypass-sanitization,array-callback-without-return,slow-regex,prefer-default-last,no-mime-sniff,no-commented-code,no-gratuitous-expressions,no-empty-pattern,sonar-no-fallthrough,no-referrer-policy,sonar-no-invalid-regexp,strict-transport-security,aws-iam-public-access,no-unsafe-finally,prefer-while,sonar-no-unused-vars,index-of-compare-to-positive-number,argument-type,empty-string-repetition,in-operator-type-error,prefer-promise-shorthand,regex-complexity,no-empty-after-reluctant,assertions-in-tests,no-intrusive-permissions,disabled-resource-integrity,content-security-policy,no-labels,no-uniq-key,aws-s3-bucket-server-encryption,no-unenclosed-multiline-block,call-argument-line,aws-s3-bucket-insecure-http,generator-without-yield,no-ignored-return,no-caller,csrf,cognitive-complexity,use-isnan,no-nested-template-literals,inverted-assertion-arguments,max-switch-cases,test-check-exception,production-debug,unused-import,prefer-single-boolean-return,no-redundant-boolean,no-nested-assignment,aws-s3-bucket-versioning,no-unsafe-unzip,sonar-prefer-regexp-exec,concise-regex,no-array-index-key,new-cap,jsx-key,updated-loop-counter,no-setter-return,no-unstable-nested-components,link-with-target-blank,different-types-comparison,no-case-label-in-switch,no-in-misuse,jsx-no-constructed-context-values,no-misleading-array-reverse,no-redundant-assignments,os-command,no-invariant-returns,no-parameter-reassignment,stateful-regex,aws-efs-unencrypted,aws-apigateway-public-api,aws-sqs-unencrypted-queue,no-accessor-field-mismatch,no-empty-group,cors,no-os-command-from-path,no-collection-size-mischeck,unverified-certificate,no-empty-collection,disabled-auto-escaping,updated-const-var,no-duplicate-imports,no-unthrown-error,no-var,no-redundant-jump,no-octal,no-hardcoded-ip,sonar-prefer-optional-chain,no-hook-setter-in-body,aws-restricted-ip-admin-access,no-useless-react-setstate,no-identical-functions,rules-of-hooks,no-element-overwrite,sonar-no-unused-class-component-methods,prefer-regex-literals,sonar-no-regex-spaces,no-empty-alternatives,no-same-line-conditional,sonar-no-control-regex,aws-ec2-rds-dms-public,super-invocation,aws-sns-unencrypted-topics,no-try-promise,existing-groups,void-use,comma-or-logical-or-case,label-position,no-with,insecure-cookie,no-unused-collection,no-extraneous-class,no-base-to-string,no-sequences,require-render-return,no-global-this,sql-queries,no-array-delete,prefer-string-starts-ends-with,no-alphabetical-sort,sonar-jsx-no-leaked-render,prefer-for-of,aws-sagemaker-unencrypted-notebook,jsx-no-comment-textnodes,aws-iam-privilege-escalation,xml-parser-xxe,default-param-last,non-existent-operator,new-operator-misuse,sonar-no-empty-character-class,no-sparse-arrays,content-length,no-clear-text-protocols,aws-rds-unencrypted-databases,no-invalid-await,no-equals-in-for-termination,no-infinite-loop,no-hardcoded-credentials,valid-typeof,no-misused-promises,aws-iam-all-privileges,aws-opensearchservice-domain,no-primitive-wrappers,no-exclusive-tests,sonar-no-dupe-keys,no-self-assign,no-new-symbol,no-dupe-args,no-small-switch,no-loss-of-precision,unnecessary-character-escapes,publicly-writable-directories,no-incomplete-assertions,no-unreachable,x-powered-by,no-identical-expressions,file-permissions,code-eval,no-useless-catch,future-reserved-words,bitwise-operators,hidden-files,no-unused-expressions,no-empty,no-unsafe-optional-chaining,sonar-max-params,no-duplicated-branches,no-extend-native,no-one-iteration-loop,misplaced-loop-counter,deprecation,no-unsafe-negation,function-inside-loop,no-multi-str,class-name,chai-determinate-assertion,no-code-after-done,sonar-block-scoped-var,no-delete-var,encryption-secure-mode,no-extra-bind,no-weak-cipher,no-identical-conditions,no-constant-binary-expression,no-constructor-return,function-return-type,no-all-duplicated-branches,disabled-timeout,no-nested-conditional,insecure-jwt-token,no-dead-store,no-extra-boolean-cast,no-implicit-global,no-empty-function,no-commented-code,sonar-no-fallthrough,no-inverted-boolean-check,duplicates-in-character-class,file-uploads,sonar-no-misleading-character-class,dns-prefetching,arguments-order,no-same-argument-assert,certificate-transparency,single-char-in-character-classes,aws-ec2-unencrypted-ebs-volume,unused-named-groups,no-unsafe-finally,prefer-while,single-character-alternation,aws-iam-public-access,prefer-nullish-coalescing,no-ip-forward,no-use-of-empty-return-value,session-regeneration,no-associative-arrays,no-weak-keys,confidential-information-logging,weak-ssl,no-useless-increment,no-throw-literal,no-ignored-exceptions,pseudo-random,no-redundant-optional,cookie-no-httponly,aws-s3-bucket-public-access,post-message,constructor-for-side-effects,no-globals-shadowing,unverified-hostname,hashing,for-loop-increment-sign,no-vue-bypass-sanitization,no-extra-boolean-cast,no-unnecessary-type-assertion,no-nested-conditional,insecure-jwt-token,no-dead-store,prefer-type-guard,use-type-alias,no-in-misuse,no-parameter-reassignment,no-unstable-nested-components,new-cap,jsx-key,prefer-function-type,updated-loop-counter,no-array-index-key,link-with-target-blank,concise-regex,sonar-prefer-regexp-exec,prefer-as-const,stateful-regex,test-check-exception,max-switch-cases,production-debug,no-undefined-argument,csrf,cognitive-complexity,no-labels,use-isnan,no-nested-template-literals,inverted-assertion-arguments,no-duplicate-in-composite,aws-s3-bucket-insecure-http,generator-without-yield,no-ignored-return,no-caller,aws-s3-bucket-server-encryption,no-unenclosed-multiline-block,call-argument-line,no-uniq-key,jsx-no-constructed-context-values,no-redundant-boolean,content-security-policy,prefer-promise-shorthand,regex-complexity,no-empty-after-reluctant,assertions-in-tests,no-intrusive-permissions,disabled-resource-integrity,unused-import,empty-string-repetition,no-nested-assignment,index-of-compare-to-positive-number,no-unsafe-unzip,aws-s3-bucket-versioning,todo-tag,strict-transport-security,prefer-default-last,no-mime-sniff,no-gratuitous-expressions,no-empty-pattern,no-referrer-policy,sonar-no-invalid-regexp,no-mixed-content,anchor-precedence,no-angular-bypass-sanitization,frame-ancestors,slow-regex,fixme-tag,aws-s3-bucket-granted-access,sonar-no-empty-character-class,non-existent-operator,new-operator-misuse,no-small-switch,jsx-no-comment-textnodes,aws-iam-privilege-escalation,prefer-for-of,aws-sagemaker-unencrypted-notebook,sonar-jsx-no-leaked-render,xml-parser-xxe,default-param-last,no-global-this,sql-queries,no-array-delete,no-alphabetical-sort,prefer-string-starts-ends-with,require-render-return,prefer-literal-enum-member,no-sequences,void-use,no-octal,no-hardcoded-ip,comma-or-logical-or-case,existing-groups,label-position,no-unnecessary-type-constraint,aws-sns-unencrypted-topics,super-invocation,no-try-promise,aws-ec2-rds-dms-public,sonar-no-control-regex,no-empty-alternatives,prefer-return-this-type,sonar-no-regex-spaces,no-confusing-non-null-assertion,no-same-line-conditional,prefer-regex-literals,sonar-no-unused-class-component-methods,rules-of-hooks,no-useless-react-setstate,no-identical-functions,redundant-type-aliases,no-hook-setter-in-body,no-element-overwrite,aws-restricted-ip-admin-access,no-equals-in-for-termination,no-sparse-arrays,no-var,no-redundant-jump,no-duplicate-imports,no-unthrown-error,no-os-command-from-path,prefer-namespace-keyword,no-collection-size-mischeck,unverified-certificate,no-empty-collection,no-duplicate-enum-values,disabled-auto-escaping,no-empty-group,prefer-enum-initializers,aws-sqs-unencrypted-queue,aws-apigateway-public-api,no-accessor-field-mismatch,cors,aws-efs-unencrypted,insecure-cookie,no-unused-collection,no-redundant-type-constituents,no-extraneous-class,no-invariant-returns,no-case-label-in-switch,os-command,no-misleading-array-reverse,no-mixed-enums,no-redundant-assignments,sonar-prefer-optional-chain,no-all-duplicated-branches,no-identical-conditions,no-extra-bind,no-weak-cipher,no-constant-binary-expression,no-constructor-return,no-delete-var,encryption-secure-mode,no-useless-intersection,sonar-block-scoped-var,no-empty-function,no-code-after-done,no-unsafe-negation,deprecation,misplaced-loop-counter,no-one-iteration-loop,no-multi-str,function-inside-loop,no-import-assign,no-unsafe-optional-chaining,no-extend-native,no-duplicated-branches,disabled-timeout,bitwise-operators,class-name,code-eval,no-identical-expressions,no-unreachable,no-useless-catch,x-powered-by,file-permissions,publicly-writable-directories,unnecessary-character-escapes,no-incomplete-assertions,chai-determinate-assertion,sonar-no-dupe-keys,no-primitive-wrappers,no-exclusive-tests,aws-opensearchservice-domain,no-self-assign,no-misused-promises,no-misused-new,aws-iam-all-privileges,no-invalid-await,no-hardcoded-credentials,aws-rds-unencrypted-databases,content-length,no-clear-text-protocols,no-empty,sonar-max-params,hidden-files,no-unused-expressions,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg
13:52:24.645 DEBUG: Loaded rules ucfg from /opt/atlassian/pipelines/agent/build/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules11941453421051383377/package
13:52:24.645 DEBUG: Creating linter config
13:52:24.656 DEBUG: Linter config: {"language":"js","fileType":"MAIN"} with anchor-precedence,argument-type,arguments-order,array-callback-without-return,aws-apigateway-public-api,aws-ec2-rds-dms-public,aws-ec2-unencrypted-ebs-volume,aws-efs-unencrypted,aws-iam-all-privileges,aws-iam-privilege-escalation,aws-iam-public-access,aws-opensearchservice-domain,aws-rds-unencrypted-databases,aws-restricted-ip-admin-access,aws-s3-bucket-granted-access,aws-s3-bucket-insecure-http,aws-s3-bucket-public-access,aws-s3-bucket-server-encryption,aws-s3-bucket-versioning,aws-sagemaker-unencrypted-notebook,aws-sns-unencrypted-topics,aws-sqs-unencrypted-queue,bitwise-operators,call-argument-line,certificate-transparency,class-name,code-eval,cognitive-complexity,comma-or-logical-or-case,concise-regex,confidential-information-logging,constructor-for-side-effects,content-length,content-security-policy,cookie-no-httponly,cors,csrf,default-param-last,deprecation,different-types-comparison,disabled-auto-escaping,disabled-resource-integrity,dns-prefetching,duplicates-in-character-class,empty-string-repetition,encryption-secure-mode,existing-groups,file-permissions,file-uploads,fixme-tag,for-loop-increment-sign,frame-ancestors,function-inside-loop,function-return-type,future-reserved-words,generator-without-yield,hashing,hidden-files,in-operator-type-error,inconsistent-function-call,index-of-compare-to-positive-number,insecure-cookie,insecure-jwt-token,jsx-key,jsx-no-comment-textnodes,jsx-no-constructed-context-values,label-position,link-with-target-blank,max-switch-cases,misplaced-loop-counter,new-cap,new-operator-misuse,no-accessor-field-mismatch,no-all-duplicated-branches,no-alphabetical-sort,no-angular-bypass-sanitization,no-array-delete,no-array-index-key,no-associative-arrays,no-base-to-string,no-caller,no-case-label-in-switch,no-clear-text-protocols,no-collection-size-mischeck,no-commented-code,no-constant-binary-expression,no-constructor-return,no-dead-store,no-delete-var,no-dupe-args,no-duplicate-imports,no-duplicated-branches,no-element-overwrite,no-empty,no-empty-after-reluctant,no-empty-alternatives,no-empty-collection,no-empty-function,no-empty-group,no-empty-pattern,no-equals-in-for-termination,no-extend-native,no-extra-arguments,no-extra-bind,no-extra-boolean-cast,no-extraneous-class,no-global-this,no-globals-shadowing,no-gratuitous-expressions,no-hardcoded-credentials,no-hardcoded-ip,no-hook-setter-in-body,no-identical-conditions,no-identical-expressions,no-identical-functions,no-ignored-return,no-implicit-global,no-in-misuse,no-infinite-loop,no-intrusive-permissions,no-invalid-await,no-invariant-returns,no-inverted-boolean-check,no-ip-forward,no-labels,no-loss-of-precision,no-mime-sniff,no-misleading-array-reverse,no-misused-promises,no-mixed-content,no-multi-str,no-nested-assignment,no-nested-conditional,no-nested-template-literals,no-new-symbol,no-octal,no-one-iteration-loop,no-os-command-from-path,no-parameter-reassignment,no-primitive-wrappers,no-redeclare,no-redundant-assignments,no-redundant-boolean,no-redundant-jump,no-referrer-policy,no-same-line-conditional,no-self-assign,no-sequences,no-setter-return,no-small-switch,no-sparse-arrays,no-throw-literal,no-try-promise,no-unenclosed-multiline-block,no-uniq-key,no-unreachable,no-unsafe-finally,no-unsafe-negation,no-unsafe-optional-chaining,no-unsafe-unzip,no-unstable-nested-components,no-unthrown-error,no-unused-collection,no-unused-expressions,no-use-of-empty-return-value,no-useless-catch,no-useless-increment,no-useless-react-setstate,no-var,no-vue-bypass-sanitization,no-weak-cipher,no-weak-keys,no-with,non-existent-operator,null-dereference,os-command,post-message,prefer-default-last,prefer-for-of,prefer-promise-shorthand,prefer-regex-literals,prefer-single-boolean-return,prefer-string-starts-ends-with,prefer-while,production-debug,pseudo-random,publicly-writable-directories,regex-complexity,require-render-return,rules-of-hooks,session-regeneration,single-char-in-character-classes,single-character-alternation,slow-regex,sonar-block-scoped-var,sonar-jsx-no-leaked-render,sonar-max-params,sonar-no-control-regex,sonar-no-dupe-keys,sonar-no-empty-character-class,sonar-no-fallthrough,sonar-no-invalid-regexp,sonar-no-misleading-character-class,sonar-no-regex-spaces,sonar-no-unused-class-component-methods,sonar-no-unused-vars,sonar-prefer-optional-chain,sonar-prefer-regexp-exec,sql-queries,stateful-regex,strict-transport-security,super-invocation,todo-tag,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,unnecessary-character-escapes,unused-import,unused-named-groups,unverified-certificate,unverified-hostname,updated-const-var,updated-loop-counter,use-isnan,valid-typeof,void-use,weak-ssl,x-powered-by,xml-parser-xxe
13:52:24.656 DEBUG: Linter config: {"language":"js","fileType":"TEST"} with assertions-in-tests,chai-determinate-assertion,disabled-timeout,inverted-assertion-arguments,no-code-after-done,no-exclusive-tests,no-ignored-exceptions,no-incomplete-assertions,no-same-argument-assert,test-check-exception
13:52:24.657 DEBUG: Linter config: {"language":"ts","fileType":"MAIN"} with anchor-precedence,arguments-order,aws-apigateway-public-api,aws-ec2-rds-dms-public,aws-ec2-unencrypted-ebs-volume,aws-efs-unencrypted,aws-iam-all-privileges,aws-iam-privilege-escalation,aws-iam-public-access,aws-opensearchservice-domain,aws-rds-unencrypted-databases,aws-restricted-ip-admin-access,aws-s3-bucket-granted-access,aws-s3-bucket-insecure-http,aws-s3-bucket-public-access,aws-s3-bucket-server-encryption,aws-s3-bucket-versioning,aws-sagemaker-unencrypted-notebook,aws-sns-unencrypted-topics,aws-sqs-unencrypted-queue,bitwise-operators,call-argument-line,certificate-transparency,class-name,code-eval,cognitive-complexity,comma-or-logical-or-case,concise-regex,confidential-information-logging,constructor-for-side-effects,content-length,content-security-policy,cookie-no-httponly,cors,csrf,default-param-last,deprecation,disabled-auto-escaping,disabled-resource-integrity,dns-prefetching,duplicates-in-character-class,empty-string-repetition,encryption-secure-mode,existing-groups,file-permissions,file-uploads,fixme-tag,for-loop-increment-sign,frame-ancestors,function-inside-loop,generator-without-yield,hashing,hidden-files,index-of-compare-to-positive-number,insecure-cookie,insecure-jwt-token,jsx-key,jsx-no-comment-textnodes,jsx-no-constructed-context-values,label-position,link-with-target-blank,max-switch-cases,misplaced-loop-counter,new-cap,new-operator-misuse,no-accessor-field-mismatch,no-all-duplicated-branches,no-alphabetical-sort,no-angular-bypass-sanitization,no-array-delete,no-array-index-key,no-associative-arrays,no-caller,no-case-label-in-switch,no-clear-text-protocols,no-collection-size-mischeck,no-commented-code,no-confusing-non-null-assertion,no-constant-binary-expression,no-constructor-return,no-dead-store,no-delete-var,no-duplicate-enum-values,no-duplicate-imports,no-duplicate-in-composite,no-duplicated-branches,no-element-overwrite,no-empty,no-empty-after-reluctant,no-empty-alternatives,no-empty-collection,no-empty-function,no-empty-group,no-empty-pattern,no-equals-in-for-termination,no-extend-native,no-extra-bind,no-extra-boolean-cast,no-extraneous-class,no-global-this,no-globals-shadowing,no-gratuitous-expressions,no-hardcoded-credentials,no-hardcoded-ip,no-hook-setter-in-body,no-identical-conditions,no-identical-expressions,no-identical-functions,no-ignored-return,no-import-assign,no-in-misuse,no-intrusive-permissions,no-invalid-await,no-invariant-returns,no-inverted-boolean-check,no-ip-forward,no-labels,no-mime-sniff,no-misleading-array-reverse,no-misused-new,no-misused-promises,no-mixed-content,no-mixed-enums,no-multi-str,no-nested-assignment,no-nested-conditional,no-nested-template-literals,no-octal,no-one-iteration-loop,no-os-command-from-path,no-parameter-reassignment,no-primitive-wrappers,no-redundant-assignments,no-redundant-boolean,no-redundant-jump,no-redundant-optional,no-redundant-type-constituents,no-referrer-policy,no-same-line-conditional,no-self-assign,no-sequences,no-small-switch,no-sparse-arrays,no-throw-literal,no-try-promise,no-undefined-argument,no-unenclosed-multiline-block,no-uniq-key,no-unnecessary-type-assertion,no-unnecessary-type-constraint,no-unreachable,no-unsafe-finally,no-unsafe-negation,no-unsafe-optional-chaining,no-unsafe-unzip,no-unstable-nested-components,no-unthrown-error,no-unused-collection,no-unused-expressions,no-use-of-empty-return-value,no-useless-catch,no-useless-increment,no-useless-intersection,no-useless-react-setstate,no-var,no-vue-bypass-sanitization,no-weak-cipher,no-weak-keys,non-existent-operator,os-command,post-message,prefer-as-const,prefer-default-last,prefer-enum-initializers,prefer-for-of,prefer-function-type,prefer-literal-enum-member,prefer-namespace-keyword,prefer-nullish-coalescing,prefer-promise-shorthand,prefer-regex-literals,prefer-return-this-type,prefer-string-starts-ends-with,prefer-type-guard,prefer-while,production-debug,pseudo-random,publicly-writable-directories,redundant-type-aliases,regex-complexity,require-render-return,rules-of-hooks,session-regeneration,single-char-in-character-classes,single-character-alternation,slow-regex,sonar-block-scoped-var,sonar-jsx-no-leaked-render,sonar-max-params,sonar-no-control-regex,sonar-no-dupe-keys,sonar-no-empty-character-class,sonar-no-fallthrough,sonar-no-invalid-regexp,sonar-no-misleading-character-class,sonar-no-regex-spaces,sonar-no-unused-class-component-methods,sonar-prefer-optional-chain,sonar-prefer-regexp-exec,sql-queries,stateful-regex,strict-transport-security,super-invocation,todo-tag,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,ucfg,unnecessary-character-escapes,unused-import,unused-named-groups,unverified-certificate,unverified-hostname,updated-loop-counter,use-isnan,use-type-alias,void-use,weak-ssl,x-powered-by,xml-parser-xxe
13:52:24.657 DEBUG: Linter config: {"language":"ts","fileType":"TEST"} with assertions-in-tests,chai-determinate-assertion,disabled-timeout,inverted-assertion-arguments,no-code-after-done,no-exclusive-tests,no-ignored-exceptions,no-incomplete-assertions,no-same-argument-assert,test-check-exception
13:52:24.663 DEBUG: Initializing linter "unchanged" with ucfg
13:52:24.664 DEBUG: Loaded rules ucfg from /opt/atlassian/pipelines/agent/build/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules11941453421051383377/package
13:52:24.664 DEBUG: Creating linter config
13:52:24.664 DEBUG: Linter config: {"language":"ts","fileType":"MAIN"} with ucfg
13:52:24.675 DEBUG: Cache strategy set to 'WRITE_ONLY' for file 'src/components/MainLayout.vue' as the current file is changed
13:52:24.675 DEBUG: Analyzing file: file:///opt/atlassian/pipelines/agent/build/src/components/MainLayout.vue
13:52:24.679 DEBUG: Analyzing file "/opt/atlassian/pipelines/agent/build/src/components/MainLayout.vue" with linterId "unchanged"
13:52:34.585 INFO: 1/1287 file analyzed, current file: /opt/atlassian/pipelines/agent/build/src/components/MainLayout.vue
13:52:38.135 DEBUG: Using linter configuration for {"fileType":"MAIN","language":"ts"}
13:52:38.200 DEBUG: Not enough content in 'src/components/MainLayout.vue' to have CPD blocks, it will not be part of the duplication detection
13:52:38.201 DEBUG: Cache entry created for key 'jssecurity:ucfgs:SEQ:10.3.1.21905:proj-frontend:src/components/MainLayout.vue' containing 1 file(s)
13:52:38.203 DEBUG: Cache entry created for key 'jssecurity:ucfgs:JSON:10.3.1.21905:proj-frontend:src/components/MainLayout.vue'
13:52:38.205 DEBUG: Cache entry created for key 'js:filemetadata:10.3.1.21905:proj-frontend:src/components/MainLayout.vue'
13:52:38.208 DEBUG: Cache strategy set to 'WRITE_ONLY' for file 'src/store/useTimer.spec.ts' as the current file is changed
13:52:38.208 DEBUG: Analyzing file: file:///opt/atlassian/pipelines/agent/build/src/store/useTimer.spec.ts
13:52:38.210 DEBUG: Analyzing file "/opt/atlassian/pipelines/agent/build/src/store/useTimer.spec.ts" with linterId "unchanged"
13:52:38.227 DEBUG: Using linter configuration for {"fileType":"MAIN","language":"ts"}
13:52:38.284 DEBUG: Cache entry created for key 'jssecurity:ucfgs:SEQ:10.3.1.21905:proj-frontend:src/store/useTimer.spec.ts' containing 1 file(s)
13:52:38.284 DEBUG: Cache entry created for key 'jssecurity:ucfgs:JSON:10.3.1.21905:proj-frontend:src/store/useTimer.spec.ts'
13:52:38.285 DEBUG: Cache entry created for key 'js:filemetadata:10.3.1.21905:proj-frontend:src/store/useTimer.spec.ts'
13:52:38.288 DEBUG: Cache strategy set to 'WRITE_ONLY' for file 'src/features/useResizable.ts' as the current file is changed
13:52:38.288 DEBUG: Analyzing file: file:///opt/atlassian/pipelines/agent/build/src/features/useResizable.ts
13:52:38.290 DEBUG: Analyzing file "/opt/atlassian/pipelines/agent/build/src/features/useResizable.ts" with linterId "unchanged"
13:52:38.309 DEBUG: Using linter configuration for {"fileType":"MAIN","language":"ts"}
13:52:38.365 DEBUG: Cache entry created for key 'jssecurity:ucfgs:SEQ:10.3.1.21905:proj-frontend:src/features/useResizable.ts' containing 1 file(s)
13:52:38.366 DEBUG: Cache entry created for key 'jssecurity:ucfgs:JSON:10.3.1.21905:proj-frontend:src/features/useResizable.ts'
13:52:38.368 DEBUG: Cache entry created for key 'js:filemetadata:10.3.1.21905:proj-frontend:src/features/useResizable.ts'
13:52:38.370 DEBUG: Cache strategy set to 'WRITE_ONLY' for file 'src/components/OrganisationUserListFilters.vue' as the current file is changed
13:52:17.811 DEBUG: 'src/components/MainLayout.spec.ts' indexed with language 'ts'
13:52:17.808 DEBUG: file=/opt/atlassian/pipelines/agent/build/.git/.probe-c94a5681-e56d-4e3a-b976-c98f9fa30bf5, isRacyClean=true, read=2023-07-04 13:52:17.807433000, lastModified=2023-07-04 13:52:17.803682000, delta=3751000 ns, racy<=2500000000 ns
13:52:17.811 DEBUG: file=/opt/atlassian/pipelines/agent/build/.git/.probe-c94a5681-e56d-4e3a-b976-c98f9fa30bf5, is racily clean
13:52:17.811 DEBUG: file=/opt/atlassian/pipelines/agent/build/.git/.probe-c94a5681-e56d-4e3a-b976-c98f9fa30bf5, create new FileSnapshot: lastRead=2023-07-04 13:52:17.811617000, lastModified=2023-07-04 13:52:17.807682000, size=1, fileKey=(dev=97f,ino=7997392)
13:52:17.811 DEBUG: file=/opt/atlassian/pipelines/agent/build/.git/.probe-c94a5681-e56d-4e3a-b976-c98f9fa30bf5, lastModified changed from 2023-07-04 13:52:17.807682000 to 2023-07-04 13:52:17.811683000
13:52:17.812 DEBUG: file=/opt/atlassian/pipelines/agent/build/.git/.probe-c94a5681-e56d-4e3a-b976-c98f9fa30bf5, create new FileSnapshot: lastRead=2023-07-04 13:52:17.812073000, lastModified=2023-07-04 13:52:17.811683000, size=1, fileKey=(dev=97f,ino=7997392)
13:52:17.812 DEBUG: file=/opt/atlassian/pipelines/agent/build/.git/.probe-c94a5681-e56d-4e3a-b976-c98f9fa30bf5, isRacyClean=true, read=2023-07-04 13:52:17.812073000, lastModified=2023-07-04 13:52:17.811683000, delta=390000 ns, racy<=2500000000 ns
13:52:17.812 DEBUG: file=/opt/atlassian/pipelines/agent/build/.git/.probe-c94a5681-e56d-4e3a-b976-c98f9fa30bf5, is racily clean
13:52:17.812 DEBUG: file=/opt/atlassian/pipelines/agent/build/.git/.probe-c94a5681-e56d-4e3a-b976-c98f9fa30bf5, create new FileSnapshot: lastRead=2023-07-04 13:52:17.812555000, lastModified=2023-07-04 13:52:17.811683000, size=1, fileKey=(dev=97f,ino=7997392)
13:52:17.812 DEBUG: file=/opt/atlassian/pipelines/agent/build/.git/.probe-c94a5681-e56d-4e3a-b976-c98f9fa30bf5, isRacyClean=true, read=2023-07-04 13:52:17.812555000, lastModified=2023-07-04 13:52:17.811683000, delta=872000 ns, racy<=2500000000 ns
13:52:17.812 DEBUG: file=/opt/atlassian/pipelines/agent/build/.git/.probe-c94a5681-e56d-4e3a-b976-c98f9fa30bf5, is racily clean

Hi @ThedX,

thanks for the logs. Everything seems fine so far. In your original post, you mention lately. Do you know the date the analysis started running longer? How long did it use to take before?

Also, can you try adding Vue files explicitly to see if it helps?

  "include": [
    "./**/*.ts",
    "./**/*.tsx",
    "./**/*.vue",
  ],

Cheers,
Victor

I don’t know the exact date, but it was couple of months ago, the analysis started running longer after I’ve migrated my application from Vue 3 + JavaScript to Vue 3.3 + TypeScript. The core problem was docker running out of memory during analyses, I’ve added a correct tsconfig.sonar.json file and managed to fix out of memory problems.

Previously analysis was completing in 2-6 minutes.

I’ve never had long running analysis in my CI/CD before the migration.

With the following updates to tsconfig.sonar.json file:

{
  "compilerOptions": {
    "module": "ESNext",
    "target": "ESNext",
    "lib": ["DOM", "ESNext"],
    "strict": true,
    "noImplicitAny": false,
    "esModuleInterop": true,
    "jsx": "preserve",
    "skipLibCheck": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "noUnusedLocals": true,
    "strictNullChecks": true,
    "allowJs": true,
    "forceConsistentCasingInFileNames": true,
    "typeRoots": ["./node_modules/@types", "./src/types"],
    "types": ["vitest", "vitest/globals", "vite/client", "vue/ref-macros"]
  },
  "include": ["./**/*.ts", "./**/*.tsx", "./**/*.vue"]
}

With the following updates to tsconfig.sonar.json, I see new interesting logs:

09:42:18.380 INFO: Sensor PythonSecuritySensor [security] (done) | time=0ms
09:42:18.380 INFO: Sensor JsSecuritySensor [security]
09:42:18.381 INFO: Reading type hierarchy from: /opt/atlassian/pipelines/agent/build/.scannerwork/ucfg2/js
09:42:18.397 INFO: Read 0 type definitions
09:42:18.399 INFO: Reading UCFGs from: /opt/atlassian/pipelines/agent/build/.scannerwork/ucfg2/js
09:42:18.502 DEBUG: Loaded 7 ucfgs from /opt/atlassian/pipelines/agent/build/.scannerwork/ucfg2/js/_opt_atlassian_pipelines_agent_build_src_App_vue.ucfgs
09:42:18.513 DEBUG: Loaded 4 ucfgs from /opt/atlassian/pipelines/agent/build/.scannerwork/ucfg2/js/_opt_atlassian_pipelines_agent_build_src_components_MainLayout_spec_ts.ucfgs
09:42:18.520 DEBUG: Loaded 4 ucfgs from /opt/atlassian/pipelines/agent/build/.scannerwork/ucfg2/js/_opt_atlassian_pipelines_agent_build_src_components_useResizable_vue.ucfgs
09:42:18.527 DEBUG: Loaded 5 ucfgs from /opt/atlassian/pipelines/agent/build/.scannerwork/ucfg2/js/_opt_atlassian_pipelines_agent_build_src_components_useStore_spec_ts.ucfgs
09:42:21.054 DEBUG: Resource file jssecurity-autogenerated/decoders/S6384.json was not read
09:42:21.054 DEBUG: Resource file jssecurity-autogenerated/decoders/S6390.json was not read
09:42:21.054 DEBUG: Resource file jssecurity-autogenerated/decoders/S6398.json was not read
09:42:21.054 DEBUG: Resource file jssecurity-autogenerated/decoders/S6399.json was not read
09:42:21.054 DEBUG: Resource file jssecurity-autogenerated/decoders/S6549.json was not read
09:42:21.054 DEBUG: Resource file jssecurity-autogenerated/decoders/S6547.json was not read
09:42:21.054 DEBUG: loaded 0 decoders.
09:42:23.101 INFO: Taint analysis starting. Entrypoints: 1063
09:42:23.106 INFO: Running symbolic analysis for 'JS'
09:42:23.204 DEBUG: Adding stub module adm-zip
09:42:23.204 DEBUG: Adding stub module @angular/core
09:42:23.205 DEBUG: Adding stub module any-shell-escape
09:42:23.205 DEBUG: Adding stub module async
09:42:23.207 DEBUG: Adding stub module aws-sdk
09:42:23.209 DEBUG: Adding stub module @aws-sdk/client-athena
09:42:23.209 DEBUG: Adding stub module @aws-sdk/client-rds-data
09:42:23.209 DEBUG: Adding stub module @aws-sdk/client-redshift-data
09:42:23.209 DEBUG: Adding stub module @aws-sdk/client-dynamodb
09:42:23.209 DEBUG: Adding stub module axios
09:42:23.215 DEBUG: Adding stub module beeline
09:42:23.216 DEBUG: Adding stub module better-sqlite3
09:42:23.216 DEBUG: Adding stub module bluebird
09:42:23.217 DEBUG: Adding stub module child_process
09:42:23.219 DEBUG: Adding stub module chokidar
09:42:23.219 DEBUG: Adding stub module chrome-remote-interface
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/common.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S2076.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S2078.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S2083.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S2091.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S2631.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S3649.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S5131.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S5135.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S5144.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S5145.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S5146.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S5147.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S5167.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S5334.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S5335.json was not read
09:42:21.022 DEBUG: Resource file jssecurity-autogenerated/passthroughs/S5496.json was not read
09:42:26.573 DEBUG: '[Deprecated] VB.NET Integration Tests Coverage Report Import' skipped because there is no related file in current project
09:42:26.574 DEBUG: 'VB.NET Unit Test Results Import' skipped because there is no related file in current project
09:42:26.574 DEBUG: 'Java CPD Block Indexer' skipped because there is no related file in current project
09:42:26.574 DEBUG: Sensors : Analysis Warnings import -> Zero Coverage Sensor
09:42:26.575 INFO: Sensor Analysis Warnings import [csharp]
09:42:26.575 INFO: Sensor Analysis Warnings import [csharp] (done) | time=0ms
09:42:26.576 INFO: Sensor Zero Coverage Sensor
09:42:26.694 INFO: Sensor Zero Coverage Sensor (done) | time=118ms
09:42:26.841 INFO: CPD Executor 227 files had no CPD blocks
09:42:26.842 INFO: CPD Executor Calculating CPD for 1060 files
09:42:26.842 DEBUG: Detection of duplications for /opt/atlassian/pipelines/agent/build/src/store/useStore.spec.ts
09:42:26.850 DEBUG: Detection of duplications for /opt/atlassian/pipelines/agent/build/src/routes/MainLayouts.ts
09:42:26.850 DEBUG: Detection of duplications for /opt/atlassian/pipelines/agent/build/src/routes/useResizable.ts
.... And many other files are being duplicated again

Hi @ThedX,

any improvement in the analysis time?

Can you also add .js and .jsx to the inclusions?

Cheers,
Victor

I’ve tried with .js and .jsx inclusion and the overall analysis time got improvement by 2-5 minutes

Hi @ThedX,

can you please send me the full logs as a file?

Thanks,
Victor

Sure, that sounds great!. How come I’m not able to private message you? Don’t see the possibility visiting your profile.

As a summary after private discussion, this is a project with many .vue files, which is performance-wise much slower than projects with just pure .ts files.

We managed to get small improvements with sonar.exclusions, but aside of that I’m afraid we cannot do better at this moment until we implement a new approach for Vue projects.

1 Like