You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/08/31 06:35:26 UTC

[GitHub] akrabat commented on a change in pull request #2650: Apply standard scala formatting.

akrabat commented on a change in pull request #2650: Apply standard scala formatting.
URL: https://github.com/apache/incubator-openwhisk/pull/2650#discussion_r136255353
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/common/Config.scala
 ##########
 @@ -42,113 +42,116 @@ import scala.util.Try
  * @param optionalProperties a Set of optional properties which may or not be defined.
  * @param env an optional environment to read from (defaults to sys.env).
  */
-class Config(
-    requiredProperties: Map[String, String],
-    optionalProperties: Set[String] = Set())(
-        env: Map[String, String] = sys.env)(
-            implicit logging: Logging) {
-
-    private val settings = getProperties().toMap.filter {
-        case (k, v) => requiredProperties.contains(k) ||
-            (optionalProperties.contains(k) && v != null)
-    }
+class Config(requiredProperties: Map[String, String], optionalProperties: Set[String] = Set())(
+    env: Map[String, String] = sys.env)(implicit logging: Logging) {
 
-    lazy val isValid: Boolean = Config.validateProperties(requiredProperties, settings)
-
-    /**
-     * Gets value for key if it exists else the empty string.
-     * The value of the override key will instead be returned if its value is present in the map.
-     *
-     * @param key to lookup
-     * @param overrideKey the property whose value will be returned if the map contains the override key.
-     * @return value for the key or the empty string if the key does not have a value/does not exist
-     */
-    def apply(key: String, overrideKey: String = ""): String = {
-        Try(settings(overrideKey)).orElse(Try(settings(key))).getOrElse("")
-    }
+  private val settings = getProperties().toMap.filter {
 
 Review comment:
   2 space matches the [style guide](https://docs.scala-lang.org/style/indentation.html). Generally I'm in favour of following the dominant style for a given language (if there is one) as it reduces the length of discussions.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services