Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linter CI #1301

Merged
merged 1 commit into from
Dec 19, 2023
Merged

Conversation

mengweieric
Copy link
Collaborator

@mengweieric mengweieric commented Dec 15, 2023

Description

Add linter CI to lint only changed files including

  • *.ts,
  • *.tsx
  • *.js

The linting will be ran only on changes matching above patterns in that PR.

Sample linting run result
https://github.com/mengweieric/dashboards-observability/actions/runs/7215956806/job/19661217812#step:8:1

Sample annotation when linting errors found
mengweieric@3052873#diff-2790e5916efcabbaa1ad67efe53928cc72a31ecdf3094cfd0c9582471f91530eL85

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Dec 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3c57327) 56.32% compared to head (280a8d7) 56.32%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1301   +/-   ##
=======================================
  Coverage   56.32%   56.32%           
=======================================
  Files         327      327           
  Lines       11944    11944           
  Branches     2741     2741           
=======================================
  Hits         6728     6728           
  Misses       5171     5171           
  Partials       45       45           
Flag Coverage Δ
dashboards-observability 56.32% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@RyanL1997 RyanL1997 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mengweieric, thanks for putting this together. I just left some comments

.github/workflows/lint.yml Outdated Show resolved Hide resolved
.github/workflows/lint.yml Show resolved Hide resolved
.github/workflows/lint.yml Outdated Show resolved Hide resolved
.github/workflows/lint.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@RyanL1997 RyanL1997 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

.eslintrc.js Show resolved Hide resolved
working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}
run: |
git fetch origin main
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB origin/main | grep -E "\.(js|ts|tsx)$")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why --diff-filter? seems unnecessary

Copy link
Collaborator Author

@mengweieric mengweieric Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for not including files that are deleted, and also with this it explicitly shows what are included and what are not. I actually tried before to run CI without these flags but it was getting errors, and it runs successfully after adding it back. without flags: https://github.com/mengweieric/dashboards-observability/actions/runs/7254224280/job/19762669894. Do you have any other suggestions that it can be written differently without those flags but do the work?

Copy link
Member

@joshuali925 joshuali925 Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you just want to exclude deleted, it should be --diff-filter=d?

also you are right it'll cause issues with deleted files

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --diff-filter we specify here are actually specifying what we select from git diff if I'm not mistaken: https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203, therefore here without 'D' we skipped deleted files but select all others.

.github/workflows/lint.yml Show resolved Hide resolved
@mengweieric mengweieric force-pushed the feature/CI-linting branch 3 times, most recently from 7e6a421 to 84f4cc1 Compare December 19, 2023 00:22
Signed-off-by: Eric <menwe@amazon.com>
@mengweieric mengweieric merged commit 994ae0e into opensearch-project:main Dec 19, 2023
11 of 18 checks passed
mengweieric added a commit to mengweieric/dashboards-observability that referenced this pull request Dec 19, 2023
Signed-off-by: Eric <menwe@amazon.com>
mengweieric added a commit that referenced this pull request Dec 20, 2023
* linter CI (#1301)

Signed-off-by: Eric <menwe@amazon.com>

* change version to 2.x

Signed-off-by: Eric <menwe@amazon.com>

* add missing scripts

Signed-off-by: Eric <menwe@amazon.com>

---------

Signed-off-by: Eric <menwe@amazon.com>
mengweieric added a commit to mengweieric/dashboards-observability that referenced this pull request Dec 22, 2023
Signed-off-by: Eric <menwe@amazon.com>
@mengweieric mengweieric deleted the feature/CI-linting branch February 14, 2024 18:29
RyanL1997 added a commit to RyanL1997/dashboards-observability that referenced this pull request Apr 18, 2024
Signed-off-by: Ryan Liang <jiallian@amazon.com>
amsiglan pushed a commit to amsiglan/dashboards-observability that referenced this pull request Jun 7, 2024
* linter CI (opensearch-project#1301)

Signed-off-by: Eric <menwe@amazon.com>

* change version to 2.x

Signed-off-by: Eric <menwe@amazon.com>

* add missing scripts

Signed-off-by: Eric <menwe@amazon.com>

---------

Signed-off-by: Eric <menwe@amazon.com>
(cherry picked from commit 138bd21)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants