Skip to content

Instantly share code, notes, and snippets.

View BFergerson's full-sized avatar

Brandon Fergerson BFergerson

View GitHub Profile
package com.assemblyai.api.resources.files
import com.assemblyai.api.core.ApiError
import com.assemblyai.api.core.ClientOptions
import com.assemblyai.api.core.ObjectMappers
import com.assemblyai.api.types.UploadedFile
import io.vertx.core.buffer.Buffer
import io.vertx.ext.web.client.HttpRequest
import io.vertx.ext.web.client.HttpResponse
import io.vertx.ext.web.client.WebClient
fun setup() = listOf(
match(
fighter called "fighter"
has AVG_FIGHT_TIME called "avg_fight_time"
) min "avg_fight_time" called "min_avg_fight_time"
)
fun query() = match(
fighter called "fighter"
has AVG_FIGHT_TIME equalTo named("min_avg_fight_time")
SocraticAPI.administration().config(ConfigOption.cyclomatic_complexity, true).build().execute()
SocraticAPI.administration().init().build().execute() //installs Apache Skywalking and Babelfish via Docker
SocraticAPI.administration().addRemoteRepo()
.repoName("bfergerson/method-complexity")
.build().execute() //clones and scans https://github.com/bfergerson/method-complexity
println SocraticAPI.knowledge().question()
.question("what is the most complex method?")
.build().execute().answer
// Answer: ComplexMethods.mostComplexMethod()
match
#find all functions in bfergerson/myproject
$myProject isa project has name "bfergerson/myproject";
$myFile isa file; ($myFile, $myProject) isa defines;
$myFunction isa function-instance; ($myFunction, $myFile) isa defines;
#follow defined functions to referenced functions
($myFunction, $funcDefs) isa function_definition;
($funcDefs, $func); ($func, $funcRefs);
project sub entity
has create_date
has project_name
plays has_defines_file;
file sub entity
has create_date
has file_name
has subkind
has file_location
has qualified_name
@BFergerson
BFergerson / Main.java
Created March 29, 2018 15:11
Your Java compiler can't handle this
interface Z {}
interface N<x> {}
interface L<x> {}
interface Qlr<x> {}
interface Qrl<x> {}
interface E<x> extends
Qlr<N<?super Qr<?super E<?super E<?super x>>>>>,
Qrl<N<?super Ql<?super E<?super E<?super x>>>>> {}
interface Ql<x> extends
L<N<?super Ql<?super L<?super N<?super x>>>>>,