Stefan Boos

Link collection and some blog posts

Follow me on GitHub

CodeScene

Table of Contents

Table of Contents generated with DocToc

About CodeScene

Video: Guide Refactorings With Behavioral Code Analysis - Adam Tornhill - DDD Europe 2019 - Shows the rationale and field of application for CodeScene.

Request Free Trial Period

To request a free trial period, click Try for Free on CodeScene Pricing

Installation

Overview

Running on Docker

Warning

The docker instance will contain an unprotected SSH key saved in codescene/.ssh. This will allow the codescene user read access to your git repositories. For your repositories, create a separate dedicated user with minimal access rights and think about information security. In addition, consider this problematic key in your backup strategy.

Important for Windows Users: Bind Mount File Sharing Performance

Recommendation: When running the docker container on Windows, then run docker from a shell from inside your WSL2 linux distribution. Please also ensure that WSL2, docker and your Linux distro are integrated correctly - see Docker Desktop WSL2 backend.

Rationale: See section Awesome mounts performance in Docker Desktop: WSL 2 Best practices.

(I am currently testing this advice → ) This is expected to speed up analysis tremendously.

Running
  • Follow the instructions in section Example: Run CodeScene using docker of of [2]

  • For git repository access the instructions include the commands showing in section Git Repository Access of [2].

Special Use Cases

Configuration

Configuration of the Trial Version

Configuration of the Final Installation

Create Projects

  • Run an Analysis
    • Note: SSH remotes don’t start with ssh:// but directly with the user name

Maintenance Considerations

Open Questions

  • How to securely backup the unprotected private SSH key stored in the codescene/.ssh directory?

Additional Information

Quick and Dirty Backup

Compress and encrypt the codescene folder, e.g. with 7-zip.

Encrypting is important, because the folder contains your private ssh key, all repositories and the CodeScene configuration.

Inspecting the Running CodeScene Container

# display and follow the container logs
docker logs --follow codescene

# display the resources allocated by the container continuously
docker stats codescene

# display the running processes and their resource allocation
docker exec -it codescene /bin/bash
$ top

Troubleshooting

  • Java Memory Configuration - RAM is critical! The JVM should have 50-60% of a 4 GB machine or 300-500 MB in a kubernetes pod.

  • Enable full stack traces - ensure that full stack traces are printed to facilitate troubleshooting java exceptions.

  • DB Performance - hints addressing the performance (the DB is usually not a bottleneck).

Outlook

dockerhub://empear/codescene suggests configuring the following plugins:

  • Code Coverage Plugin
  • SonarQube Plugin

References

[1] CodeScene.com - The official CodeScene website.

[2] dockerhub://empear/codescene - run CodeScene (with license) inside docker container(s).