hCaptcha/hcaptcha-android-sdk

Code Linting

DSergiu opened this issue · 3 comments

What

Extend pipeline to run ./gradlew lintRelease before the Build step.

Why

Obvious reasons.

How

More info in android docs.
It should report and stop the pipeline in case of:

  • unused dependencies
  • code smells?

We actually run lint on CI https://github.com/hCaptcha/hcaptcha-android-sdk/runs/6782858337?check_suite_focus=true#step:4:221

For more code quality check I think make sense to add checkstyle or something similar

@DSergiu how do you think?

P.S. looks like "old" tools like pmd and findbugs still works https://medium.com/fantageek/how-to-setup-android-projects-8c306aaeb519

  1. Can lint.xml be configured to catch unused variables? Otherwise, checkstyle or other tool can be used.
  2. Can pipeline fail when there are linting issues? In the CI run above, I see 2 issues found but pipeline continued.
    > Task :sdk:lint
    Ran lint on variant debug: 2 issues found
    Ran lint on variant release: 1 issues found
    

As far as I know, lint is more about "android" than about "java", and it cannot catch such issues. I totally agree that CI should catch such issues and checkstyle can help us here. I will create PR