Skip to content

Commit

Permalink
Configure ScalaFMT (#79)
Browse files Browse the repository at this point in the history
* Configure ScalaFMT

* Upgrade scalafmt plugin

* Attempt to make ScalaFMT work.

* Update ScalaFMT plugin and format the code

* Install Jekyll via APT addon

* Upgrade SBT microsites
  • Loading branch information
A. Alonso Dominguez committed Jul 13, 2017
1 parent baee6b1 commit 5ff58ea
Show file tree
Hide file tree
Showing 12 changed files with 309 additions and 222 deletions.
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jdk:
- oraclejdk8

scala:
- 2.11.8
- 2.12.1
- 2.11.11
- 2.12.2

cache:
directories:
Expand All @@ -24,17 +24,19 @@ env:
global:
- TRAVIS_NODE_VERSION="4"

addons:
apt:
packages:
- graphviz

before_install:
- export PATH=${PATH}:./vendor/bundle

install:
# http://austinpray.com/ops/2015/09/20/change-travis-node-version.html
- 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
- rvm use 2.2.3 --install --fuzzy
- gem update --system
- gem install sass
- gem install jekyll -v 3.2.1
- sudo apt-get install -y graphviz

script:
- scripts/travis-build.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import cron4s.expr._

import org.openjdk.jmh.annotations._


/**
* Sample run
* sbt "bench/jmh:run -r 2 -i 20 -w 2 -wi 20 -f 1 -t 1 cron4s.bench.NodeMatcherBenchmark"
Expand Down
15 changes: 9 additions & 6 deletions bench/src/main/scala/cron4s/bench/NodeRangeBenchmark.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ class NodeRangeBenchmark {

val severalConstNode: SeveralNode[Minute] = {
val stepSize = Minutes.max / 10
val minutes: Seq[EnumerableNode[Minute]] = (Minutes.min to Minutes.max by stepSize)
.map(value => ConstNode[Minute](value))
.map(const2Enumerable)
val minutes: Seq[EnumerableNode[Minute]] =
(Minutes.min to Minutes.max by stepSize)
.map(value => ConstNode[Minute](value))
.map(const2Enumerable)

SeveralNode(minutes.head, minutes.tail: _*)
}
Expand All @@ -58,9 +59,11 @@ class NodeRangeBenchmark {
val unit = CronUnit[CronField.Minute]
val chunkSize = unit.max / 10

val minuteRanges = (unit.min to unit.max by chunkSize).map { lower =>
BetweenNode[Minute](ConstNode(lower), ConstNode(lower + chunkSize - 1))
}.map(between2Enumerable)
val minuteRanges = (unit.min to unit.max by chunkSize)
.map { lower =>
BetweenNode[Minute](ConstNode(lower), ConstNode(lower + chunkSize - 1))
}
.map(between2Enumerable)

SeveralNode[Minute](minuteRanges.head, minuteRanges.tail: _*)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,29 @@ class SeveralNodeValidatorBenchmark {
val _simpleInvalid = SeveralNode(ConstNode[Second](67))

val _threeConstValid = SeveralNode(
ConstNode[Second](4), ConstNode[Second](21), ConstNode[Second](54)
ConstNode[Second](4),
ConstNode[Second](21),
ConstNode[Second](54)
)
val _threeConstInvalid = SeveralNode(
ConstNode[Second](-2), ConstNode[Second](60), ConstNode[Second](120)
ConstNode[Second](-2),
ConstNode[Second](60),
ConstNode[Second](120)
)

val _rangeValid = SeveralNode(BetweenNode[Second](ConstNode(4), ConstNode(10)))
val _rangeInvalid = SeveralNode(BetweenNode[Second](ConstNode(10), ConstNode(4)))
val _rangeInvalidConst = SeveralNode(BetweenNode[Second](ConstNode(-6), ConstNode(61)))

val _constImpliedByRange = SeveralNode(ConstNode[Second](23), BetweenNode[Second](ConstNode(17), ConstNode(30)))
val _constImpliedByRangeReverse = SeveralNode(BetweenNode[Second](ConstNode(17), ConstNode(30)), ConstNode[Second](23))
val _rangeValid = SeveralNode(
BetweenNode[Second](ConstNode(4), ConstNode(10)))
val _rangeInvalid = SeveralNode(
BetweenNode[Second](ConstNode(10), ConstNode(4)))
val _rangeInvalidConst = SeveralNode(
BetweenNode[Second](ConstNode(-6), ConstNode(61)))

val _constImpliedByRange = SeveralNode(
ConstNode[Second](23),
BetweenNode[Second](ConstNode(17), ConstNode(30)))
val _constImpliedByRangeReverse = SeveralNode(
BetweenNode[Second](ConstNode(17), ConstNode(30)),
ConstNode[Second](23))

@Benchmark
def simpleValid(): List[InvalidField] = {
Expand Down
Loading

0 comments on commit 5ff58ea

Please sign in to comment.