Skip to content

Commit 9717021

Browse files
Merge pull request #305 from sourcerer-io/develop
feat: new tech classfiers
2 parents 0864dbb + 8474535 commit 9717021

File tree

2,042 files changed

+540552
-777
lines changed

Some content is hidden

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

2,042 files changed

+540552
-777
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/test/resources/samples/* linguist-vendored

README.md

Lines changed: 75 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,101 @@
11
<h1 style="font-weight:normal">
2-
<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>
3-
&nbsp; sourcerer.io
2+
<a href="https://sourcerer.io">
3+
<img src=https://user-images.githubusercontent.com/20287615/34189346-d426d4c2-e4ef-11e7-9da4-cc76a1ed111d.png alt="Sourcerer" width=35>
4+
</a>
5+
&nbsp;sourcerer.io&nbsp;
6+
<a href="https://sourcerer.io/start"><img src=https://img.shields.io/badge/sourcerer-start%20now-brightgreen.svg?colorA=087c08></a>
7+
<a href="https://github.com/sourcerer-io/sourcerer-app/releases"><img src=https://img.shields.io/github/release/sourcerer-io/sourcerer-app.svg?colorB=58839b></a>
8+
<a href="https://github.com/sourcerer-io/sourcerer-app/blob/master/LICENSE.md"><img src=https://img.shields.io/github/license/sourcerer-io/sourcerer-app.svg?colorB=ff0000></a>
49
</h1>
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>.
9-
<br>
10-
11-
12-
Screenshot
13-
==========
1410

15-
![profile-sliced-sized](https://user-images.githubusercontent.com/20287615/38911373-9f700892-4283-11e8-853b-1ca1fb9f5fa0.png)
11+
A visual profile for software engineers.
1612
<br>
1713

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.
23-
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>
29-
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*.
14+
<p align="center">
15+
<img alt="sergey" src="https://user-images.githubusercontent.com/20287615/42118899-cc2c0b94-7bbb-11e8-86a8-96dcd044b5e2.gif">
16+
</p>
3117

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)
33-
is a good start as it describes the client-server protocol.
18+
Features
19+
========
20+
* Profile creation with a single click
21+
* Support of 100 languages (even exotic ones like COBOL)
22+
* Detection of more than [1,000 libraries](https://github.com/sourcerer-io/awesome-libraries) in code with per-line statistics
23+
* Visual presentation your development experience
24+
* *Finally!* Summary of all repositories you've contributed to :tada:
25+
* Interesting facts about yourself
3426

3527
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
3728
* Engineers to follow and learn from
3829
* Technology and libraries you should know about
3930
* Projects that could use your help
4031

32+
Get started
33+
===========
34+
The easiest way to get started is with your open source repos. Go to [sourcerer.io/start](https://sourcerer.io/start), and select *Build with GitHub* and watch your profile build.
35+
36+
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 [sourcerer.io/join](https://sourcerer.io/join>).
37+
38+
Showcase
39+
========
40+
<center>
41+
<table>
42+
<tr>
43+
<td><a href="https://sourcerer.io/chdemko"><img width="120" alt="chdemko" src="https://user-images.githubusercontent.com/20287615/42243607-c7f6c40c-7ec6-11e8-9f8e-d4450d1d92d1.png"></a></td>
44+
<td><a href="https://sourcerer.io/chendaniely"><img width="120" alt="chendaniely" src="https://user-images.githubusercontent.com/20287615/42243623-d1bd479a-7ec6-11e8-983c-00945c926dc6.png"></a></td>
45+
<td><a href="https://sourcerer.io/lauragift21"><img width="120" alt="lauragift21" src="https://user-images.githubusercontent.com/20287615/42243624-d1d24cd0-7ec6-11e8-84c0-3a1aad54a774.png"></a></td>
46+
<td><a href="https://sourcerer.io/maracuja-juice"><img width="120" alt="maracuja-juice" src="https://user-images.githubusercontent.com/20287615/42243626-d1eb19c2-7ec6-11e8-8e94-fa02d8f11894.png"></a></td>
47+
</tr>
48+
<tr>
49+
<td><a href="https://sourcerer.io/marisbotero"><img width="120" alt="marisbotero" src="https://user-images.githubusercontent.com/20287615/42243627-d203bb58-7ec6-11e8-945e-49b878f07436.png"></a></td>
50+
<td><a href="https://sourcerer.io/nordes"><img width="120" alt="nordes" src="https://user-images.githubusercontent.com/20287615/42243628-d21df464-7ec6-11e8-9147-31b99ea3465d.png"></a></td>
51+
<td><a href="https://sourcerer.io/ppapadeas"><img width="120" alt="ppapadeas" src="https://user-images.githubusercontent.com/20287615/42243629-d23b27e6-7ec6-11e8-92c1-0c3edc2f3dba.png"></a></td>
52+
<td><a href="https://sourcerer.io/praharshjain"><img width="120" alt="praharshjain" src="https://user-images.githubusercontent.com/20287615/42243630-d2562abe-7ec6-11e8-8ad3-fd6ca3ddd413.png"></a></td>
53+
</tr>
54+
</table>
55+
</center>
4156

4257
Requirements
4358
============
59+
* Web browser
4460

45-
* Linux or macOS
46-
* Java 8+ Platform ([JRE](http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html) for Linux or [JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) for macOS)
47-
* Git repositories with master branch with at least one commit
48-
* Account on <https://sourcerer.io/>
61+
or
4962

50-
Install/uninstall
51-
=================
63+
* Linux or macOS or Windows
64+
* Java 8+ Platform ([JRE](http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html) for Linux and Windows or [JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) for macOS)
5265

66+
Usage
67+
=====
5368
To install sourcerer run the following command:
5469

5570
```
5671
curl -s https://sourcerer.io/app/install | bash
5772
```
5873

59-
To remove sourcerer from your machine:
74+
To run wizard use `sourcerer` command
6075

61-
```
62-
sourcerer --uninstall
63-
```
76+
Internals
77+
=========
78+
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. Protobuf messages declared in [src/main/proto/sourcerer.proto](https://github.com/sourcerer-io/sourcerer-app/blob/develop/src/main/proto/sourcerer.proto) is a good start as it describes the client-server protocol.
79+
The Sourcerer app does **NOT** upload source code anywhere, and it **NEVER** will.
80+
81+
FAQ
82+
===
83+
### How can I process private repos?
84+
We process only public repos using GitHub OAuth. To process private repos you need to run sourcerer app locally. See [Get started](#get-started) for instructions. Sourcerer app sends only statistical information to our servers and never sends code.
85+
86+
### Why do you need GitHub permissions?
87+
We use emails to identify commit authorship, read orgs access to get list of public repositories that you've contributed to. You also need to grant access to read this public information from an organization.
88+
89+
### Other questions
90+
See [sourcerer.io/faq](https://sourcerer.io/faq).
91+
92+
Contributing
93+
============
94+
We love contributions! Check out the [Contribution guide](https://github.com/sourcerer-io/sourcerer-app/blob/master/CONTRIBUTING.md) for more information. Simplest and really helpfull for the community would be contribution meta information to our [supported libraries list](https://github.com/sourcerer-io/awesome-libraries). If you an author of a library you show definitely add yours to the list or you can help to someone whose work you use.
6495

6596
Build
6697
=====
67-
68-
To build and run this application, you'll need latest versions of Git, Gradle and JDK installed on your computer. From your command line:
98+
To build and run this application locally, you'll need latest versions of Git, Gradle and JDK installed on your computer. From your command line:
6999

70100
```
71101
# Clone this repository
@@ -81,17 +111,13 @@ $ gradle build -Penv=production
81111
$ java -jar build/libs/sourcerer-app.jar
82112
```
83113

84-
Contributing
85-
============
86-
87-
We love contributions! Check out the [Contribution guide](https://github.com/sourcerer-io/sourcerer-app/blob/master/CONTRIBUTING.md) for more information.
114+
License
115+
=======
116+
Sourcerer is under the MIT license. See the [LICENSE](https://github.com/sourcerer-io/sourcerer-app/blob/develop/LICENSE.md) for more information.
88117

89-
Some handy links:<br>
118+
Links
119+
=====
90120
* [Sourcerer Site](https://sourcerer.io/)
91121
* [Sourcerer Blog](https://blog.sourcerer.io)
92122
* [Follow Sourcerer on Twitter](https://twitter.com/sourcerer_io)
93123
* [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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ buildConfig {
3636
buildConfigField 'String', 'PROFILE_URL', 'https://sourcerer.io/'
3737

3838
// App version.
39-
buildConfigField 'int', 'VERSION_CODE', '10'
40-
buildConfigField 'String', 'VERSION', '0.2.5'
39+
buildConfigField 'int', 'VERSION_CODE', '12'
40+
buildConfigField 'String', 'VERSION', '0.3.0'
4141

4242
// Logging.
4343
buildConfigField 'String', 'ENV', project.hasProperty('env') ? env : 'production'
@@ -53,7 +53,7 @@ buildConfig {
5353
buildConfigField 'boolean', 'IS_GA_ENABLED', 'true'
5454

5555
// Models storage path.
56-
buildConfigField 'String', 'LIBRARY_MODELS_URL', 'https://storage.googleapis.com/sourcerer-app/library-models/v1/'
56+
buildConfigField 'String', 'LIBRARY_MODELS_URL', 'https://storage.googleapis.com/sourcerer-app/library-models/v2/'
5757

5858
// Hashing.
5959
buildConfigField 'boolean', 'COMMIT_HASHER_ENABLED', project.hasProperty('commit-hasher-enabled') ? project.property('commit-hasher-enabled').toString() : 'true'
@@ -107,6 +107,7 @@ dependencies {
107107
compile 'org.slf4j:slf4j-nop:1.7.2'
108108
compile 'io.sentry:sentry:1.7.3'
109109

110+
testCompile 'commons-io:commons-io:2.6'
110111
testCompile 'org.jetbrains.kotlin:kotlin-test'
111112
testCompile 'org.jetbrains.spek:spek-api:1.1.5'
112113
testCompile 'org.junit.platform:junit-platform-runner:1.0.1'

do.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,61 +28,61 @@ GRADLE_VERSION=4.2.0
2828

2929
# run only inside build container
3030
build_jar_inside() {
31-
if [ "$NAMESPACE" == "sandbox" ]; then
31+
if [ "${NAMESPACE}" == "sandbox" ]; then
3232
API="https://sandbox.sourcerer/api/commit"
3333
LOG="debug"
34-
elif [ "$NAMESPACE" == "staging" ]; then
34+
elif [ "${NAMESPACE}" == "staging" ]; then
3535
API="https://staging.sourcerer/api/commit"
3636
LOG="info"
37-
elif [ "$NAMESPACE" == "local" ]; then
37+
elif [ "${NAMESPACE}" == "local" ]; then
3838
API="http://localhost:3181"
3939
LOG="debug"
4040
else
4141
API="https://sourcerer.io/api/commit"
4242
LOG="info"
4343
fi
44-
gradle -Penv=$NAMESPACE -Plog=$LOG -Papi=$API build
44+
gradle -Penv=${NAMESPACE} -Plog=${LOG} -Papi=${API} build
4545
}
4646

4747
build_jar() {
48-
docker run -i -v $VOLUME:/home/gradle/app --workdir=/home/gradle/app \
49-
-e LOG=$LOG -e NAMESPACE=$NAMESPACE \
50-
gradle:$GRADLE_VERSION \
48+
docker run -i -v ${VOLUME}:/home/gradle/app --workdir=/home/gradle/app \
49+
-e LOG=${LOG} -e NAMESPACE=${NAMESPACE} \
50+
gradle:${GRADLE_VERSION} \
5151
./do.sh build_jar_inside
5252
}
5353

5454
build_prod_inside() {
55-
docker build -t $REPO_NAME .
55+
docker build -t ${REPO_NAME} .
5656
}
5757

5858
deploy() {
5959
source ./deploy/${NAMESPACE}_env.sh
6060
envsubst < ./deploy/sourcerer-app.yaml > /tmp/deploy.yaml
61-
kubectl --namespace=$NAMESPACE apply -f /tmp/deploy.yaml
61+
kubectl --namespace=${NAMESPACE} apply -f /tmp/deploy.yaml
6262
}
6363

6464
######################
6565

6666
run_jar() {
67-
docker run -i -v $VOLUME:/app --workdir=/app gradle:$GRADLE_VERSION \
67+
docker run -i -v ${VOLUME}:/app --workdir=/app gradle:${GRADLE_VERSION} \
6868
java -jar build/libs/app.jar
6969
}
7070

7171
run_prod() {
72-
docker run -i -p $PORT:80 $REPO_NAME
72+
docker run -i -p ${PORT}:80 ${REPO_NAME}
7373
}
7474

7575
push() {
76-
gcloud docker -- push $REPO_NAME
76+
gcloud docker -- push ${REPO_NAME}
7777
}
7878

7979
#---------------------#
8080
#----- Execution -----#
8181
#---------------------#
8282

83-
fn_exists $COMMAND
83+
fn_exists ${COMMAND}
8484
if [ $? -eq 0 ]; then
85-
$COMMAND $ARGUMENTS
85+
${COMMAND} ${ARGUMENTS}
8686
else
8787
echo "Command not found"
8888
fi

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

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,15 @@
44

55
package app.extractors
66

7-
import app.model.CommitStats
8-
import app.model.DiffFile
9-
107
class CExtractor : ExtractorInterface {
118
companion object {
12-
const val LANGUAGE_NAME = "c"
13-
val FILE_EXTS = listOf("c")
14-
val evaluator by lazy {
15-
ExtractorInterface.getLibraryClassifier(LANGUAGE_NAME)
16-
}
9+
const val LANGUAGE_NAME = Lang.C
1710
val importRegex = Regex("""^([^\n]*#include)\s[^\n]*""")
1811
val commentRegex = Regex("""^([^\n]*//)[^\n]*""")
1912
val extractImportRegex =
2013
Regex("""#include\s+["<](\w+)[/\w+]*\.\w+[">]""")
2114
}
2215

23-
override fun extract(files: List<DiffFile>): List<CommitStats> {
24-
files.map { file -> file.language = LANGUAGE_NAME }
25-
return super.extract(files)
26-
}
27-
2816
override fun extractImports(fileContent: List<String>): List<String> {
2917
val imports = mutableSetOf<String>()
3018

@@ -45,9 +33,13 @@ class CExtractor : ExtractorInterface {
4533
return super.tokenize(newLine)
4634
}
4735

48-
override fun getLineLibraries(line: String,
49-
fileLibraries: List<String>): List<String> {
36+
override fun mapImportToIndex(import: String, lang: String,
37+
startsWith: Boolean): String? {
38+
// TODO(lyaronskaya): Add C to libraries.
39+
return super.mapImportToIndex(import, Lang.CPP, startsWith = true)
40+
}
5041

51-
return super.getLineLibraries(line, fileLibraries, evaluator, LANGUAGE_NAME)
42+
override fun getLanguageName(): String? {
43+
return LANGUAGE_NAME
5244
}
5345
}

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

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,39 @@
44

55
package app.extractors
66

7-
import app.model.CommitStats
8-
import app.model.DiffFile
9-
107
class CSharpExtractor : ExtractorInterface {
118
companion object {
12-
val LANGUAGE_NAME = "csharp"
13-
val FILE_EXTS = listOf("cs")
14-
val LIBRARIES = ExtractorInterface.getLibraries("cs")
15-
val evaluator by lazy {
16-
ExtractorInterface.getLibraryClassifier(LANGUAGE_NAME)
17-
}
9+
const val LANGUAGE_NAME = Lang.CSHARP
1810
val importRegex = Regex("""^.*using\s+(\w+[.\w+]*)""")
1911
val commentRegex = Regex("""^([^\n]*//)[^\n]*""")
2012
val extractImportRegex = Regex("""using\s+(\w+[.\w+]*)""")
2113
}
2214

23-
override fun extract(files: List<DiffFile>): List<CommitStats> {
24-
files.map { file -> file.language = LANGUAGE_NAME }
25-
return super.extract(files)
26-
}
27-
2815
override fun extractImports(fileContent: List<String>): List<String> {
2916
val imports = mutableSetOf<String>()
3017

3118
fileContent.forEach {
3219
val res = extractImportRegex.find(it)
3320
if (res != null) {
34-
val importedName = res.groupValues[1]
35-
LIBRARIES.forEach { library ->
36-
if (importedName.startsWith(library)) {
37-
imports.add(library)
38-
}
39-
}
21+
imports.add(res.groupValues[1])
4022
}
4123
}
4224

4325
return imports.toList()
4426
}
4527

4628
override fun tokenize(line: String): List<String> {
47-
val importRegex = Regex("""^.*using\s+(\w+[.\w+]*)""")
48-
val commentRegex = Regex("""^([^\n]*//)[^\n]*""")
4929
var newLine = importRegex.replace(line, "")
5030
newLine = commentRegex.replace(newLine, "")
5131
return super.tokenize(newLine)
5232
}
5333

54-
override fun getLineLibraries(line: String,
55-
fileLibraries: List<String>): List<String> {
34+
override fun mapImportToIndex(import: String, lang: String,
35+
startsWith: Boolean): String? {
36+
return super.mapImportToIndex(import, lang, startsWith = true)
37+
}
5638

57-
return super.getLineLibraries(line, fileLibraries, evaluator,
58-
LANGUAGE_NAME)
39+
override fun getLanguageName(): String? {
40+
return LANGUAGE_NAME
5941
}
6042
}

0 commit comments

Comments
 (0)