Skip to content

Commit

Permalink
refactor: fix lint and formatting issues (#2024)
Browse files Browse the repository at this point in the history
* refactor: fix lint issues

* refactor: fix formatting issues

* fix: fixing eslint warnings

* feat: integrate sonar cloud scan

* fix: add the missing file

* fix: add eslint sonarjs package

* fix: update sonar cloud scan exclusion list

* fix: add cache option to eslint command

* refactor: fix lint issues

* refactor: fix formatting issues

* fix: fixing eslint warnings

* feat: integrate sonar cloud scan

* fix: add the missing file

* fix: add eslint sonarjs package

* fix: update sonar cloud scan exclusion list

* fix: add cache option to eslint command

* fix: add missing files in the recent merge

* chore: remove deepsource configuration

* chore: format code

* chore: fix additional linting issues

* fix: issues to make tests pass

* chore: replace map with forEach

* chore: add .eslintcache to .gitignore

* refactor: reduce cognitive complexity of a utility method

* refactor: reduce cognitive complexity

* chore: add lint fix job to the workflows

* refactor: fixing issues for freshsales freshmarketers and facebook dests

* refactor: fixing issues for active campaign adobe adj and newrelic

* refactor: webengage, tiktok, snapchat, adobe issue address

* refactor: remove warnings related to switch

* refactor: fix cognitive errors, remove warnings related to switch-2

* refactor: fix GAOC issues

* feat: upload reports irrespective of lint check failures

* refactor: customerio, active campaign refactor issue address

* refactor: iterable refactor issue address

* refactor: profitwell refactor issue address

* refactor: monetate refactor issue address

* refactor: ga refactor issue address

* refactor: fbPixel refactor issue address

* refactor: braze refactor issue address

* refactor: fixing refactor issue of gaoc

* refactor: unit tests added for braze, customerio, fbpixel, ga, gaoc, iterable, monetate, profitwell

* refactor: unit tests edited profitwell

* refactor: eslint issue fix

* chore: ci/cd sonar cloud version change

* refactor: fixing shopify sources according to develop

* refactor: fixing resolve conflicts

* refactor: undefined issue solve

* refactor: undefined issue solve for facebook pixel

* refactor: undefined issue solve for facebook pixel

* refactor: removing unused constant for criteo audience

* chore: format and lint code

* chore: format and lint ts files

* fix: add missing file

* refactor: temporary switch off some lint rules, to be addressed in the following PR

* Revert "refactor: temporary switch off some lint rules, to be addressed in the following PR"

This reverts commit 1c0a879.

* refactor: temporary switch off some lint rules, to be addressed in the following PR

* refactor: test case failure edis

* refactor: env file missing field addition

* refactor: removing unnecessary files of braze

* refactor: remove extra log

---------

Co-authored-by: shrouti1507 <[email protected]>
Co-authored-by: shrouti1507 <[email protected]>
Co-authored-by: Yashasvi Bajpai <[email protected]>
  • Loading branch information
4 people authored May 4, 2023
1 parent 71c1e7a commit 30160a7
Show file tree
Hide file tree
Showing 345 changed files with 22,305 additions and 13,947 deletions.
14 changes: 0 additions & 14 deletions .deepsource.toml

This file was deleted.

1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*
!src
!features.json
!Makefile
!jest*.js
!benchmark
Expand Down
12 changes: 8 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
node_modules/
.husky/
reports/
test/
benchmark/
dist/
**/warehouse/
**/lambda/
**/openfaas/
*.md
*.test.js
test/**/*.js
*.test.ts
src/util/lodash-es-core.js
**/ivm*.js
**/custom*.js
**/warehouse/
**/lambda/
**/openfaas/
src/util/url-search-params.min.js
src/logger.js
src/util/eventValidations.js
**/trackingPlan*
src/v0/destinations/personalize/scripts/
test/integrations/destinations/testTypes.d.ts
*.config*.js
34 changes: 29 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
"jest": true,
"commonjs": true
},
"extends": ["airbnb-base", "prettier", "plugin:json/recommended"],
"plugins": ["unicorn"],
"extends": ["airbnb-base", "airbnb-typescript/base", "plugin:sonarjs/recommended", "prettier", "plugin:json/recommended", "plugin:@typescript-eslint/recommended"],
"plugins": ["@typescript-eslint", "unicorn"],
"globals": {},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"unicorn/filename-case": [
Expand All @@ -19,7 +21,7 @@
],
"unicorn/no-instanceof-array": "error",
"unicorn/no-static-only-class": "error",
"unicorn/consistent-destructuring": "error",
"unicorn/consistent-destructuring": "off",
"unicorn/better-regex": "error",
"unicorn/no-for-loop": "error",
"unicorn/prefer-array-some": "error",
Expand All @@ -32,6 +34,28 @@
"unicorn/no-useless-length-check": "error",
"unicorn/prefer-export-from": "error",
"import/no-dynamic-require": "warn",
"no-param-reassign": "warn"
"no-param-reassign": "warn",
"sonarjs/prefer-immediate-return": "off",
"sonarjs/no-nested-template-literals": "off",
"sonarjs/max-switch-cases": "off",
"sonarjs/no-small-switch": "warn",
"sonarjs/cognitive-complexity": ["error", 60],
"@typescript-eslint/no-var-requires": "off",
"global-require": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/ban-types": "off",
"class-methods-use-this":"off",
"@typescript-eslint/return-await": "off",
"import/prefer-default-export": "off",
"sonarjs/no-ignored-return": "off",
"no-new": "off",
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/no-loop-func": "off",
"sonarjs/no-same-line-conditional": "off",
"no-restricted-syntax": "off",
"sonarjs/no-duplicate-string": "off",
"sonarjs/no-identical-functions": "off",
"no-prototype-builtins":"off"
}
}

1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Create a report to help us improve
title: 'BUG: '
labels: ''
assignees: ItsSudip, krishna2020, sandeepdsvs, shrouti1507

---

**Describe the bug**
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-pr-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ jobs:
GIT_COMMIT_SHA=${{ github.sha }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/draft-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
run: |
echo "Current version: $CURRENT_VERSION_VALUE"
echo "New version: $NEW_VERSION_VALUE"
npx replace $CURRENT_VERSION_VALUE $NEW_VERSION_VALUE sonar-project.properties
git add sonar-project.properties
npm run release -- -a --skip.tag --no-verify
git push
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/prepare-for-dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,3 @@ jobs:
build-args: |
version=${{ steps.gen_tag_name.outputs.tag_name }}
GIT_COMMIT_SHA=${{ github.sha }}
3 changes: 1 addition & 2 deletions .github/workflows/prepare-for-prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ jobs:
create-pull-request:
name: Update Helm Charts For Production and Create Pull Request
runs-on: ubuntu-latest
needs: [ build-transformer-image, build-user-transformer-image ]
needs: [build-transformer-image, build-user-transformer-image]
env:
TAG_NAME: ${{ needs.build-transformer-image.outputs.tag_name }}
UT_TAG_NAME: ${{ needs.build-user-transformer-image.outputs.tag_name }}
Expand Down Expand Up @@ -241,4 +241,3 @@ jobs:
git push -u origin shared-transformer-$TAG_NAME
hub pull-request -m "chore: upgrade shared transformers to $TAG_NAME"
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-prod-rollback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ jobs:
git commit -m "chore: rollback shared transformers to ${{ steps.target-version.outputs.tag_name }}"
git push -u origin shared-transformer-rollback-${{ steps.target-version.outputs.tag_name }}
hub pull-request -m "chore: rollback shared transformers to ${{ steps.target-version.outputs.tag_name }}"
6 changes: 1 addition & 5 deletions .github/workflows/prepare-for-staging-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ jobs:
create-pull-request:
name: Update Helm Charts For Staging and Create Pull Request
runs-on: ubuntu-latest
needs: [ build-transformer-image, build-user-transformer-image ]
needs: [build-transformer-image, build-user-transformer-image]
env:
TAG_NAME: ${{ needs.build-transformer-image.outputs.tag_name }}
UT_TAG_NAME: ${{ needs.build-user-transformer-image.outputs.tag_name }}
Expand Down Expand Up @@ -231,7 +231,3 @@ jobs:
git push -u origin $BRANCH_NAME
hub pull-request -m "chore: upgrade staging env transformers to \"$TAG_NAME\""
fi
1 change: 0 additions & 1 deletion .github/workflows/publish-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,3 @@ jobs:
}
]
}
21 changes: 20 additions & 1 deletion .github/workflows/report-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,28 @@ jobs:
run: npm ci

- name: Run Tests
run: npm run test:ci
run: |
npm run test:ci
- name: Run Lint Checks
run: |
npm run check:lint
npm run lint:fix
- name: Upload Coverage Reports to Codecov
uses: codecov/[email protected]
with:
directory: ./reports/coverage

- name: Fix filesystem paths in generated reports
if: always()
run: |
sed -i 's+home/runner/work/rudder-transformer/rudder-transformer+/github/workspace+g' reports/coverage/lcov.info
sed -i 's+/home/runner/work/rudder-transformer/rudder-transformer+/github/workspace+g' reports/eslint.json
- name: SonarCloud Scan
if: always()
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
node_modules
npm-debug.log
reports/*
dist
.eslintcache
dist

2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ __tests__/ @rudderlabs/integrations
__mocks__/ @rudderlabs/integrations
v0/ @rudderlabs/integrations
cdk/ @rudderlabs/integrations
features.json/ @rudderlabs/integrations
src/features.json @rudderlabs/integrations
constants/ @rudderlabs/integrations
warehouse/ @rudderlabs/warehouse
4 changes: 2 additions & 2 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': () => [2, 'always', ['fix', 'feat', 'chore', 'refactor', 'docs', 'test']]
}
'type-enum': () => [2, 'always', ['fix', 'feat', 'chore', 'refactor', 'docs', 'test']],
},
};
8 changes: 4 additions & 4 deletions github-release.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
gitRawCommitsOpts: {
merges: null
}
}
gitRawCommitsOpts: {
merges: null,
},
};
13 changes: 12 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,18 @@ module.exports = {
// projects: null,

// Use this configuration option to add custom reporters to Jest
// reporters: undefined,
reporters: [
'default',
[
'jest-sonar',
{
outputDirectory: 'reports/sonar',
outputName: 'results-report.xml',
reportedFilePath: 'relative',
relativeRootDir: './',
},
],
],

// Automatically reset mock state between every test
// resetMocks: false,
Expand Down
Loading

0 comments on commit 30160a7

Please sign in to comment.