Skip to content

Commit 1dd1d92

Browse files
authored
Merge pull request #37 from codacy/fix-build
Fix build
2 parents dd00fd9 + 5bda488 commit 1dd1d92

File tree

5 files changed

+41
-39
lines changed

5 files changed

+41
-39
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ jobs:
3737
- run:
3838
name: Test json
3939
working_directory: ~/codacy-plugins-test
40-
command: sbt -Dcodacy.tests.ignore.descriptions=true "run-main codacy.plugins.DockerTest json $CIRCLE_PROJECT_REPONAME:latest"
40+
command: sbt -Dcodacy.tests.ignore.descriptions=true "runMain codacy.plugins.DockerTest json $CIRCLE_PROJECT_REPONAME:latest"
4141
- run:
4242
name: Test patterns
4343
working_directory: ~/codacy-plugins-test
44-
command: sbt -Dcodacy.tests.noremove=true -Dcodacy.tests.threads=8 "run-main codacy.plugins.DockerTest pattern $CIRCLE_PROJECT_REPONAME:latest"
44+
command: sbt -Dcodacy.tests.noremove=true -Dcodacy.tests.threads=8 "runMain codacy.plugins.DockerTest pattern $CIRCLE_PROJECT_REPONAME:latest"
4545
- deploy:
4646
name: Push application Docker image
4747
command: |

build.sbt

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@ name := """codacy-engine-pylint"""
44

55
version := "1.0-SNAPSHOT"
66

7-
val languageVersion = "2.11.7"
7+
val languageVersion = "2.11.12"
88

99
scalaVersion := languageVersion
1010

11-
resolvers ++= Seq(
12-
"Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/",
13-
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/releases"
14-
)
11+
resolvers := Seq("Sonatype OSS Snapshots".at("https://oss.sonatype.org/content/repositories/releases")) ++ resolvers.value
1512

1613
libraryDependencies ++= Seq(
17-
"com.typesafe.play" %% "play-json" % "2.3.8",
14+
"com.typesafe.play" %% "play-json" % "2.4.8",
1815
"com.codacy" %% "codacy-engine-scala-seed" % "2.7.8"
1916
)
2017

@@ -27,27 +24,30 @@ version in Docker := "1.0"
2724
organization := "com.codacy"
2825

2926
val installAll =
30-
s"""echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories &&
31-
|apk --no-cache add bash wget ca-certificates git &&
32-
|apk --no-cache add python &&
33-
|apk --no-cache add 'python3>3.6.1' &&
34-
|wget "https://bootstrap.pypa.io/get-pip.py" -O /dev/stdout | python &&
35-
|wget "https://bootstrap.pypa.io/get-pip.py" -O /dev/stdout | python3 &&
36-
|python -m pip install django==1.9.2 pylint-django==0.9.0 flask==0.10.1 pylint-flask==0.1 flask-wtf==0.12 --upgrade --ignore-installed --no-cache-dir &&
37-
|python3 -m pip install django==1.9.2 pylint-django==0.9.0 flask==0.10.1 pylint-flask==0.1 flask-wtf==0.12 --upgrade --ignore-installed --no-cache-dir &&
38-
|python -m pip install pylint-common==0.2.2 &&
39-
|python3 -m pip install pylint-common==0.2.2 &&
40-
|python -m pip install pylint-celery==0.3 &&
41-
|python3 -m pip install pylint-celery==0.3 &&
42-
|python -m pip install SaltPyLint==2017.12.15 &&
43-
|python3 -m pip install SaltPyLint==2017.12.15 &&
44-
|python -m pip install pylint==1.8.2 --upgrade --ignore-installed --no-cache-dir &&
45-
|python3 -m pip install pylint==1.8.2 --upgrade --ignore-installed --no-cache-dir &&
46-
|python -m pip uninstall -y pip &&
47-
|python3 -m pip uninstall -y pip &&
48-
|apk del wget ca-certificates git &&
49-
|rm -rf /tmp/* &&
50-
|rm -rf /var/cache/apk/*""".stripMargin.replaceAll(System.lineSeparator()," ")
27+
s"""apt-get update &&
28+
|apt-get -y install python2.7 python3.5 ca-certificates wget openjdk-8-jre-headless &&
29+
|wget "https://bootstrap.pypa.io/get-pip.py" -O /dev/stdout | python2.7 &&
30+
|wget "https://bootstrap.pypa.io/get-pip.py" -O /dev/stdout | python3.5 &&
31+
|python2.7 -m pip install django==1.9.2 pylint-django==0.9.0 flask==0.10.1 pylint-flask==0.1 flask-wtf==0.12 --upgrade --ignore-installed --no-cache-dir &&
32+
|python3.5 -m pip install django==1.9.2 pylint-django==0.9.0 flask==0.10.1 pylint-flask==0.1 flask-wtf==0.12 --upgrade --ignore-installed --no-cache-dir &&
33+
|python2.7 -m pip install pylint-common==0.2.2 &&
34+
|python3.5 -m pip install pylint-common==0.2.2 &&
35+
|python2.7 -m pip install pylint-celery==0.3 &&
36+
|python3.5 -m pip install pylint-celery==0.3 &&
37+
|python2.7 -m pip install SaltPyLint==2017.12.15 &&
38+
|python3.5 -m pip install SaltPyLint==2017.12.15 &&
39+
|python2.7 -m pip install pylint==1.8.2 --upgrade --ignore-installed --no-cache-dir &&
40+
|python3.5 -m pip install pylint==1.8.2 --upgrade --ignore-installed --no-cache-dir &&
41+
|python2.7 -m pip uninstall -y pip &&
42+
|python3.5 -m pip uninstall -y pip &&
43+
|apt-get clean &&
44+
|rm -rf /var/lib/apt/lists/* &&
45+
|rm -rf /root/.cache/pip &&
46+
|rm -rf /root/.pip/cache &&
47+
|rm -rf /var/lib/apt/lists/* &&
48+
|rm -rf /var/cache/apt &&
49+
|rm -rf /var/cache/oracle-jdk8-installer &&
50+
|rm -rf /tmp/*""".stripMargin.replaceAll(System.lineSeparator(), " ")
5151

5252
mappings in Universal <++= (resourceDirectory in Compile) map { (resourceDir: File) =>
5353
val src = resourceDir / "docs"
@@ -66,15 +66,15 @@ daemonUser in Docker := dockerUser
6666

6767
daemonGroup in Docker := dockerGroup
6868

69-
dockerBaseImage := "develar/java"
69+
dockerBaseImage := "ubuntu:16.04"
7070

7171
dockerCommands := dockerCommands.value.flatMap {
7272
case cmd@Cmd("WORKDIR", _) => List(cmd,
7373
Cmd("RUN", installAll)
7474
)
7575
case cmd@(Cmd("ADD", "opt /opt")) => List(cmd,
7676
Cmd("RUN", "mv /opt/docker/docs /docs"),
77-
Cmd("RUN", s"adduser -u 2004 -D $dockerUser"),
77+
Cmd("RUN", "adduser --uid 2004 --disabled-password --gecos \"\" docker"),
7878
ExecCmd("RUN", Seq("chown", "-R", s"$dockerUser:$dockerGroup", "/docs"): _*)
7979
)
8080
case other => List(other)

project/build.properties

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#Activator-generated Properties
2-
#Tue Jun 23 14:00:32 EEST 2015
3-
template.uuid=7faf8e1e-4e8d-4387-8159-642b50383096
4-
sbt.version=0.13.8
1+
sbt.version=0.13.17

src/main/resources/docs/tests/E1127.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44

55

66
def function1():
7-
##Err: E1127
87
##Err: E1127
98
return TESTLIST[id:id:]
109

1110
def function2():
12-
##Err: E1127
1311
##Err: E1127
1412
return TESTLIST['0':'1':]
1513

src/main/scala/codacy/pylint/Pylint.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ object Pylint extends Tool {
145145
def generateClassification(files: List[String]): String = {
146146
val scriptArgs = files.mkString("###")
147147
val tmp = FileHelper.createTmpFile(classifyScript, "pylint", "")
148-
List("python3", tmp.toAbsolutePath.toString, scriptArgs).!!
148+
List("python3.5", tmp.toAbsolutePath.toString, scriptArgs).!!
149149
}
150150

151151
private def classifyFiles(files: List[String]): Try[Map[String, Array[String]]] = {
@@ -183,12 +183,19 @@ object Pylint extends Tool {
183183
val additionalPlugins = django ++ flask
184184

185185
configPart.map { configPart =>
186-
List("python" + interpreter, "-m", "pylint") ++
186+
List("python" + realInterpreterVersion(interpreter), "-m", "pylint") ++
187187
configPart ++ List(s"--msg-template=$msgTemplate", "--output-format=parseable") ++
188188
rulesPart ++ additionalPlugins ++ files
189189
}
190190
}
191191

192+
def realInterpreterVersion(interpreter: String): String = {
193+
interpreter match {
194+
case "2" => "2.7"
195+
case "3" => "3.5"
196+
}
197+
}
198+
192199
private def writeConfigFile(configuration: List[Pattern.Definition]): Try[Path] = {
193200

194201
val parameters = configuration.flatMap { pattern =>

0 commit comments

Comments
 (0)