Exakat commands

List of commands :

  • anonymize
  • catalog
  • clean
  • cleandb
  • doctor
  • help
  • init
  • project
  • report
  • remove
  • update
  • upgrade

anonymize

Read files, directory or projects, and produce a anonymized version of the code. Consistence between variables and names is preserved ($a will always be replaced by the same name). PHP language structures, such as eval, isset or unset are preserved, though other native functions are not.

File structure is not preserved : all files are renamed, and the hiearchy is flattented in one folder. As such, code is probably un-runnable if it relies on inclusions.

Non-PHP files, non-lintable or files that produces one PHP token are ignored.

Command

exakat anonymize -p <project>
exakat anonymize -d <directory>
exakat anonymize -file <filename>

Options

Option Req Description
-p No Project name. Should be filesystem compatible (avoid / or ). This takes into account <project> configuration
-d No Directory to anonymize. Results will be in <directory>.anon
-file No File to anonymize. Result will be <file>.anon
-v No Verbose mode

Tips

  • -R is not compulsory : you may omit it, then, provide PHP files in the projects/<name>/code folder by the mean you want.

catalog

Catalog list all available themes and reports with the current exakat.

This is a help command, to help find the available values for various options.

Options

Option Req Description
-json No Returns the catalog as JSON, for further processing.

clean

Cleans the provided project of everything except the config.ini and the code.

This is a maintenance command, that removes all produced files and folder, and restores a project to its initial state.

Options

Option Req Description
-p Yes Project name. Should be an existing project.
-v No Verbose mode

cleandb

Cleans the graph database.

This is a maintenance command, that removes all produced data and scripts, and restores the exakat database to its empty state.

By default, the database is cleaned with graph commands, letting the server do the cleaning.

The -Q option makes the same cleaning with a full restart of the server. This is cleaner, and faster if the database was big or in some instable state.

Options

Option Req Description
-Q No Cleans the database by restarting it, and removing files.
-v No Verbose mode

doctor

Check the current installation of Exakat.

Command

exakat doctor

Results

PHP :
    version              : 7.0.1
    curl                 : Yes
    sqlite3              : Yes
    tokenizer            : Yes

java :
    installed            : Yes
    type                 : Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
    version              : 1.8.0_40
    $JAVA_HOME           : /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home

neo4j :
    version              : Neo4j 2.2.6
    port                 : 7474
    authentication       : Not enabled (Please, enable it)
    gremlinPlugin        : Configured.
    gremlinJar           : neo4j/plugins/gremlin-plugin/gremlin-java-2.7.0-SNAPSHOT.jar
    scriptFolder         : Yes
    pid                  : 20895
    running              : Yes
    running here         : Yes
    gremlin              : Yes
    $NEO4J_HOME          : /Users/famille/Desktop/analyze/neo4j

folders :
    config-folder        : Yes
    config.ini           : Yes
    projects folder      : Yes
    progress             : Yes
    in                   : Yes
    out                  : Yes
    projects/test        : Yes
    projects/default     : Yes
    projects/onepage     : Yes

PHP 5.2 :
    configured           : No

PHP 5.3 :
    configured           : Yes
    installed            : Yes
    version              : 5.3.29
    short_open_tags      : Off
    timezone             : Europe/Amsterdam
    tokenizer            : Yes
    memory_limit         : -1

PHP 5.4 :
    configured           : Yes
    installed            : Yes
    version              : 5.4.45
    short_open_tags      : Off
    timezone             : Europe/Amsterdam
    tokenizer            : Yes
    memory_limit         : 384M

PHP 5.5 :
    configured           : Yes
    installed            : Yes
    version              : 5.5.30
    short_open_tags      : Off
    timezone             : Europe/Amsterdam
    tokenizer            : Yes
    memory_limit         : -1

PHP 5.6 :
    configured           : /usr/local/sbin/php56
    installed            : Yes
    version              : 5.6.16
    short_open_tags      : Off
    timezone             : Europe/Amsterdam
    tokenizer            : Yes
    memory_limit         : -1

PHP 7.0 :
    configured           : Yes
    version              : 7.0.1
    short_open_tags      : Off
    timezone             :
    tokenizer            : Yes
    memory_limit         : -1

PHP 7.1 :
    configured           : Yes
    version              : 7.1.0-dev
    short_open_tags      : Off
    timezone             :
    tokenizer            : Yes
    memory_limit         : 128M

git :
    installed            : Yes
    version              : 2.7.0

hg :
    installed            : Yes
    version              : 3.6.3

svn :
    installed            : Yes
    version              : 1.9.3

bzr :
    installed            : No
    optional             : Yes

composer :
    installed            : Yes
    version              : 1.0.0-alpha11

wget :
    installed            : Yes
    version              : GNU Wget 1.17.1 built on darwin15.2.0.

zip :
    installed            : Yes
    version              : 3.0

# Tips

  • The PHP section is the PHP binary used to run Exakat.
  • The PHP x.y sections are the PHP binaries used to check the code.
  • Optional installations (such as svn, zip, etc.) are not necessarily reported if they are not installed.

Options

Option Req Description
-p No Displays the project-specific configuration. Otherwise, only displays general configuration.
-json No Displays the project-specific configuration in json format, to stdout
-v No Verbose mode : include helpers configurations

help

Displays the help section.

php exakat.phar help

Results

This displays :

[Usage] :   php exakat.phar init -p <Project name> -R <Repository>
            php exakat.phar project -p <Project name>
            php exakat.phar doctor
            php exakat.phar version

init

Initialize a new project.

Command

exakat init -p <project> [-R vcs_url] [-git|-svn|-bzr|-hg|-composer|-symlink|-copy|-tgz|-zip] [-v]

Options

Option Req Description
-p Yes Project name. Should be filesystem compatible (avoid / or )
-R No URL to the VCS repository. Anything compatible with the expected VCS.
-git No Use git client (also, default value if no clue is given in the VCS URL)
-svn No Use SVN client
-bzr No Use Bazar client
-hg No Use Mercurial (hg) client
-composer No Use Composer client
-symlink No -R path will be symlinked. Directory is never accessed for writing.
-copy No -R path will be recursively copied.
-v No Verbose mode

Tips

  • -R is not compulsory : you may omit it, then, provide PHP files in the projects/<name>/code folder by the mean you want.

Examples

# Clone Exakat with Git
php exakat.phar init -p exakat -R https://github.com/exakat/exakat.git

# Download Spip with Zip
php exakat init -p spip2 -zip -R http://files.spip.org/spip/stable/spip-3.1.zip

# Download PHPMyadmin,
php exakat.phar init -p pma2 -tgz -R https://files.phpmyadmin.net/phpMyAdmin/4.6.4/phpMyAdmin-4.6.4-all-languages.tar.gz

# Make a local copy of PHPMyadmin,
php exakat.phar init -p copyProject -copy -R projects/phpmyadmin/code/

# Make a local symlink with the local webserver,
php exakat.phar init -p copyProject -copy -R /var/www/public_html

project

Runs a new analyze on a project.

The results of the analysis are available in the projects/<name>/ folder. report and faceted are two HTML reports.

Command

exakat project -p <project> [-v]

Options

Option Req Description
-p Yes Project name. Should be filesystem compatible (avoid / or )
-v No Verbose mode

remove

Destroy a project. All code source, configuration and any results from exakat are destroyed.

Command

exakat remove -p <project> [-v]

Options

Option Req Description
-p Yes Project name. Should be filesystem compatible (avoid / or )
-v No Verbose mode

report

Produce a report for a project.

Reports may be produced as soon as exakat has reach the phase of ‘analysis’. If the analysis phase hasn’t finished, then some results may be unavailable. Run report again later to get the full report. For example, the ‘Uml’ report may be run fully as soon as exakat is in analysis phase.

It is possible to extract a report even after the graph database has been cleaned. This allows running several projects one after each other, yet have access to several reports.

Command

exakat report -p <project> -format <Format> [-file <file>] [-v]

Options

Option Req Description
-p Yes Project name. Should be filesystem compatible (avoid / or )
-v No Verbose mode
-format No Which format to extract. Available formats : Devoops, Faceted, FacetedJson, Json, OnepageJson, Text, Uml, Xml Default is ‘Text’
-file No File or directory name for the report. Adapted file extension is added. Report is located in the projects/<project>/ folder Default is ‘stdout’, but varies with format.
-T No Thema’s results. All the analysers in this thema will be reported. Note that the report format may override this configuration : for example Ambassador manage its own list of analysers. Uses this with Text format. Has priority over the -P option
-P No Analyzer’s results. Only one analyser’s will be reported. Note that the report format may override this configuration : for example Ambassador manage its own list of analysers. Uses this with Text format. Has lower priority than the -T option

Report formats

Report Description
Amabassador HTML format, with all available reports in one compact format.
Devoops HTML format, deprecated.
Json JSON format.
Text Text format. One issue per line, with description, file, line.
Codesniffer Text format, similar to Codesniffer report style.
Uml Dot format. All classes/interfaces/traits hierarchies, and grouped by name- spaces.
Xml XML format.

update

Update the code base of a project.

Command

exakat update -p <project> [-v]

Options

Option Req Description
-p Yes Project name. Should be filesystem compatible (avoid / or )
-v No Verbose mode

upgrade

Upgrade exakat itself. By default, this is a dry run : only the availability of a new version is reported.

Use -u option to actually replace the current phar archive.

Command

exakat upgrade

Options

Option Req Description
-u Yes Actually upgrades exakat. Without it, it is a dry run.