Addshore has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378831 )

Change subject: WIP DNM dicker: lintr image - linter for R
......................................................................

WIP DNM dicker: lintr image - linter for R

Bug: T176194
Change-Id: I8bf8328f2b4cbcc89e45335d76792b41939e43ee
---
A dockerfiles/lintr/Dockerfile
A dockerfiles/lintr/run.sh
2 files changed, 56 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/31/378831/1

diff --git a/dockerfiles/lintr/Dockerfile b/dockerfiles/lintr/Dockerfile
new file mode 100644
index 0000000..9d00bd3
--- /dev/null
+++ b/dockerfiles/lintr/Dockerfile
@@ -0,0 +1,23 @@
+FROM docker-registry.wikimedia.org/wikimedia-jessie:latest as builder
+
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get install --yes 
--no-install-recommends \
+        # The r language itself
+        r-base \
+        # Needed to build lintr
+        make gcc g++ ca-certificates gfortran liblapack-dev libxml2-dev 
libssl-dev libcurl4-openssl-dev  \
+        && \
+    Rscript -e 'install.packages("devtools", 
repos="http://cran.rstudio.com/";)' && \
+    Rscript -e 'devtools::install_github("jimhester/lintr@v1.0.1")' && \
+    apt-get remove --yes make gcc g++ gfortran liblapack-dev libxml2-dev 
libssl-dev libcurl4-openssl-dev && \
+    apt-get autoremove --yes && apt-get clean && rm -rf /var/lib/apt/lists/*
+
+COPY run.sh /run.sh
+
+RUN groupadd -r lintr && useradd --no-log-init -r -g lintr lintr
+
+#USER lintr
+USER root
+
+#ENTRYPOINT /bin/bash /run.sh
+ENTRYPOINT /bin/bash
\ No newline at end of file
diff --git a/dockerfiles/lintr/run.sh b/dockerfiles/lintr/run.sh
new file mode 100644
index 0000000..aa3c237
--- /dev/null
+++ b/dockerfiles/lintr/run.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+#TODO loop over all *.R files and lint them
+
+cd /tmp
+echo "library(httr)" > test.R
+Rscript -e 'lintr::lint("test.R")'
+
+# TODO fix the following error!!!:
+# TODO alos this run.sh doesnt appear to be working anyway...
+# $ docker run --rm -it wmfreleng/lintr:v2017.09.19.02.19
+# root@7bf6c24566ac:/# cd /tmp
+# root@7bf6c24566ac:/tmp# echo "library(httr)" > test.R
+# root@7bf6c24566ac:/tmp# Rscript -e 'lintr::lint("test.R")'
+# Error in dyn.load(file, DLLpath = DLLpath, ...) :
+#   unable to load shared object 
'/usr/local/lib/R/site-library/igraph/libs/igraph.so':
+#   libxml2.so.2: cannot open shared object file: No such file or directory
+# Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
+# Execution halted
+
+
+# Could do something like the below?
+#find ./ -type f -name \*.R -exec Rscript -e 'lintr::lint("{}")' \;
+#
+##Flip the exit code
+#if [ $? -ne 0 ]
+#then
+#      exit 0
+#else
+#      exit 1
+#fi
+
+# https://github.com/jimhester/lintr/blob/master/README.md makes me feel like 
there is actually a better way to do this
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/378831
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8bf8328f2b4cbcc89e45335d76792b41939e43ee
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Addshore <addshorew...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to