Skip to content

Commit 196787b

Browse files
authored
Merge pull request #17 from codacy/refactor
Refactor to use new API
2 parents 0f3cdf9 + 8ba6711 commit 196787b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2115
-999
lines changed

.circleci/config.yml

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# CircleCI 2.0 configuration file
2+
version: 2
3+
4+
# Re-usable blocks to reduce boilerplate in job definitions.
5+
references:
6+
host_environment_defaults: &host_environment_defaults
7+
# Customize the JVM maximum heap limit
8+
JAVA_OPTS: -Xmx3200m
9+
docker_environment_defaults: &docker_environment_defaults
10+
# Customize the JVM to read correct memory values
11+
JAVA_OPTS: '-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1'
12+
13+
default_java_job: &default_java_job
14+
docker:
15+
- image: circleci/openjdk:8-jdk
16+
environment:
17+
<<: *docker_environment_defaults
18+
environment:
19+
<<: *host_environment_defaults
20+
working_directory: ~/workdir
21+
22+
restore_source_code: &restore_source_code
23+
restore_cache:
24+
keys:
25+
- source-code-1.0.0-{{ .Branch }}-{{ .Revision }}
26+
- source-code-1.0.0-{{ .Branch }}
27+
- source-code-1.0.0
28+
restore_dependencies: &restore_dependencies
29+
restore_cache:
30+
keys:
31+
- sbt-ivy2-dependencies-1.0.0-{{ checksum "/tmp/dependencies.cache.tmp" }}
32+
- sbt-ivy2-dependencies-1.0.0
33+
restore_build: &restore_build
34+
restore_cache:
35+
keys:
36+
- sbt-build-1.0.0-{{ .Branch }}-{{ .Revision }}
37+
- sbt-build-1.0.0
38+
39+
setup_dependencies_key: &setup_dependencies_key
40+
run:
41+
name: Generate cache key
42+
command: |
43+
shasum build.sbt \
44+
project/plugins.sbt \
45+
project/build.properties \
46+
project/Common.scala \
47+
project/Dependencies.scala > /tmp/dependencies.cache.tmp
48+
49+
jobs:
50+
checkout_code:
51+
<<: *default_java_job
52+
steps:
53+
- *restore_source_code
54+
- checkout
55+
- save_cache:
56+
key: source-code-1.0.0-{{ .Branch }}-{{ .Revision }}
57+
paths:
58+
- ~/workdir
59+
60+
sbt_dependencies:
61+
<<: *default_java_job
62+
steps:
63+
- *restore_source_code
64+
- *setup_dependencies_key
65+
- *restore_dependencies
66+
- run:
67+
name: Resolve dependencies
68+
command: |
69+
sbt update
70+
- save_cache:
71+
paths:
72+
- ~/.ivy2
73+
- ~/.sbt
74+
key: sbt-ivy2-dependencies-1.0.0-{{ checksum "/tmp/dependencies.cache.tmp" }}
75+
76+
compile:
77+
<<: *default_java_job
78+
steps:
79+
- *restore_source_code
80+
- *setup_dependencies_key
81+
- *restore_dependencies
82+
- *restore_build
83+
- run:
84+
name: Compile
85+
command: ./scripts/compile.sh
86+
- save_cache:
87+
paths:
88+
- ~/workdir/target
89+
- ~/workdir/project/target
90+
key: sbt-build-1.0.0-{{ .Branch }}-{{ .Revision }}
91+
92+
test:
93+
<<: *default_java_job
94+
steps:
95+
- *restore_source_code
96+
- *setup_dependencies_key
97+
- *restore_dependencies
98+
- *restore_build
99+
- run:
100+
name: Test
101+
command: ./scripts/test.sh
102+
- run:
103+
name: Store test reports
104+
working_directory: ~/
105+
command: |
106+
mkdir -p ~/coverage-reports/scoverage
107+
cp -f ~/workdir/target/scala-2.12/coverage-report/cobertura.xml ~/coverage-reports/scoverage/results.xml
108+
- store_test_results:
109+
path: ~/coverage-reports
110+
- store_artifacts:
111+
path: ~/workdir/target/scala-2.12/coverage-report
112+
- store_artifacts:
113+
path: ~/workdir/target/scala-2.12/scoverage-report
114+
- store_artifacts:
115+
path: ~/workdir/target/scala-2.12/scoverage-data
116+
117+
lint:
118+
<<: *default_java_job
119+
steps:
120+
- *restore_source_code
121+
- *setup_dependencies_key
122+
- *restore_dependencies
123+
- *restore_build
124+
- run:
125+
name: Lint
126+
command: ./scripts/lint.sh
127+
128+
publish:
129+
<<: *default_java_job
130+
steps:
131+
- *restore_source_code
132+
- *setup_dependencies_key
133+
- *restore_dependencies
134+
- *restore_build
135+
- run:
136+
name: Install AWS CLI
137+
command: |
138+
sudo apt -y update
139+
sudo apt -y install python3-pip
140+
sudo python3 -m pip install awscli
141+
- run:
142+
name: Setup AWS Credentials
143+
command: ./scripts/setup-aws-credentials.sh
144+
- run:
145+
name: Retrieve GPG Keys
146+
command: |
147+
mkdir -p ~/.gnupg
148+
aws s3 sync --profile shared-services --include '*.gpg' s3://$AWS_CREDENTIALS_BUCKET/gnupg/ ~/.gnupg
149+
- run:
150+
name: Publish to Sonatype
151+
command: ./scripts/publish.sh 3.0.$CIRCLE_BUILD_NUM
152+
153+
workflows:
154+
version: 2
155+
test-and-publish:
156+
jobs:
157+
- checkout_code
158+
- sbt_dependencies:
159+
requires:
160+
- checkout_code
161+
- compile:
162+
requires:
163+
- checkout_code
164+
- sbt_dependencies
165+
- test:
166+
requires:
167+
- compile
168+
- lint:
169+
requires:
170+
- compile
171+
- publish:
172+
context: CodacyAWS
173+
requires:
174+
- test
175+
- lint
176+
filters:
177+
branches:
178+
only:
179+
- master

.scalafix.conf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
rules = [
2+
RemoveUnusedImports
3+
RemoveUnusedTerms
4+
ExplicitResultTypes
5+
ExplicitUnit
6+
LeakingImplicitClassVal
7+
MissingFinal
8+
NoAutoTupling
9+
NoInfer
10+
NoValInForComprehension
11+
ProcedureSyntax
12+
Sbt1
13+
]
14+
15+
NoInfer.symbols = [
16+
"java.io.Serializable",
17+
"scala.Any",
18+
"scala.AnyVal",
19+
"scala.Product"
20+
]
21+
22+
ExplicitResultTypes {
23+
unsafeShortenNames = true
24+
}

.scalafmt.conf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
style = IntelliJ
2+
maxColumn = 120
3+
docstrings = ScalaDoc
4+
assumeStandardLibraryStripMargin = false
5+
continuationIndent.callSite = 2
6+
continuationIndent.defnSite = 2
7+
align = some
8+
align.tokens = []
9+
align.arrowEnumeratorGenerator = false
10+
align.openParenCallSite = true
11+
align.openParenDefnSite = true
12+
newlines.alwaysBeforeTopLevelStatements = true
13+
newlines.penalizeSingleSelectMultiArgList = true
14+
newlines.alwaysBeforeElseAfterCurlyIf = false
15+
newlines.sometimesBeforeColonInMethodReturnType = true
16+
rewrite.rules = [ AvoidInfix, SortImports, SortModifiers, PreferCurlyFors ]
17+
newlines.alwaysBeforeMultilineDef = true
18+
lineEndings = unix
19+
binPack.literalArgumentLists = true
20+
binPack.parentConstructors = false
21+
spaces.afterKeywordBeforeParen = true
22+
includeCurlyBraceInSelectChains = true
23+
optIn.breakChainOnFirstMethodDot = true
24+
danglingParentheses = true
25+
includeCurlyBraceInSelectChains = true
26+
project.git = true
27+
project.excludeFilters = [".*\\.scala.html$", "target/.*", "modules/admin/target/.*"]
28+

CONTRIBUTING.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# How to contribute
2+
3+
## Main rules
4+
5+
* Before you open a ticket or send a pull request, [search](https://github.com/codacy/codacy-engine-scala-seed/issues) for previous discussions about the same feature or issue. Add any new details to earlier tickets if you find any.
6+
7+
* If you're proposing a new feature, make sure you create an issue to let other contributors know what you will be working on.
8+
9+
* Before sending a pull request make sure your code is tested.
10+
11+
* Before sending a pull request for a feature, be sure to run tests with `./scripts/test.sh`.
12+
13+
* Use the same coding style as the rest of the codebase, most of the checks can be performed with `./scripts/lint.sh`.
14+
15+
* Use `git rebase` (not `git merge`) to sync your work from time to time with the master branch.
16+
17+
* After creating your pull request make sure the build is passing on [CircleCI](https://circleci.com/gh/codacy/codacy-engine-scala-seed) and that [Codacy](https://www.codacy.com/app/Codacy/codacy-engine-scala-seed) is also confident in the code quality.
18+
19+
## Commit Style
20+
21+
Writing good commit logs is important. A commit log should describe what changed and why.
22+
Follow these guidelines when writing one:
23+
24+
1. The first line should be 50 characters or less and contain a short
25+
description of the change prefixed with the name of the changed
26+
subsystem (e.g. "net: add localAddress and localPort to Socket").
27+
2. Keep the second line blank.
28+
3. Wrap all other lines at 72 columns.
29+
30+
A good commit log can look something like this:
31+
32+
```git-commit
33+
subsystem: explaining the commit in one line
34+
35+
Body of commit message is a few lines of text, explaining things
36+
in more detail, possibly giving some background about the issue
37+
being fixed, etc. etc.
38+
39+
The body of the commit message can be several paragraphs, and
40+
please do proper word-wrap and keep columns shorter than about
41+
72 characters or so. That way `git log` will show things
42+
nicely even when it is indented.
43+
```
44+
45+
### Developer's Certificate of Origin 1.0
46+
47+
By making a contribution to this project, I certify that:
48+
49+
* (a) The contribution was created in whole or in part by me and I
50+
have the right to submit it under the open source license indicated
51+
in the file; or
52+
* (b) The contribution is based upon previous work that, to the best
53+
of my knowledge, is covered under an appropriate open source license
54+
and I have the right under that license to submit that work with
55+
modifications, whether created in whole or in part by me, under the
56+
same open source license (unless I am permitted to submit under a
57+
different license), as indicated in the file; or
58+
* (c) The contribution was provided directly to me by some other
59+
person who certified (a), (b) or (c) and I have not modified it.

0 commit comments

Comments
 (0)