Skip to content

Instantly share code, notes, and snippets.

View blorente's full-sized avatar

Borja Lorente blorente

View GitHub Profile
function _launch_dockerized_pants() {
(
set -xe
pants_location=$1
docker_image=$2
cd "${pants_location}"
# Build the docker image locally
build_hash=$( docker build "build-support/docker/${docker_image}" | tail -n 1 | awk '{print $3}' )
# Launch the image with ~/.cache/pants and your local pants copy as mounted volumes
docker run -v $(realpath "${pants_location}"):/pants -v ~/.cache/pants:/home/.cache/pants -it "${build_hash}" /bin/bash
==================== FAILURES ====================
___ TestProjectsIntegrationTest.test_shard_20 ____
self = <pants_test.projects.test_testprojects_integration.TestProjectsIntegrationTest testMethod=test_shard_20>
def test_shard_20(self):
> self.run_shard(20)
.pants.d/pyprep/sources/11f40dc42cf8ddfdbdefdf104c9602dc07069eb6/pants_test/projects/test_testprojects_integration.py:205:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
E AssertionError: 0 != 1 : /home/travis/build/pantsbuild/pants/pants --no-pantsrc --pants-workdir=/home/travis/build/pantsbuild/pants/.pants.d/tmp/tmp9epzsn0m.pants.d --kill-nailguns --print-exception-stacktrace=True test testprojects/tests/scala/org/pantsbuild/testproject/exports:TC testprojects/tests/scala/org/pantsbuild/testproject/exports:TD testprojects/tests/scala/org/pantsbuild/testproject/non_exports:A testprojects/tests/scala/org/pantsbuild/testproject/non_exports:B --jvm-platform-default-platform=java7
E returncode: 1
E stdout:
E
E 12:26:21 00:00 [main]
E (To run a reporting server: ./pants server)
E 12:26:22 00:01 [setup]
E 12:26:22 00:01 [parse]
E Executing tasks in goals: bootstrap -> imports -> unpack-jars -> unpack-wheels -> deferred-sources -> nati
#TODO: Move partial results and output to a separate dotfolder:
# OUTDIR=.analysis
IVY_CACHE=~/.ivy2/cache
FAKE_IVY_FOLDER=.ivy
SBT_COMMAND=sbt -batch -ivy $(FAKE_IVY_FOLDER) -Dsbt.log.noformat=true
CLOC_BY_FILE=cloc --csv --by-file-by-lang --list-file
all: project-metadata.csv sources.txt
@task
def create_project_info(
project_path,
url=None,
last_commit=None,
):
def count_locs(project_path):
cloc_report_name = BASE_CONFIG["cloc_report"]
if not os.path.exists(os.path.join(project_path, cloc_report_name)):
P.local("cloc --out=%s --csv ." % cloc_report_name, project_path)
import ammonite.ops._
import $ivy.`com.github.tototoshi::scala-csv:1.3.5`
import java.nio.file.{Files, Paths}
import com.github.tototoshi.csv._
val INPUT = "./error-files-big.csv"
val CLASSIFIED_ERRORS_OUTPUT = "./error-classification.csv"
val MISSED_SYMBOLS_OUTPUT = "./missed-symbols.csv"
def getCallSiteErrors(raw: String): Seq[String] = {
#!/bin/bash
set -e
VERSION=0.4.2
AMMONIUM_VERSION=0.8.3-1
SCALA_VERSION=2.11.11 # Set to 2.12.2 for Scala 2.12
TYPELEVEL_SCALA=false # If true, set SCALA_VERSION above to a both ammonium + TLS available version (e.g. 2.11.8)
EXTRA_OPTS=()
#!/bin/bash
echo "project,definition_errors,callsite_errors" > errors.all.csv
find projects/ -maxdepth 4 -mindepth 4 -name "errors.log" -exec awk 'BEGIN {defs = 0; css= 0} /Definition/ {defs +=1} /CallSite/ {css += 1} END {print FILENAME "," defs "," css}' {} \; >> errors.all.csv
object P1 {
trait B {
def foo()
}
case class A ()
object A {
implicit def AtoB(a: A): B = new B { def foo() = println("P1.foo()")}
}
}

Claims for the paper

Conversions

  • Most of the conversions are transitive.
  • Transitive conversions are less dangerous than it seems.
    • They mostly convert to library types, not to primitives.
    • Most of them are used in DSLs.
  • Non-transitive conversions usually have a low usage-rate.
  • Most of them have 10 or less call sites.