Skip to content

Commit fdb86b9

Browse files
committed
Make warnings fatal
Signed-off-by: Carlos Quiroz <[email protected]>
1 parent 0e1e076 commit fdb86b9

File tree

17 files changed

+98
-91
lines changed

17 files changed

+98
-91
lines changed

.travis.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ branches:
1616

1717
env:
1818
- TRAVIS_NODE_VERSION="10.9.0" SCALAJS_VERSION="0.6.28"
19-
- TRAVIS_NODE_VERSION="10.9.0" SCALAJS_VERSION="1.0.0-M8"
19+
# - TRAVIS_NODE_VERSION="10.9.0" SCALAJS_VERSION="1.0.0-M8"
2020

2121
install:
2222
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
@@ -32,19 +32,17 @@ cache:
3232
- $HOME/.nvm
3333

3434
before_cache:
35-
- find $HOME/.sbt -name "*.lock" -type f -delete
36-
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -type f -delete
35+
# Cleanup the cached directories to avoid unnecessary cache updates
36+
- rm -fv $HOME/.ivy2/.sbt.ivy.lock
37+
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
38+
- find $HOME/.sbt -name "*.lock" -print -delete
3739

3840
script:
3941
# Your normal script
4042
- sbt ++$TRAVIS_SCALA_VERSION squantsJVM/compile squantsJS/compile squantsJS/fastOptJS
4143
- if [[ $TRAVIS_SCALA_VERSION == "2.11.12" ]]; then sbt ++$TRAVIS_SCALA_VERSION squantsNative/compile; fi;
42-
- sbt ++$TRAVIS_SCALA_VERSION squantsJS/test squantsJVM/test; fi;
43-
- sbt ++$TRAVIS_SCALA_VERSION squantsJS/doc squantsJVM/doc tut
44-
45-
# Tricks to avoid unnecessary cache updates
46-
- find $HOME/.sbt -name "*.lock" | xargs rm
47-
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm
44+
- if [[ $SCALAJS_VERSION == "0.6.28" ]]; then sbt ++$TRAVIS_SCALA_VERSION squantsJS/test; fi;
45+
- sbt ++$TRAVIS_SCALA_VERSION squantsJVM/test
4846

4947
after_success:
5048
- bash <(curl -s https://codecov.io/bash)

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ All types are immutable and thread-safe.
1515
|
1616
[![Join the chat at https://gitter.im/typelevel/squants](https://badges.gitter.im/typelevel/squants.svg)](https://gitter.im/typelevel/squants?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1717
|
18-
[![Scaladocs](https://www.javadoc.io/badge/org.typelevel/squants_2.12.svg?label=scaladoc)](https://static.javadoc.io/org.typelevel/squants_2.12/1.4.0/squants/index.html)
18+
[![Scaladocs](https://www.javadoc.io/badge/org.typelevel/squants_2.12.svg?label=scaladoc)](https://static.javadoc.io/org.typelevel/squants_2.12/1.5.0/squants/index.html)
1919
|
2020
[![Build Status](https://travis-ci.org/typelevel/squants.png?branch=master)](https://travis-ci.org/typelevel/squants)
2121

2222

2323
### Current Versions
24-
Current Release: **1.4.0**
25-
([API Docs](https://oss.sonatype.org/service/local/repositories/releases/archive/org/typelevel/squants_2.12/1.4.0/squants_2.12-1.4.0-javadoc.jar/!/index.html#squants.package))
24+
Current Release: **1.5.0**
25+
([API Docs](https://oss.sonatype.org/service/local/repositories/releases/archive/org/typelevel/squants_2.12/1.5.0/squants_2.12-1.5.0-javadoc.jar/!/index.html#squants.package))
2626

27-
Development Build: **1.5.0-SNAPSHOT**
28-
([API Docs](https://oss.sonatype.org/service/local/repositories/snapshots/archive/org/typelevel/squants_2.12/1.5.0-SNAPSHOT/squants_2.12-1.5.0-SNAPSHOT-javadoc.jar/!/index.html#squants.package))
27+
Development Build: **1.6.0-SNAPSHOT**
28+
([API Docs](https://oss.sonatype.org/service/local/repositories/snapshots/archive/org/typelevel/squants_2.12/1.6.0-SNAPSHOT/squants_2.12-1.6.0-SNAPSHOT-javadoc.jar/!/index.html#squants.package))
2929

3030
[Release History](https://github.com/typelevel/squants/wiki/Release-History)
3131

@@ -38,10 +38,10 @@ For more information on feature availability of a specific version see the Relea
3838
Repository hosting for Squants is provided by [Sonatype](https://oss.sonatype.org/).
3939
To use Squants in your SBT project add the following dependency to your build.
4040

41-
"org.typelevel" %% "squants" % "1.4.0"
41+
"org.typelevel" %% "squants" % "1.5.0"
4242
or
4343

44-
"org.typelevel" %% "squants" % "1.5.0-SNAPSHOT"
44+
"org.typelevel" %% "squants" % "1.6.0-SNAPSHOT"
4545

4646

4747
To use Squants in your Maven project add the following dependency
@@ -50,13 +50,13 @@ To use Squants in your Maven project add the following dependency
5050
<dependency>
5151
<groupId>org.typelevel</groupId>
5252
<artifactId>squants_2.11</artifactId>
53-
<version>1.4.0</version>
53+
<version>1.5.0</version>
5454
</dependency>
5555
```
5656

5757
Beginning with Squants 0.4.x series, both Scala 2.10 and 2.11 builds are available.
5858
Beginning with Squants 1.x series, Scala 2.10, 2.11 and 2.12 builds are available.
59-
Scala.js is supported on version 0.6.25 and 1.0.0-M6
59+
Scala.js is supported on version 0.6.28 and 1.0.0-M8
6060

6161
To use Squants interactively in the Scala REPL, clone the git repo and run `sbt squantsJVM/console`
6262

@@ -963,7 +963,7 @@ import squants.experimental.unitgroups.si.strict.implicits._
963963
// import squants.experimental.unitgroups.si.strict.implicits._
964964

965965
val siLengths: UnitGroup[Length] = implicitly[UnitGroup[Length]]
966-
// siLengths: squants.experimental.unitgroups.UnitGroup[squants.space.Length] = squants.experimental.unitgroups.si.strict.package$implicits$$anon$1@71f1bb6
966+
// siLengths: squants.experimental.unitgroups.UnitGroup[squants.space.Length] = squants.experimental.unitgroups.si.strict.package$implicits$$anon$1@3bd46477
967967
```
968968

969969
To print out units and their conversion factors to the primary SI unit, you could use this code:
@@ -1020,16 +1020,16 @@ val usCookingUnitGroup = new UnitGroup[Volume] {
10201020
// units don't have to be specified in-order.
10211021
val units: Set[UnitOfMeasure[Volume]] = Set(UsPints, UsGallons, Teaspoons, Tablespoons, UsQuarts, FluidOunces)
10221022
}
1023-
// usCookingUnitGroup: squants.experimental.unitgroups.UnitGroup[squants.space.Volume]{val units: Set[squants.UnitOfMeasure[squants.space.Volume]]} = $anon$1@608b512
1023+
// usCookingUnitGroup: squants.experimental.unitgroups.UnitGroup[squants.space.Volume]{val units: Set[squants.UnitOfMeasure[squants.space.Volume]]} = $anon$1@13cf78bc
10241024

10251025
// squants automatically sorts units
10261026
usCookingUnitGroup.sortedUnits.foreach(println)
1027-
// squants.space.Teaspoons$@6c8ced06
1028-
// squants.space.Tablespoons$@34fbe7f5
1029-
// squants.space.FluidOunces$@d678d65
1030-
// squants.space.UsPints$@71e9406b
1031-
// squants.space.UsQuarts$@f2a1319
1032-
// squants.space.UsGallons$@6e8d9849
1027+
// squants.space.Teaspoons$@754c402e
1028+
// squants.space.Tablespoons$@41f51dac
1029+
// squants.space.FluidOunces$@4151520
1030+
// squants.space.UsPints$@297ee46f
1031+
// squants.space.UsQuarts$@1f76d461
1032+
// squants.space.UsGallons$@5f688205
10331033
```
10341034

10351035
The `UnitGroup` values provided with Squants are only samples and aren't intended to be exhaustive.
@@ -1065,7 +1065,7 @@ import squants.experimental.unitgroups.misc.AstronomicalLengthUnitGroup
10651065
Then create the formatter by passing in a unit group:
10661066
```scala
10671067
val astroFormatter = new DefaultFormatter(AstronomicalLengthUnitGroup)
1068-
// astroFormatter: squants.experimental.formatter.DefaultFormatter[squants.space.Length] = squants.experimental.formatter.DefaultFormatter@ddf3da9
1068+
// astroFormatter: squants.experimental.formatter.DefaultFormatter[squants.space.Length] = squants.experimental.formatter.DefaultFormatter@4a75b2e0
10691069
```
10701070

10711071
Now, we create some values using human-unfriendly numbers:
@@ -1117,7 +1117,7 @@ import squants.experimental.unitgroups.misc.AstronomicalLengthUnitGroup
11171117

11181118
```scala
11191119
implicit val astroFormatter = new DefaultFormatter(AstronomicalLengthUnitGroup)
1120-
// astroFormatter: squants.experimental.formatter.DefaultFormatter[squants.space.Length] = squants.experimental.formatter.DefaultFormatter@4593e3c2
1120+
// astroFormatter: squants.experimental.formatter.DefaultFormatter[squants.space.Length] = squants.experimental.formatter.DefaultFormatter@679fbbc2
11211121

11221122
val earthToJupiter = 588000000.km
11231123
// earthToJupiter: squants.space.Length = 588000000.0 km
@@ -1552,9 +1552,9 @@ To make a release do the following:
15521552
sbt squantsNative/publishSigned
15531553
```
15541554

1555-
* Repeat for scala.js 1.0.0-M6
1555+
* Repeat for scala.js 1.0.0-M8
15561556
```
1557-
SCALAJS_VERSION=1.0.0-M6 sbt +squantsJS/publishSigned
1557+
SCALAJS_VERSION=1.0.0-M8 sbt +squantsJS/publishSigned
15581558
```
15591559

15601560
* Then make a release (Note: after this step the release cannot be replaced)

build.sbt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ lazy val defaultSettings =
88
Console.defaultSettings ++
99
Docs.defaultSettings
1010

11+
Global / onChangedBuildSource := ReloadOnSourceChanges
12+
13+
ThisBuild / turbo := true
14+
1115
lazy val squants =
1216
crossProject(JSPlatform, JVMPlatform, NativePlatform)
1317
.crossType(CrossType.Full)
@@ -18,22 +22,28 @@ lazy val squants =
1822
)
1923
.jvmSettings(
2024
osgiSettings,
25+
scalacOptions in Tut --= Seq("-Ywarn-unused-import", "-Ywarn-unused:imports"),
2126
tutTargetDirectory := file("."),
2227
tutSourceDirectory := file("shared") / "src" / "main" / "tut"
2328
)
2429
.jvmSettings(Tests.defaultSettings: _*)
30+
.jsSettings(Tests.defaultSettings: _*)
2531
.jsSettings(
2632
parallelExecution in Test := false,
27-
excludeFilter in Test := "*Serializer.scala" || "*SerializerSpec.scala"
33+
excludeFilter in Test := "*Serializer.scala" || "*SerializerSpec.scala",
34+
scalacOptions in Tut --= Seq("-Ywarn-unused-import", "-Ywarn-unused:imports"),
35+
sources in (Compile, test) := List() // This is a pity but we can't reliable compile on 1.0.0-M8
36+
)
37+
.nativeSettings(
38+
sources in (Compile, doc) := List() // Can't build docs in native
2839
)
29-
.jsSettings(Tests.defaultSettings: _*)
3040

3141
lazy val root = project.in(file("."))
3242
.settings(defaultSettings: _*)
3343
.settings(
3444
name := "squants",
3545
publish := {},
3646
publishLocal := {},
37-
publishArtifact := false
47+
useGpg := true
3848
)
3949
.aggregate(squants.jvm, squants.js, squants.native)

project/Build.scala

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,25 @@ import com.typesafe.sbt.osgi.SbtOsgi
77
import com.typesafe.sbt.osgi.SbtOsgi.autoImport._
88

99
object Versions {
10-
val Squants = "1.5.0-SNAPSHOT"
10+
val Squants = "1.5.0"
1111
val Scala = "2.11.12" // Don't use 2.12 yet to avoid troubles with native
1212
val scalaJSVersion =
13-
Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.25")
13+
Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.28")
1414
val ScalaCross =
1515
if (scalaJSVersion.startsWith("0.6")) {
1616
Seq("2.10.7", "2.11.12", "2.12.9")
1717
} else {
1818
Seq("2.11.12", "2.12.9")
1919
}
2020

21-
val ScalaTest = "3.0.8"
21+
val ScalaTest = "3.1.0-M2"
22+
val ScalaTestOld = "3.0.7"
2223
val ScalaCheck = "1.13.5"
2324
val Json4s = "3.6.7"
2425
}
2526

2627
object Dependencies {
28+
val scalaTestOld = Def.setting(Seq("org.scalatest" %%% "scalatest" % Versions.ScalaTestOld % Test))
2729
val scalaTest = Def.setting(Seq("org.scalatest" %%% "scalatest" % Versions.ScalaTest % Test))
2830
val scalaCheck = Def.setting(Seq("org.scalacheck" %%% "scalacheck" % Versions.ScalaCheck % Test))
2931
val json4s = Def.setting(Seq("org.json4s" %% "json4s-native" % Versions.Json4s % Test))
@@ -63,33 +65,42 @@ object Project {
6365

6466
object Compiler {
6567
lazy val newerCompilerLintSwitches = Seq(
66-
"-Xlint:missing-interpolator", // Not availabile in 2.10
67-
"-Ywarn-unused", // Not available in 2.10
68-
"-Ywarn-unused-import", // Not available in 2.10
69-
"-Ywarn-numeric-widen" // In 2.10 this produces a some strange spurious error
68+
"-Xlint:missing-interpolator",
69+
"-Ywarn-unused",
70+
"-Ywarn-unused-import",
71+
"-Ywarn-numeric-widen",
72+
"-deprecation:false"
7073
)
7174

72-
val defaultSettings = Seq(
73-
scalacOptions in ThisBuild ++= Seq(
74-
"-feature",
75+
lazy val defaultCompilerSwitches = Seq(
76+
"-feature",
77+
"-deprecation",
78+
"-encoding", "UTF-8", // yes, this is 2 args
79+
"-Xfatal-warnings",
80+
"-unchecked",
81+
"-Xfuture",
82+
"-Ywarn-dead-code",
83+
"-Yno-adapted-args"
84+
)
85+
86+
lazy val defaultSettings = Seq(
87+
scalacOptions ++= Seq(
7588
"-deprecation",
76-
"-encoding", "UTF-8", // yes, this is 2 args
77-
"-Xfatal-warnings",
78-
"-unchecked",
79-
"-Xfuture",
80-
"-Ywarn-dead-code",
81-
"-Yno-adapted-args"
89+
"-feature",
90+
"-encoding", "UTF-8",
8291
),
83-
84-
scalacOptions ++= PartialFunction.condOpt(CrossVersion.partialVersion(scalaVersion.value)){
85-
case Some((2, scalaMajor)) if scalaMajor >= 11 => newerCompilerLintSwitches
86-
}.toList.flatten,
92+
scalacOptions := {CrossVersion.partialVersion(scalaVersion.value) match {
93+
case Some((2, scalaMajor)) if scalaMajor >= 11 => scalacOptions.value ++ defaultCompilerSwitches ++ newerCompilerLintSwitches
94+
case _ => scalacOptions.value ++ defaultCompilerSwitches
95+
}},
8796

8897
scalaVersion in ThisBuild := Versions.Scala,
8998

9099
crossScalaVersions := Versions.ScalaCross
91100
)
101+
92102
}
103+
93104
object Publish {
94105
val defaultSettings = Seq(
95106
publishTo := {
@@ -122,16 +133,12 @@ object Publish {
122133

123134
object Tests {
124135
val defaultSettings =
125-
if (Versions.scalaJSVersion.startsWith("0.6")) {
126136
Seq(
127137
libraryDependencies ++=
128138
Dependencies.scalaTest.value ++
129139
Dependencies.scalaCheck.value ++
130140
Dependencies.json4s.value
131141
)
132-
} else {
133-
Seq.empty
134-
}
135142
}
136143

137144
object Formatting {
@@ -167,7 +174,7 @@ object Formatting {
167174

168175
object Console {
169176
val defaultSettings = Seq(
170-
scalacOptions ~= (_ filterNot (Set("-Xfatal-warnings", "-Ywarn-unused-import").contains)),
177+
scalacOptions in (Compile, console) ~= (_ filterNot (Set("-Xfatal-warnings", "-Ywarn-unused-import").contains)),
171178

172179
initialCommands in console := """
173180
import scala.language.postfixOps,
@@ -248,6 +255,6 @@ object Docs {
248255
val (bd, v) = ((baseDirectory in LocalRootProject).value, version.value)
249256
val tagOrBranch = if(v endsWith "SNAPSHOT") gitHash else "v" + v
250257
Seq("-sourcepath", bd.getAbsolutePath, "-doc-source-url", "https://github.com/garyKeorkunian/squants/tree/" + tagOrBranch + "€{FILE_PATH}.scala")
251-
}
258+
},
252259
)
253260
}

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")
1010

1111
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.5")
1212

13-
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
13+
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.2")
1414

15-
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
15+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
1616

1717
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.12")

shared/src/main/scala/squants/SVector.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ case class QuantityVector[A <: Quantity[A]](coordinates: A*) extends SVector[A]
267267
case _ throw new UnsupportedOperationException("Cross Product is not supported on vectors with an arbitrary number of dimensions")
268268
}
269269

270-
def crossProduct[B <: Quantity[B], C <: Quantity[C]](that: SVector[B], quantTimes: (A, B) C)(implicit num: Numeric[C]): QuantityVector[C] = {
270+
def crossProduct[B <: Quantity[B], C <: Quantity[C]: Numeric](that: SVector[B], quantTimes: (A, B) C): QuantityVector[C] = {
271271
(this.coordinates.length, that.coordinates.length) match {
272272
case (3, 3)
273273
QuantityVector(

shared/src/main/scala/squants/radio/Dose.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import squants.energy.{ Energy, Joules }
1414
import squants.time.Time
1515

1616
/**
17-
* Its important to note that while Dose and SpecificEnergy are simliar
17+
* Its important to note that while Dose and SpecificEnergy are simliar
1818
* measures (both are energy/mass dimensions), they are decidedly different
1919
* and no conversions between the two dimensions should be directly possible
2020
* through implicit conversions EVER. This is because SpecificEnergy is used to
@@ -25,7 +25,6 @@ import squants.time.Time
2525
* doesn't allow any sort of magic conversions that allow this mistake.
2626
* @author Hunter Payne
2727
*
28-
* @param value value in [[squants.radio.Sievert]]
2928
*/
3029
final class Dose private (val value: Double, val unit: DoseUnit) extends Quantity[Dose] {
3130

@@ -71,4 +70,3 @@ object DoseConversions {
7170

7271
implicit object DoseNumeric extends AbstractQuantityNumeric[Dose](Dose.primaryUnit)
7372
}
74-

shared/src/main/scala/squants/space/Area.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import squants.mass.AreaDensity
1515
import squants.motion.{ Newtons, Pressure }
1616
import squants.photo.{ Candelas, _ }
1717
import squants.radio._
18-
import squants.time.{ Time, Seconds }
18+
import squants.time.Time
1919

2020
/**
2121
* @author garyKeorkunian

0 commit comments

Comments
 (0)