Skip to content

Commit 750967a

Browse files
Merge pull request #257 from sourcerer-io/develop
feat: add markdown and qml langs support, add java 10 support
2 parents 32b50d9 + 95bae11 commit 750967a

File tree

8 files changed

+70
-41
lines changed

8 files changed

+70
-41
lines changed

README.md

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,43 @@
1-
21
<h1 style="font-weight:normal">
32
<a href="https://sourcerer.io"><img src=https://user-images.githubusercontent.com/20287615/34189346-d426d4c2-e4ef-11e7-9da4-cc76a1ed111d.png alt="Sourcerer Logo", width=50></a>
43
&nbsp; sourcerer.io
54
</h1>
6-
A visual profile for software engineers. Start with your public GitHub at <a href="https://sourcerer.io/start">https://sourcerer.io/start</a>. Screenshot below.
5+
A visual profile for software engineers.
6+
<br>
7+
8+
Start with your public GitHub at <a href="https://sourcerer.io/start">https://sourcerer.io/start</a>.
79
<br>
810

9-
What is it?
10-
===========
11+
12+
Screenshot
13+
==========
1114

1215
![profile-sliced-sized](https://user-images.githubusercontent.com/20287615/34188912-b3aaf8ba-e4ed-11e7-861c-2adf13a921ac.png)
1316
<br>
1417

15-
Once you feed it some git repos, you will get a beautiful profile that will help
16-
you learn things about yourself, connect to others, and become a better
17-
engineer. Example profiles: <https://sourcerer.io/sergey>,
18-
<https://sourcerer.io/ddeveloperr>, <https://sourcerer.io/osantana>, <https://sourcerer.io/adnanrahic>.
18+
What is it?
19+
===========
20+
21+
Once you feed [Sourcerer](https://sourcerer.io/) some git repos, you will get a beautiful profile that will help you learn things about yourself, connect to others, and become a better
22+
engineer.
1923

20-
Profile is the first step. Some of the things on our roadmap:
21-
news that is relevant to your code, engineers to follow and learn from,
22-
technology and libraries you should know about, projects
23-
that could use your help.
24+
Example profiles:<br>
25+
<https://sourcerer.io/sergey><br>
26+
<https://sourcerer.io/ddeveloperr><br>
27+
<https://sourcerer.io/wanghuaili><br>
28+
<https://sourcerer.io/adnanrahic><br>
2429

25-
Both open source and closed source repos are fine. The easiest way to get started with open source repos is to go to
26-
<https://sourcerer.io/start>, and select GitHub. For closed source repos, you can
27-
use this Sourcerer app. You will still need an account, which you can get at <https://sourcerer.io/>
30+
Both open source and closed source repos are fine. The easiest way to get started is with your open source repos. Go to <https://sourcerer.io/start>, and select *Build with GitHub* and watch your profile build. For closed source repos, you will need to use this app. If you already created an account using GitHub, you would have received an email with credentials for the app. If not, You will need a new account, which you can get at <https://sourcerer.io/start>, and select *Build with app*.
2831

29-
Sourcerer app does not upload source code anywhere, and it never will. The app looks at repos locally on your
30-
machine, and then sends stats to sourcerer.io. The best way to verify is to
31-
look at the code. [src/main/proto/sourcerer.proto](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/proto/sourcerer.proto)
32+
The Sourcerer app does **NOT** upload source code anywhere, and it **NEVER** will. The app looks at repos locally on your machine, and then sends stats to sourcerer.io. The best way to verify is to look at the code. [src/main/proto/sourcerer.proto](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/proto/sourcerer.proto)
3233
is a good start as it describes the client-server protocol.
3334

34-
You will need an account, sign up on <https://sourcerer.io/>
35+
Creating your profile is just the first step for us at Sourcerer. Some of the things on our roadmap include:
36+
* News that is relevant to your code
37+
* Engineers to follow and learn from
38+
* Technology and libraries you should know about
39+
* Projects that could use your help
40+
3541

3642
Requirements
3743
============
@@ -75,7 +81,17 @@ $ gradle build -Penv=production
7581
$ java -jar build/libs/sourcerer-app.jar
7682
```
7783

78-
Contribution
84+
Contributing
7985
============
8086

81-
We welcome contributions to Sourcerer App by the community. Check the [Contribution guide](https://github.com/sourcerer-io/sourcerer-app/blob/master/CONTRIBUTING.md) for more information.
87+
We love contributions! Check out the [Contribution guide](https://github.com/sourcerer-io/sourcerer-app/blob/master/CONTRIBUTING.md) for more information.
88+
89+
Some handy links:<br>
90+
* [Sourcerer Site](https://sourcerer.io/)
91+
* [Sourcerer Blog](https://blog.sourcerer.io)
92+
* [Follow Sourcerer on Twitter](https://twitter.com/sourcerer_io)
93+
* [Follow Sourcerer on Facebook](https://www.facebook.com/sourcerer.io/)
94+
95+
License
96+
=======
97+
Sourcerer is under the MIT license. See the [LICENSE](https://github.com/sourcerer-io/sourcerer-app/blob/develop/LICENSE.md) for more information.

build.gradle

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2017 Sourcerer Inc. All Rights Reserved.
22

33
buildscript {
4-
ext.kotlin_version = '1.1.51'
4+
ext.kotlin_version = '1.2.31'
55
repositories {
66
mavenCentral()
77
jcenter()
@@ -95,17 +95,17 @@ dependencies {
9595
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
9696
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
9797
compile "com.beust:jcommander:1.72"
98-
compile 'com.google.protobuf:protobuf-java:3.4.0'
98+
compile 'com.google.protobuf:protobuf-java:3.5.1'
9999
compile 'commons-codec:commons-codec:1.5'
100-
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.9'
101-
compile 'com.fasterxml.jackson.module:jackson-module-kotlin:2.8.9'
102-
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.8.9'
103-
compile 'io.reactivex.rxjava2:rxjava:2.1.6'
104-
compile 'com.github.kittinunf.fuel:fuel:1.11.0'
105-
compile 'com.github.kittinunf.fuel:fuel-rxjava:1.11.0'
100+
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.5'
101+
compile 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.5'
102+
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.5'
103+
compile 'io.reactivex.rxjava2:rxjava:2.1.12'
104+
compile 'com.github.kittinunf.fuel:fuel:1.12.1'
105+
compile 'com.github.kittinunf.fuel:fuel-rxjava:1.12.1'
106106
compile 'org.eclipse.jgit:org.eclipse.jgit:4.9.0.201710071750-r'
107107
compile 'org.slf4j:slf4j-nop:1.7.2'
108-
compile 'io.sentry:sentry:1.6.0'
108+
compile 'io.sentry:sentry:1.7.3'
109109

110110
testCompile 'org.jetbrains.kotlin:kotlin-test'
111111
testCompile 'org.jetbrains.spek:spek-api:1.1.5'
@@ -115,7 +115,7 @@ dependencies {
115115

116116
protobuf {
117117
protoc {
118-
artifact = "com.google.protobuf:protoc:3.4.0"
118+
artifact = "com.google.protobuf:protoc:3.5.1"
119119
}
120120
}
121121

src/install/install

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ fi
4545
VERSION=0
4646
if which java > /dev/null ; then
4747
VERSION_STR=\$(java -version 2>&1 | awk -F '"' '/version/ {print \$2}')
48-
if [[ "\$VERSION_STR" > "9." ]]; then # Format: 9.0.1
48+
if [[ "\$VERSION_STR" = "10" || "\$VERSION_STR" > "10" ]]; then # Format: 10
49+
VERSION=10
50+
elif [[ "\$VERSION_STR" > "9." ]]; then # Format: 9.0.1
4951
VERSION=9
5052
elif [[ "\$VERSION_STR" > "1.8." ]]; then # Format: 1.8.1
5153
VERSION=8
@@ -65,8 +67,8 @@ if [ \$VERSION = 0 ] ; then
6567
exit 1
6668
fi
6769
68-
# Java 9 requires additional parameters.
69-
if [ \$VERSION = 9 ] ; then
70+
# Java 9 and 10 requires additional parameters.
71+
if [[ \$VERSION = 9 || \$VERSION = 10 ]] ; then
7072
java --add-modules java.activation --add-opens java.base/java.nio=ALL-UNNAMED -jar $JAR_DIR/sourcerer.jar "\$@"
7173
else
7274
java -jar $JAR_DIR/sourcerer.jar "\$@"

src/main/kotlin/app/Logger.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ object Logger {
225225
}
226226
}
227227

228-
val isDebug: Boolean
229-
inline get() = LEVEL >= DEBUG
228+
val isTrace: Boolean
229+
inline get() = LEVEL >= TRACE
230230

231231
@kotlin.PublishedApi
232232
internal fun addBreadcrumb(message: String, level: Breadcrumb.Level) {

src/main/kotlin/app/extractors/CommonExtractor.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class CommonExtractor : ExtractorInterface {
3737
reversedMap["lisp"] = listOf("lisp", "lsp", "l")
3838
reversedMap["lua"] = listOf("lua")
3939
reversedMap["makefile"] = listOf("makefile")
40+
reversedMap["markdown"] = listOf("md", "markdown")
4041
reversedMap["matlab"] = listOf("m", "mlx")
4142
reversedMap["maven"] = listOf("pom")
4243
reversedMap["ocaml"] = listOf("ml", "mli")
@@ -47,6 +48,7 @@ class CommonExtractor : ExtractorInterface {
4748
reversedMap["processing"] = listOf("pde")
4849
reversedMap["prolog"] = listOf("P")
4950
reversedMap["puppet"] = listOf("pp")
51+
reversedMap["qml"] = listOf("qml")
5052
reversedMap["r"] = listOf("r", "R")
5153
reversedMap["rust"] = listOf("rs")
5254
reversedMap["sas"] = listOf("sas")

src/main/kotlin/app/extractors/ExtractorInterface.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,15 @@ interface ExtractorInterface {
203203
probabilities[libraries.indexOf(it)] >= 0.2 * maxProbability
204204
}
205205

206+
// For languages with small number of libraries(e.g. less than 20).
207+
// When found high probability then there won't be two or more
208+
// values with high probability. And vise versa,
209+
// if several values with high probability are found
210+
// then the prediction is unsure. So we don't take them into account.
211+
if (libraries.size < 20 && selectedCategories.size > 1) {
212+
return emptyList()
213+
}
214+
206215
if (maxProbabilityCategory == languageLabel) {
207216
return emptyList()
208217
}

src/main/kotlin/app/hashers/CommitCrawler.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,18 @@ object CommitCrawler {
135135
// Smart casts are not yet supported for a mutable variable captured
136136
// in an inline lambda, see
137137
// https://youtrack.jetbrains.com/issue/KT-7186.
138-
if (Logger.isDebug) {
138+
if (Logger.isTrace) {
139139
val commitName = commit.name
140140
val commitMsg = commit.shortMessage
141-
Logger.debug { "commit: $commitName; '$commitMsg'" }
141+
Logger.trace { "commit: $commitName; '$commitMsg'" }
142142
if (parentCommit != null) {
143143
val parentCommitName = parentCommit.name
144144
val parentCommitMsg = parentCommit.shortMessage
145-
Logger.debug { "parent commit: $parentCommitName; " +
145+
Logger.trace { "parent commit: $parentCommitName; " +
146146
"'$parentCommitMsg'" }
147147
}
148148
else {
149-
Logger.debug { "parent commit: null" }
149+
Logger.trace { "parent commit: null" }
150150
}
151151
}
152152

src/test/kotlin/test/tests/extractors/ExtractorTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class ExtractorTest : Spek({
112112
}
113113

114114
it("ruby extractor extracts rails") {
115-
val line = "class Article < ApplicationRecord"
115+
val line = "class Article < ActiveRecord::Base"
116116
assertExtractsLineLibraries("rails",
117117
line, RubyExtractor())
118118
}

0 commit comments

Comments
 (0)