Skip to content

Commit

Permalink
[SPARK-25655][BUILD] Add -Pspark-ganglia-lgpl to the scala style check.
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?
Our lint failed due to the following errors:
```
[INFO] --- scalastyle-maven-plugin:1.0.0:check (default)  spark-ganglia-lgpl_2.11 ---
error file=/home/jenkins/workspace/spark-master-maven-snapshots/spark/external/spark-ganglia-lgpl/src/main/scala/org/apache/spark/metrics/sink/GangliaSink.scala message=
      Are you sure that you want to use toUpperCase or toLowerCase without the root locale? In most cases, you
      should use toUpperCase(Locale.ROOT) or toLowerCase(Locale.ROOT) instead.
      If you must use toUpperCase or toLowerCase without the root locale, wrap the code block with
      // scalastyle:off caselocale
      .toUpperCase
      .toLowerCase
      // scalastyle:on caselocale
     line=67 column=49
error file=/home/jenkins/workspace/spark-master-maven-snapshots/spark/external/spark-ganglia-lgpl/src/main/scala/org/apache/spark/metrics/sink/GangliaSink.scala message=
      Are you sure that you want to use toUpperCase or toLowerCase without the root locale? In most cases, you
      should use toUpperCase(Locale.ROOT) or toLowerCase(Locale.ROOT) instead.
      If you must use toUpperCase or toLowerCase without the root locale, wrap the code block with
      // scalastyle:off caselocale
      .toUpperCase
      .toLowerCase
      // scalastyle:on caselocale
     line=71 column=32
Saving to outputFile=/home/jenkins/workspace/spark-master-maven-snapshots/spark/external/spark-ganglia-lgpl/target/scalastyle-output.xml
```

See https://amplab.cs.berkeley.edu/jenkins/view/Spark%20QA%20Compile/job/spark-master-lint/8890/

## How was this patch tested?
N/A

Closes apache#22647 from gatorsmile/fixLint.

Authored-by: gatorsmile <gatorsmile@gmail.com>
Signed-off-by: hyukjinkwon <gurwls223@apache.org>
  • Loading branch information
gatorsmile authored and HyukjinKwon committed Oct 6, 2018
1 parent 58287a3 commit 44cf800
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions dev/scalastyle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ERRORS=$(echo -e "q\n" \
-Pflume \
-Phive \
-Phive-thriftserver \
-Pspark-ganglia-lgpl \
scalastyle test:scalastyle \
| awk '{if($1~/error/)print}' \
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.spark.metrics.sink

import java.util.Properties
import java.util.{Locale, Properties}
import java.util.concurrent.TimeUnit

import com.codahale.metrics.MetricRegistry
Expand Down Expand Up @@ -64,11 +64,12 @@ class GangliaSink(val property: Properties, val registry: MetricRegistry,
val ttl = propertyToOption(GANGLIA_KEY_TTL).map(_.toInt).getOrElse(GANGLIA_DEFAULT_TTL)
val dmax = propertyToOption(GANGLIA_KEY_DMAX).map(_.toInt).getOrElse(GANGLIA_DEFAULT_DMAX)
val mode: UDPAddressingMode = propertyToOption(GANGLIA_KEY_MODE)
.map(u => GMetric.UDPAddressingMode.valueOf(u.toUpperCase)).getOrElse(GANGLIA_DEFAULT_MODE)
.map(u => GMetric.UDPAddressingMode.valueOf(u.toUpperCase(Locale.Root)))
.getOrElse(GANGLIA_DEFAULT_MODE)
val pollPeriod = propertyToOption(GANGLIA_KEY_PERIOD).map(_.toInt)
.getOrElse(GANGLIA_DEFAULT_PERIOD)
val pollUnit: TimeUnit = propertyToOption(GANGLIA_KEY_UNIT)
.map(u => TimeUnit.valueOf(u.toUpperCase))
.map(u => TimeUnit.valueOf(u.toUpperCase(Locale.Root)))
.getOrElse(GANGLIA_DEFAULT_UNIT)

MetricsSystem.checkMinimalPollingPeriod(pollUnit, pollPeriod)
Expand Down

0 comments on commit 44cf800

Please sign in to comment.