Skip to content

Commit 1cd9d46

Browse files
authored
Merge pull request #43 from codacy/feature/bump-seed-FT-7452
feature: bump seed, scala and play-json FT-7452 :breaking:
2 parents f7533fb + d249821 commit 1cd9d46

File tree

5 files changed

+127
-26
lines changed

5 files changed

+127
-26
lines changed

.circleci/config.yml

Lines changed: 113 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,119 @@
11
version: 2
2+
3+
references:
4+
5+
docker_environment_defaults: &docker_environment_defaults
6+
# Customize the JVM to read correct memory values
7+
JAVA_OPTS: '-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1'
8+
9+
host_environment_defaults: &host_environment_defaults
10+
# Customize the JVM maximum heap limit
11+
JAVA_OPTS: -Xss256m -Xmx6144m
12+
13+
default_java_job: &default_java_job
14+
docker:
15+
- image: circleci/openjdk:8-jdk
16+
environment:
17+
<<: *docker_environment_defaults
18+
working_directory: ~/workdir
19+
20+
restore_dependencies: &restore_dependencies
21+
restore_cache:
22+
keys:
23+
- sbt-ivy2-dependencies-1.0.0-{{ checksum "/tmp/dependencies.cache.tmp" }}
24+
- sbt-ivy2-dependencies-1.0.0
25+
26+
setup_dependencies_key: &setup_dependencies_key
27+
run:
28+
name: Generate cache key
29+
command: |
30+
shasum build.sbt \
31+
project/plugins.sbt \
32+
project/build.properties > /tmp/dependencies.cache.tmp
33+
34+
235
jobs:
36+
37+
checkout_and_version:
38+
docker:
39+
- image: codacy/git-version:1.0.8
40+
working_directory: ~/workdir
41+
steps:
42+
- checkout
43+
- run:
44+
name: Set version
45+
command: /bin/git-version > .version
46+
- run:
47+
name: Set Sbt version
48+
command: echo "version in ThisBuild := \"$(cat .version)\"" > version.sbt
49+
- run:
50+
name: Current version
51+
command: cat .version
52+
- persist_to_workspace:
53+
root: ~/
54+
paths:
55+
- workdir
56+
57+
sbt_dependencies:
58+
<<: *default_java_job
59+
environment:
60+
AWS_PROFILE: maven
61+
steps:
62+
- attach_workspace:
63+
at: ~/
64+
- *setup_dependencies_key
65+
- *restore_dependencies
66+
- run:
67+
name: Resolve dependencies
68+
command: sbt update
69+
- save_cache:
70+
paths:
71+
- ~/.ivy2
72+
- ~/.sbt
73+
key: sbt-ivy2-dependencies-1.0.0-{{ checksum "/tmp/dependencies.cache.tmp" }}
74+
75+
compile:
76+
<<: *default_java_job
77+
steps:
78+
- attach_workspace:
79+
at: ~/
80+
- *setup_dependencies_key
81+
- *restore_dependencies
82+
- run:
83+
name: Compile
84+
command: sbt -Dbuild.number=$(cat .version) compile test:compile
85+
- persist_to_workspace:
86+
root: ~/
87+
paths:
88+
- workdir
89+
390
build:
491
machine: true
92+
environment:
93+
<<: *host_environment_defaults
594
working_directory: ~/workdir
695
steps:
7-
- checkout
8-
- run:
96+
- attach_workspace:
97+
at: ~/
98+
- *setup_dependencies_key
99+
- *restore_dependencies
100+
- run:
9101
name: Clone test project
10102
working_directory: ~/
11103
command: |
12-
(git -C ~/codacy-plugins-test fetch --all &&
13-
git -C ~/codacy-plugins-test reset --hard origin/master) ||
104+
(git -C ~/codacy-plugins-test fetch --all &&
105+
git -C ~/codacy-plugins-test reset --hard origin/master) ||
14106
git clone git://github.com/codacy/codacy-plugins-test.git ~/codacy-plugins-test
15-
- restore_cache:
16-
key: dependencies-{{ checksum "build.sbt" }}
17-
- run:
107+
- run:
18108
name: Compile test project
19109
working_directory: ~/codacy-plugins-test
20110
command: sbt compile
21-
- run:
111+
- run:
22112
name: Publish tool docker locally
23113
working_directory: ~/workdir
24114
command: sbt 'set version in Docker := "latest"' "set name := \"$CIRCLE_PROJECT_REPONAME\"" docker:publishLocal
25115
- save_cache:
26-
key: dependencies-{{ checksum "build.sbt" }}
116+
key: sbt-ivy2-dependencies-1.0.0-{{ checksum "/tmp/dependencies.cache.tmp" }}
27117
paths:
28118
- "~/.ivy2"
29119
- "~/.m2"
@@ -34,7 +124,7 @@ jobs:
34124
- "~/workdir/target"
35125
- "~/workdir/project/target"
36126
- "~/workdir/project/project"
37-
- run:
127+
- run:
38128
name: Test json
39129
working_directory: ~/codacy-plugins-test
40130
command: sbt -Dcodacy.tests.ignore.descriptions=true "runMain codacy.plugins.DockerTest json $CIRCLE_PROJECT_REPONAME:latest"
@@ -48,12 +138,23 @@ jobs:
48138
if [ "${CIRCLE_BRANCH}" == "master" ]; then
49139
docker login -u $DOCKER_USER -p $DOCKER_PASS
50140
docker tag $CIRCLE_PROJECT_REPONAME codacy/$CIRCLE_PROJECT_REPONAME
51-
docker tag $CIRCLE_PROJECT_REPONAME codacy/$CIRCLE_PROJECT_REPONAME:1.0.$CIRCLE_BUILD_NUM
141+
docker tag $CIRCLE_PROJECT_REPONAME codacy/$CIRCLE_PROJECT_REPONAME:$(cat .version)
52142
docker push codacy/$CIRCLE_PROJECT_REPONAME
143+
docker push codacy/$CIRCLE_PROJECT_REPONAME:$(cat .version)
53144
fi
54145
55146
workflows:
56147
version: 2
57148
build-and-deploy:
58149
jobs:
59-
- build
150+
- checkout_and_version
151+
- sbt_dependencies:
152+
requires:
153+
- checkout_and_version
154+
- compile:
155+
requires:
156+
- sbt_dependencies
157+
- build:
158+
context: CodacyDocker
159+
requires:
160+
- compile

build.sbt

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

55
version := "1.0-SNAPSHOT"
66

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

99
scalaVersion := languageVersion
1010

1111
resolvers := Seq("Sonatype OSS Snapshots".at("https://oss.sonatype.org/content/repositories/releases")) ++ resolvers.value
1212

1313
libraryDependencies ++= Seq(
14-
"com.typesafe.play" %% "play-json" % "2.4.8",
15-
"com.codacy" %% "codacy-engine-scala-seed" % "2.7.8"
14+
"com.codacy" %% "codacy-engine-scala-seed" % "3.0.9"
1615
)
1716

1817
enablePlugins(JavaAppPackaging)
@@ -30,7 +29,7 @@ val installAll =
3029
|apt-get -y update &&
3130
|apt-get install -y python2.7 python3.6 ca-certificates wget openjdk-8-jre-headless &&
3231
|wget "https://bootstrap.pypa.io/get-pip.py" -O /dev/stdout | python2.7 &&
33-
|wget "https://bootstrap.pypa.io/get-pip.py" -O /dev/stdout | python3.6 &&
32+
|wget "https://bootstrap.pypa.io/get-pip.py" -O /dev/stdout | python3.6 &&
3433
|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 &&
3534
|python3.6 -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 &&
3635
|python2.7 -m pip install pylint-common==0.2.2 &&

src/main/scala/codacy/Engine.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package codacy
22

3-
import codacy.dockerApi.DockerEngine
43
import codacy.pylint.Pylint
4+
import com.codacy.tools.scala.seed.DockerEngine
55

6-
object Engine extends DockerEngine(Pylint)
6+
object Engine extends DockerEngine(Pylint)()

src/main/scala/codacy/pylint/ParameterHeader.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package codacy.pylint
22

3-
import codacy.docker.api.Parameter
3+
import com.codacy.plugins.api.results.Parameter
44

55
private[pylint] object ParameterHeader {
66

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@ package codacy.pylint
33
import java.io.File
44
import java.nio.file.{Files, Path}
55

6-
import codacy.docker.api._
7-
import codacy.docker.api.utils.ToolHelper
8-
import codacy.dockerApi.utils.{CommandRunner, FileHelper}
6+
import com.codacy.plugins.api.{ErrorMessage, Options, Source}
7+
import com.codacy.plugins.api.results.{Parameter, Pattern, Result, Tool}
8+
import com.codacy.tools.scala.seed.utils.ToolHelper._
9+
import com.codacy.tools.scala.seed.utils.{CommandRunner, FileHelper}
910
import play.api.libs.json._
1011

1112
import scala.sys.process._
1213
import scala.util.{Properties, Success, Try}
1314

1415
object Pylint extends Tool {
1516

16-
private val pythonVersionKey = Configuration.Key("python_version")
17+
private val pythonVersionKey = Options.Key("python_version")
1718
private val python3 = "3"
1819

1920
def apply(source: Source.Directory, configuration: Option[List[Pattern.Definition]], files: Option[Set[Source.File]],
20-
options: Map[Configuration.Key, Configuration.Value])
21+
options: Map[Options.Key, Options.Value])
2122
(implicit specification: Tool.Specification): Try[List[Result]] = {
22-
val completeConf = ToolHelper.patternsToLint(configuration)
23+
val completeConf = configuration.withDefaultParameters
2324

2425
def isEnabled(issue: Result) = {
2526
issue match {
@@ -65,7 +66,7 @@ object Pylint extends Tool {
6566
linesTry.map { line => line.flatMap(parseLine).flatten.filter(isEnabled) }
6667
}
6768

68-
private def parseLine(line: String) = {
69+
private def parseLine(line: String): Option[List[Result]] = {
6970
val LineRegex = """(.*?)###(\d*?)###(.*?)###(.*?)""".r
7071

7172
def createIssue(filename: String, lineNumber: String, message: String, patternId: String) = {

0 commit comments

Comments
 (0)