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

Introducing deprecated code check in CI #3440

Merged
merged 4 commits into from
Jul 19, 2023
Merged

Introducing deprecated code check in CI #3440

merged 4 commits into from
Jul 19, 2023

Conversation

MohitMaliFtechiz
Copy link
Collaborator

@MohitMaliFtechiz MohitMaliFtechiz commented Jun 26, 2023

Fixes #3409

Since our project is a multi-module and previously we are using the wrong command of detekt, now we are using the updated command of detekt ./gradlew detektDebug detektCustomExampleDebug to check all issues in both modules.

  • We have introduced that if any deprecated code is found in the project then detekt will fail.
  • It also fails when we are committing in our local machine since we have updated the pre-commit.sh file.
  • We already have a Compat21 file to handle the deprecated code, which does not have any alternative. we will manage that code in this file.
  • We have suppressed the KiwixService file as we are using SimpleXmlConverterFactory and we do not have any alternative for this.
  • We have improved some deprecated rules of detekt.

@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as draft June 26, 2023 12:50
@codecov
Copy link

codecov bot commented Jun 26, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.01 ⚠️

Comparison is base (c49d8d8) 48.68% compared to head (3f6c997) 48.67%.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3440      +/-   ##
=============================================
- Coverage      48.68%   48.67%   -0.01%     
- Complexity      1011     1012       +1     
=============================================
  Files            285      285              
  Lines          10096    10095       -1     
  Branches        1348     1348              
=============================================
- Hits            4915     4914       -1     
  Misses          4399     4399              
  Partials         782      782              
Impacted Files Coverage Δ
...ava/org/kiwix/kiwixmobile/core/compat/CompatV21.kt 60.00% <ø> (-6.67%) ⬇️
...kiwix/kiwixmobile/core/data/remote/KiwixService.kt 100.00% <ø> (ø)

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@MohitMaliFtechiz MohitMaliFtechiz force-pushed the Issue#3409 branch 2 times, most recently from f656963 to 6e0c56b Compare June 28, 2023 13:48
@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as ready for review June 28, 2023 14:03
@MohitMaliFtechiz MohitMaliFtechiz force-pushed the Issue#3409 branch 2 times, most recently from 1c788f6 to 7a3c6a0 Compare June 29, 2023 10:32
@kelson42
Copy link
Collaborator

kelson42 commented Jun 30, 2023

@MohitMaliFtechiz I really wonder why the CI is green considering this branch is based on a version of gitv ain witj deprecated code!?

@MohitMaliFtechiz
Copy link
Collaborator Author

@kelson42, We have configured the CI failure if deprecated code is found in the assemble CI and that is failing right now since we have some deprecated code in our project. /~https://github.com/kiwix/kiwix-android/actions/runs/5411219667/jobs/9833687025?pr=3440

@kelson42
Copy link
Collaborator

kelson42 commented Jul 3, 2023

@MohitMaliFtechiz I want the code to fail for any deprecation scenario you have fixed in the last 3 weeks. I don't want to see deprecation warning at compilation time.

Copy link
Collaborator

@gouri-panda gouri-panda left a comment

Choose a reason for hiding this comment

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

@MohitMaliFtechiz After the discussion. We should go with Detekt custom rules for detecting the deprecated code. The current approach isn't viable for this issue.

@MohitMaliFtechiz
Copy link
Collaborator Author

@gouri-panda, I agree with you.

  • I used Detekt to address the usage of deprecated code in the project and updated the deprecated Detekt rules.
  • After conducting thorough research, I discovered that we were using the wrong detekt command to check for any issues. Since our project is a multi-module project, the detekt command does not work here. Instead, we need to use it separately for both the custom and app modules. More details can be found at this link: Detekt Issue #2038.
  • After updating the rules and implementing the aforementioned approach, Detekt identified additional issues that need to be fixed, such as "not using a double band operator" and "UnnecessaryAbstractClass".
  • However, this approach also includes the imports in the deprecation warning, which causes the build to fail. You can refer to the screenshot below for more information.

Screenshot from 2023-07-04 18-45-16

@MohitMaliFtechiz MohitMaliFtechiz force-pushed the Issue#3409 branch 2 times, most recently from ee62794 to 6e3e607 Compare July 4, 2023 13:38
@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as draft July 5, 2023 06:03
@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as ready for review July 6, 2023 13:59
@gouri-panda
Copy link
Collaborator

@MohitMaliFtechiz We should fix the detekt problem before we merge that. Otherwise, code looks good.

@gouri-panda gouri-panda self-requested a review July 12, 2023 19:46
@kelson42
Copy link
Collaborator

I guess we need to merge #3447 first?!

@gouri-panda
Copy link
Collaborator

gouri-panda commented Jul 18, 2023

@kelson42 Yes, hopefully #3447 will solve the problem.

…he issues in project, and refactored deprecated rules of detekt
…ompat21 file because we are handling the deprecated code within it. Therefore, we don't want Detekt to check this file for deprecations.
@kelson42 kelson42 merged commit 8a105ae into develop Jul 19, 2023
@kelson42 kelson42 deleted the Issue#3409 branch July 19, 2023 06:09
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.

Create CI check to identify usage of deprecated classes or methods
4 participants