apache / apache/openwhisk

Configure static code analysis as part of code scan

Open
#3,931 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
6.8k
Forks
1.2k
Avg merge
2d 14h
Merged PRs (30d)
2

Description

Currently OpenWhisk build run a [scalafmt][1] check to enforce a consistent code style. We should look into configuring some static code analysis check also to enforce certain implementation rules like using `Seq.empty` instead of `Seq()`

We have following options

1. [scapegoat][2] - Scala compiler plugin for static code analysis
- [rules][9]
- Has some useful rules
2. [scalafix][3] - rewrite and linting tool for Scala
- [rules][8]
- From Scalacenter
3. [scalastyle][4]
- Gradle Support
- Most of [the rules][5] are around formatting
4. [linter][6]

Linter docs link to [many other][7] similar tools

Most of the tools do not have direct Gradle support :(

[1]: https://scalameta.org/scalafmt/
[2]: https://github.com/sksamuel/scapegoat
[3]: https://scalacenter.github.io/scalafix/
[4]: http://www.scalastyle.org/
[5]: http://www.scalastyle.org/rules-1.0.0.html
[7]: https://github.com/HairyFotr/linter#future-work
[6]: https://github.com/HairyFotr/linter
[8]: https://scalacenter.github.io/scalafix/docs/users/rules
[9]: https://github.com/sksamuel/scapegoat#inspections

Contributor guide

Open the contributing guide

Research direction

Start with the existing scalafmt check in the Gradle build and review how code scanning is configured. Compare scapegoat, scalafix, scalastyle, and linter for Gradle integration and useful implementation rules. Done means one suitable static analysis tool is configured as a code-scan check with agreed rules, including the Seq.empty preference.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.