sbt, the interactive build tool
Go to file
jvican ca3acc4e52
Improve if check and prohibit value inside anon
This commit does the following things:

* Removes the boolean from the instance context passes to the linter.
* Prohibits the use of value inside anonymous functions.
* Improves the previous check of `value` inside if.

The improvements have occurred thanks to the fix of an oversight in the
traverser. As a result, several implementation of tasks have been
rewritten because of new compilation failures by both checks.

Note that the new check that prohibits the use of value inside anonymous
functions ignores all the functions whose parameters have been
synthesized by scalac (that can happen in a number of different
scenarios, like for comprehensions). Other scripted tests have also been
fixed.

Running `.value` inside an anonymous function yields the following
error:

```
[error] /data/rw/code/scala/sbt/main-settings/src/test/scala/sbt/std/TaskPosSpec.scala:50:24: The evaluation of `foo` inside an anonymous function is prohibited.
[error]
[error] Problem: Task invocations inside anonymous functions are evaluated independently of whether the anonymous function is invoked or not.
[error]
[error] Solution:
[error]   1. Make `foo` evaluation explicit outside of the function body if you don't care about its evaluation.
[error]   2. Use a dynamic task to evaluate `foo` and pass that value as a parameter to an anonymous function.
[error]
[error]       val anon = () => foo.value + " "
[error]                        ^
```
2017-05-25 17:21:29 +02:00
core-macros/src/main/scala/sbt/internal/util/appmacro Improve if check and prohibit value inside anon 2017-05-25 17:21:29 +02:00
launch Add three slashes (u3) for file URI 2017-04-12 03:34:11 -04:00
licenses move remaining pieces of sbt subproject to sbt_pending and fix notices 2010-09-21 21:55:50 -04:00
main Improve if check and prohibit value inside anon 2017-05-25 17:21:29 +02:00
main-actions/src update TestFramework 2017-05-19 00:16:19 -04:00
main-command/src/main Apply Scalafmt formatting 2017-04-21 04:48:31 -04:00
main-settings/src Improve if check and prohibit value inside anon 2017-05-25 17:21:29 +02:00
notes Better toError migration notes [ci skip] 2017-05-16 10:21:14 +01:00
project Add fully-fledged macro check for value inside if 2017-05-25 15:33:00 +02:00
protocol/src/main Apply Scalafmt formatting 2017-04-21 04:48:31 -04:00
run migrate ForkOptions to Contraband 2017-05-12 05:22:08 -04:00
sbt/src Improve if check and prohibit value inside anon 2017-05-25 17:21:29 +02:00
scripted migrate PluginTrigger and ProjectOrigin to Contraband (#3191) 2017-05-13 13:01:51 +01:00
src/main/conscript sbt 1.0 nightly 2017-01-16 11:43:37 -05:00
tasks Apply Scalafmt formatting 2017-04-21 04:48:31 -04:00
tasks-standard Apply Scalafmt formatting 2017-04-21 04:48:31 -04:00
testing update TestFramework 2017-05-19 00:16:19 -04:00
.gitattributes Added .gitattributes file. 2013-04-25 00:06:51 +08:00
.gitignore Reorganize test structure for `mainSettings` 2017-05-24 11:27:04 +02:00
.java-version Configure JVM 1.8 in .java-version 2016-10-07 08:48:23 -05:00
.scalafmt.conf format: off / format: on 2017-04-21 03:11:48 -04:00
.travis.yml Replace previous scalafmt plugin by neo-scalafmt 2017-05-24 11:15:22 +02:00
CONTRIBUTING.md update "Testing sbt plugins" url 2017-03-21 16:49:36 +09:00
ISSUE_TEMPLATE.md Add "Clean history" to contributing with links 2016-02-19 13:21:11 +00:00
LICENSE Update CONTRIBUTING.md 2014-04-14 12:16:06 -04:00
NOTICE Update CONTRIBUTING.md 2014-04-14 12:16:06 -04:00
PULL_REQUEST_TEMPLATE.md Add "Clean history" to contributing with links 2016-02-19 13:21:11 +00:00
README.md readme 2016-05-08 14:49:43 -04:00
build.sbt Reorganize test structure for `mainSettings` 2017-05-24 11:27:04 +02:00
reset.sh update TestFramework 2017-05-19 00:16:19 -04:00
sbt-allsources.sh Bump underlying modules to latest 2017-03-23 12:41:24 -04:00
server.md Update to Contraband 2017-01-06 11:27:06 -05:00

README.md

sbt

sbt is a build tool for Scala, Java, and more.

For general documentation, see http://www.scala-sbt.org/.

sbt 1.0.x

This is the 1.0.x series of sbt. The source code of sbt is split across several Github repositories, including this one.

  • sbt/io hosts sbt.io module.
  • sbt/util hosts a collection of internally used modules.
  • sbt/librarymanagement hosts sbt.librarymanagement module that wraps Ivy.
  • sbt/zinc hosts Zinc, an incremental compiler for Scala.
  • sbt/sbt, this repository hosts modules that implements the build tool.
  • Setup: Describes getting started with the latest binary release.
  • FAQ: Explains how to get help and more.
  • sbt/sbt-zero-seven: hosts sbt 0.7.7 and earlier versions

Issues and Pull Requests

Please read CONTRIBUTING carefully before opening a GitHub Issue.

The short version: try searching or asking on StackOverflow and sbt-dev.

license

See LICENSE.