A collection of best practices, friendly to people that want to contribute. Forked from alexandru/scala-best-practices and adapted to the typelevel stack.
- Version:
1.2
- Updated at:
2016-06-08
-
- 2.1. MUST NOT use "return"
- 2.2. SHOULD use immutable data structures
- 2.3. SHOULD NOT update a "var" using loops or conditions
- 2.4. SHOULD NOT define useless traits
- 2.5. MUST NOT use "var" inside a case class
- 2.6. SHOULD NOT declare abstract "var" members
- 2.7. MUST NOT throw exceptions for validations of user input or flow control
- 2.8. MUST NOT catch Throwable
- 2.9. MUST NOT use "null"
- 2.10. MUST NOT use "Option.get"
- 2.11. MUST NOT use Java's Date or Calendar, instead use
java.time
(JSR-310) - 2.12. SHOULD NOT use Any or AnyRef or isInstanceOf / asInstanceOf
- 2.13. MUST serialize dates as either Unix Timestamp or ISO 8601
- 2.14. MUST NOT use magic values
- 2.15. SHOULD NOT use "var" as shared state
- 2.16. Public functions SHOULD have an explicit return type
- 2.17. SHOULD NOT define case classes nested in other classes
- 2.18. MUST NOT include classes, traits and objects inside package objects
- 2.19. SHOULD use head/tail and init/last decomposition only if they can be done in constant time and memory
- 2.20. MUST NOT use
Seq.head
- 2.21. Case classes SHOULD be final
- 2.22. SHOULD NOT use
scala.App
Open an issue to make suggestions, or create a pull request ;-)
Copyright © 2015-2016, Some Rights Reserved.
Licensed under CC BY 4.0.