Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update report viewer documentation #1985

Merged
merged 4 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions docs/3.-Contributing-to-JPlag.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ If you are new to JPlag, maybe check the [good first issues](https://github.com/
Please try to make well-documented and clearly structured submissions:
* All artifacts (code, comments...) should be in English
* Please avoid abbreviations!
* Make use of JavaDoc to document classes and public methods
* We provide a [formatter configuration](https://github.com/jplag/JPlag/blob/master/formatter.xml), which is enforced by spotless
* Eclipse/IntelliJ users can use it directly
* It can always be applied via maven with `mvn spotless:apply`
* Make use of JavaDoc/TsDoc to document classes and public methods
* We provide a formatter configurations
* For java code we use this [formatter configuration](https://github.com/jplag/JPlag/blob/master/formatter.xml), which is enforced by spotless
* Eclipse/IntelliJ users can use it directly
* It can always be applied via maven with `mvn spotless:apply`
* For typescript/vue code we use prettier und eslint
* They can both be executed with `npm run lint` and `npm run format`
* They can also be executed automatically on commit
* Use well-explained pull requests to propose your features
* When re-using code from other projects, mark them accordingly and make sure their license allows the re-use
* Your changes should always improve the code quality of the codebase, especially when working on older components
Expand All @@ -17,12 +21,17 @@ Please try to make well-documented and clearly structured submissions:

## Building from sources
1. Download or clone the code from this repository.
### Core
2. Run `mvn clean package` from the root of the repository to compile and build all submodules.
Run `mvn clean package assembly:single` instead if you need the full jar, which includes all dependencies.
5. You will find the generated JARs in the subdirectory `jplag.cli/target`.
Run `mvn clean package assembly:single -P with-report-viewer` instead if you need the full jar, which includes all dependencies.
3. You will find the generated JARs in the subdirectory `jplag.cli/target`.
### Report Viewer
2. Run `npm install` to install all dependencies.
3. Run `npm run dev` to launch the development server. The report viewer will be available at `http://localhost:8080/`.
Different versions of the build command are described in the [report-viewer README](../report-viewer/README.md).

### Git hooks

The repository contains a pre-commit hook that prevents commits if they fail spotless.
To set up the hooks, call `git config --local core.hooksPath gitHooks/hooks` once within your local repository.
The repository contains a pre-commit hook that prevents commits if they fail spotless and executes prettier and eslint on report-viewer code.
To set up the hooks, call `git config --local core.hooksPath gitHooks/hooks` once within your local repository or run `npm i`/`npm run prepare` in the report-viewer package.

18 changes: 12 additions & 6 deletions docs/6.-Report-File-Generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ result.zip
│ submission2-submission....json
│ submission2-submissionN.json
│ ...
└───basecode
│ └───submissionId1.json
│ └───submissionId2.json
│ ...
```

The report zip contains
Expand All @@ -41,20 +46,21 @@ The report zip contains
- The `overview.json` encapsulates the main information from a JPlagResult such as base directory path, language, min- and max-metric, etc. The `overview.json` provides data to the `OverviewView.vue` that is first displayed after the report is dropped into the viewer. Corresponds to the Java record `OverviewReport`.

- submissionFileIndex.json
- The `submissionFileIndex.json` stores a list of all files in the submission for each submission id.
- The `submissionFileIndex.json` stores a list of all files in the submission for each submission id. This file is also used to track the tokens per file. It is represented by a Map from the submission id to an instance of `SubmissionFile`.

- options.json
- This File contains all options given to JPlag either over the CLI or programmatically
- This File contains all options given to JPlag either over the CLI or programmatically. It is represented diretly by the `JPlagOptions` class.
tsaglam marked this conversation as resolved.
Show resolved Hide resolved

- submissions

- This folder contains all files of all submissions JPlag was run with. For each submission the `submissions` folder contains a subfolder with the name of the corresponding submission id. A subfolder for a submission contains all files of said submission.
These files are displayed in the `ComparisonView.vue`

- comparison files

- For each submission pair submission1 submission2 with ids submissionId1 and submissionId2, the report contains either submissionId1-submissionId2.json or submissionId2-submissionId1.json. This file contains information the comparison between the two submissions, such as the similarity and concrete matches. Corresponds to the Java record `ComparisonReport`.

- base code
- Each JSON file in the `basecode` folder contains the data where the provided basecode was found in each submission. Each submission has its own file. If no basecode was provided, each file contains an empty array of matches. Each JSON file corresponds to an array the Java record `BaseCodeMatch`.
tsaglam marked this conversation as resolved.
Show resolved Hide resolved

## Submission ids

### Report Viewer
Expand Down Expand Up @@ -89,5 +95,5 @@ Task: Adding the number of tokens in a match, which has to be displayed in the M
2. Modify the existing component `ComparisonReportWriter.java` to additionally extract the number of tokens in a match from the `JPlagResult.java`
and save it in the Match DTO
3. Add `tokens: number` to `Match.ts`
4. Edit `ComparisonFactory.ts` to get the number of tokens from the JSON report file. [report-viewer]
5. Edit `MatchTable.vue` to display the tokens number in the `ComparisonView.vue`.
4. Edit `ComparisonFactory.ts` to get the number of tokens from the JSON report file.
5. Edit `MatchList.vue` to display the tokens number in the `ComparisonView.vue`.