This project allows to analyze and visualize class-comments here in Github. It was build as a seminar project for the Software Composition Seminar at the University of Bern and serves as a proof of concept.
1. Reqirements
2. Installation
3. Getting started / Usage
4. Repo Structure
5. References
6. License
- Chrome browser (tested with version 96.0)
- Java (>= 17) with Maven (>=3.8.1) or Docker (tested with 20.10.7)
- To install the Comment-analysis-neon API, you first need to compile Maenu's Comment-Analysis-Neon Repo with
mvn package
The reason is, that the outputted jar file is too big for the common maven package hosters. - If the generation failes on the tests, your platform somehow doesn't behave as expected and you might try to run everything in a docker container or simply use the provided docker-compose file.
- Copy the generated
target/comment-analysis-neon-0.0.2-SNAPSHOT.jar
file to/api/lib/comment-analysis-neon.jar
- Now the
api
directory is a standard Maven project you can either run directly using the Maven tools or compile it to a jar, to then run the Comment-analysis-neon API without Maven.
- Go to chrome://extensions/ and enable the developer-mode in the top right corner
- Now click on "Load unpacked" and just go to your local clone of this repo and select the
chrome-plugin
directory - Now, in the extension list of Chrome, near the URL field, when clicking on the icon a small window should appear in which you can first enable and disable this plugin and secondly, you can configure the address at which the API can be reached.
The usage is relatively simple. After the installation of both parts see here, if the Comment-analysis-neon API is running and configured in the plugin (only necessary if you change the default), and you enabled the plugin in the configuration window, just browse to any Java, Python or Pharo repository on Github and you should see a result. Just as an example:
- A Java Repository would be Elasticsearch
- A Python Repository would be Django
- A Pharo Repository would be Pharo
If the plugin is activated, a small colored triangle appears in the top right corner. This can be disabled in chrome-plugin/content.js
on line 24 const cornerEnable = false
. There you can also change its colors. The default color are
- There has been done nothing. Either there is no appropriate code on this page, or we still wait for a response from the API
- The source code has been successfully analyzed
- The page is not analyzed due to an error in the communication with the Comment-analysis-neon API. Ensure the API is running and configured in the plugin as described here.
Once the corner turned into green, you can see the class comments underlined. Hovering at any location inside comments, a tooltip appears on the hovered line with a label.
The label indicates the assigned category (intent) of the sentence. In order to see all occurrences of a specific label inside comments, a small overlay is added on the right upper side of the page (movable). Hovering over a label should display all its occurrences in the text.
We also provide a docker and docker-compose file to run the Comment-analysis-neon API in a docker container, as we experienced some systems don't behave as expected when running the analysis algorithm in the comment-analysis-neon
-packet.
The folder is, where our REST-API is defined.
AnalysisRange.java
Defines an object, with a range (from, to) and an array of labels for this range. It's used as part of the API output.AnalysisResult.java
Defines the object which is returned in JSON format from the API. It contains a list ofAnalysisRange
and further acode
andmsg
to have the possibility to forward errors to the user.ApiController.java
Defines the REST endpoints. I.e./hello
to check if the API is successfully running and/analysis
used by the Chrome plugin.CliWrapper.java
Is just a wrapper to use theT12Classify.label
method from thecomment-analysis-neon
-packet and then wrap the output into anAnalysisResult
.ConnectorApiApplication.java
Is the main Java file and starts the entire Spring framework.MockAnalysis.java
Is a class used in development of the Chrome plugin, to return a static output independent of thecomment-analysis-neon
CLI, as development was mostly parallel.
This folder is, where the entire Chrome plugin is defined.
background.js
This file contains the background service handler, doing everything that not be done on the page in thecontent.js
config.js
Is the javascript file needed inindex.html
, the plugin configuration windowcontent.js
This is the main file. It gets added to the scripts, when you browse github.com and does all the DOM handling there. In the top part, there are some styling and configuration possibilities, to adjust the appearance to your preferences.index.html
Describes the small window for the plugin configuration.manifest.json
The manifest describing the plugin and some meta data to Chrome, defines the active pages, request additional permissions and so on.
- comment-analysis-neon CLI
- SCG Software Composition Seminar - University of Bern
- Spring
- Docker
- docker-compose
GNU General Public License v3.0 or later See LICENSE to see the full text.