SOKRATES
Polyglot source code examination tool
|
"Talk is expensive. Show me the code."
― Željko Obrenović
See a 5 minutes video on using Sokrates CLI to analyze source code of Sokrates:
See a 5 minutes video on using Sokrates Explorer to analyze source code of JUnit4:
DOWNLOAD: sokrates-LATEST.jar (40 MB)
Usage: java -jar sokrates.jar <command> <options> Help: java -jar sokrates.jar <command> -help Commands: init, generateReports, updateLandscape, updateConfig, extractGitHistory, createConventionsFile, exportStandardConventions, extractGitSubHistory * init: Creates a new Sokrates analysis configuration file based on standard and optional custom conventions - options: [-srcRoot <arg>] [-confFile <arg>] [-conventionsFile <arg>] [-name <arg>] [-description <arg>] [-logoLink <arg>] [-addLink <arg>] [-timeout <arg>] [-help] * generateReports: Generates Sokrates reports based on the analysis configuration - options: [-confFile <arg>] [-outputFolder <arg>] [-internalGraphviz] [-timeout <arg>] [-date <arg>] [-help] * updateLandscape: Updates or creates a Sokrates landscape report, aggregating results of multiple analyses - options: [-analysisRoot <arg>] [-confFile <arg>] [-recursive] [-setName <arg>] [-setDescription <arg>] [-setLogoLink <arg>] [-addLink <arg>] [-timeout <arg>] [-date <arg>] [-help] * updateConfig: Updates an analysis configuration file and completes missing fields - options: [-confFile <arg>] [-skipComplexAnalyses] [-setCacheFiles <arg>] [-setName <arg>] [-setDescription <arg>] [-setLogoLink <arg>] [-addLink <arg>] [-timeout <arg>] [-help] * extractGitHistory: Extract a git history in a format used by Sokrates and saves it in the git-history.txt file - options: [-analysisRoot <arg>] [-help] * createConventionsFile: Create a new analysis conventions file and saves it in <current-folder>/analysis_conventions.json * exportStandardConventions: Export standard Sokrates analysis convention to <current-folder>/standard_analysis_conventions.json. * extractGitSubHistory: A utility function to split a git history file (git-history.txt) into smaller ones based on a commit file path prefix, removing the prefix from file path in split files - options: [-prefix <arg>] [-analysisRoot <arg>] [-help]
git clone https://github.com/junit-team/junit4 cd junit4 java -jar <sokrates-folder>/sokrates-LATEST.jar extractGitHistory java -jar <sokrates-folder>/sokrates-LATEST.jar init java -jar <sokrates-folder>/sokrates-LATEST.jar generateReports open _sokrates/reports/html/index.html
git clone https://github.com/junit-team/junit4 cd junit4 java -jar <sokrates-folder>/sokrates-LATEST.jar extractGitHistory java -jar <sokrates-folder>/sokrates-LATEST.jar init java -jar <sokrates-folder>/sokrates-LATEST.jar generateReports cd .. git clone https://github.com/junit-team/junit5 cd junit5 java -jar <sokrates-folder>/sokrates-LATEST.jar extractGitHistory java -jar <sokrates-folder>/sokrates-LATEST.jar init java -jar <sokrates-folder>/sokrates-LATEST.jar generateReports cd .. mkdir landscape mv junit4/_sokrates landscape/junit4 mv junit5/_sokrates landscape/junit5 rm -rf junit4 rm -rf junit5 cd landscape java -jar <sokrates-folder>/sokrates-LATEST.jar updateLandscape open _sokrates_landscape/index.html
git clone https://github.com/junit-team/junit5 cd junit5 java -jar <sokrates-folder>/sokrates-LATEST.jar extractGitHistory java -jar <sokrates-folder>/sokrates-LATEST.jar createConventionsFile # edit the 'analysis_conventions.json' file to define your custom conventions java -jar <sokrates-folder>/sokrates-LATEST.jar init -conventionsFile analysis_conventions.json java -jar <sokrates-folder>/sokrates-LATEST.jar generateReports
DOWNLOAD: sokrates-explorer-LATEST.jar (78 MB)
NOTE: require JavaFX (download it and install it from openjfx.io)
java --module-path $JAVAFX_HOME/lib --add-modules=javafx.controls,javafx.web -jar sokrates-explorer-LATEST.jar
java -jar <sokrates-folder>/sokrates-LATEST.jar createConventionsFile # edit the 'analysis_conventions.json' file to define your custom conventions java -jar <sokrates-folder>/sokrates-LATEST.jar init -conventionsFile analysis_conventions.json
java -jar <sokrates-folder>/sokrates-LATEST.jar exportStandardConventions
NOTE: Analysis is limited to repositories with commits in past year or two.
Logical decomposition is a representation of the organization of the main source code, where every and each file is put in exactly one logical component.