JPlag icon indicating copy to clipboard operation
JPlag copied to clipboard

How to view results?

Open Alberth289346 opened this issue 3 years ago • 6 comments

Maintainer's note: If you just want to use the report viewer, head over to jplag.github.io/JPlag

Original issue:

Working around #354 by manually creating the missing directories in result, JPlag finishes successfully.

That gives me:

$ ls -RF result
result:
2018-101/  overview.json

result/2018-101:
merged.cif-2018-102/

result/2018-101/merged.cif-2018-102:
merged.cif.json

No index.html to start viewing results, no instructions at the website. What next?

Guessing I need the report-viewer in some way:

$ cd report-viewer

$ npm install
npm install
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm WARN [email protected] requires a peer of sortablejs@^1.14.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 1046 packages in 12.738s

122 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
# Replaced my home-directory path with ~ below.
$ npm run build
> [email protected] build ~/work/gitlab_tue/boost/jplag-hacking/report-viewer
> vue-cli-service build

 ERROR  You are using Node v10.19.0, but vue-cli-service requires Node ^12.0.0 || >= 14.0.0.
        Please upgrade your Node version.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2022-04-07T11_09_01_908Z-debug.log

For completeness, the log output from the above mentioned file

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:~/work/gitlab_tue/boost/jplag-hacking/report-viewer/node_modules/.bin:~/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle [email protected]~build: CWD: ~/work/gitlab_tue/boost/jplag-hacking/report-viewer
10 silly lifecycle [email protected]~build: Args: [ '-c', 'vue-cli-service build' ]
11 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `vue-cli-service build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd ~/work/gitlab_tue/boost/jplag-hacking/report-viewer
16 verbose Linux 5.4.0-107-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v10.19.0
19 verbose npm  v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: `vue-cli-service build`
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Alberth289346 avatar Apr 07 '22 11:04 Alberth289346

We currently have not integrated the doc in the wiki yet, for now, you can refer to: cholakov11/JPlag#2, cholakov11/JPlag#3, and cholakov11/JPlag#4. If that does not help I refer to @sebinside.

tsaglam avatar Apr 07 '22 11:04 tsaglam

From having a look at error log, this indicates that you must update your local NodeJS version (the current LTS version is 16.14).

ERROR  You are using Node v10.19.0, but vue-cli-service requires Node ^12.0.0 || >= 14.0.0.
        Please upgrade your Node version.

Besides that, npm install and npm run serve or npm run build should be sufficient. Alternatively, with every push to the main branch of JPlag, the report-viewer gets deployed to GitHub Pages.

In future versions, a bundle with all required files will be created also locally. We'll add this and also #354 to the task lists for the first release with the new viewer.

sebinside avatar Apr 07 '22 11:04 sebinside

Many thanks!

As I have no idea what "updating NodeJS" means concretely, I opted for the deployed version that you linked to.

I created a zip with

$ unzip -l x.zip
Archive:  x.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
   175814  2022-04-07 13:57   m1.cif-m2.cif.json
      517  2022-04-07 13:57   overview.json
---------                     -------
   176331                     2 files

This is ok, as I just had 2 files, so one comparison.

I dropped the x.zip in the GH page, and it opened to an overview page stating 34% overlap. Screenshot from 2022-04-07 14-11-36

Clicking at the top-right, and then manually opening both files gave me this (only the top part, as the files are long): Screenshot from 2022-04-07 14-14-14

I can scroll both files up and down and left and right, but I couldn't see any indication of the 34% overlap.

I also noticed the display contracts eg >= to . Cif however is a pure ASCII language, in the input will throw a parse error. I would suggest not to do that or make it a toggle option.

To do it correctly you would need the underlying token structure. Eg imagine a language where x<a>=17 is allowed syntax, X<a≥17 is something very different.

EDIT: Line numbers in both files are off-by-1, JPlag defines the first line as 1.

Alberth289346 avatar Apr 07 '22 12:04 Alberth289346

Yes, we currently use a version of JetBrains Mono that has such characters. This will be replaced in a future version. Also a good hint with the line numbers being off, I will add that to the (already quite long) list of changes that shall be done until version 4.

Regarding the display of overlaps: Have a look at the blue bar on the left side, there is a (currently not very visible, we're aware of that) view that gives you more information. However, it should also be visible in the code. Could you please investigate whether there are errors in the developer console (e.g., in chrome and edge on windows opened with ctrl + shift + J). We already discovered this display bug but did not find its cause yet.

sebinside avatar Apr 08 '22 16:04 sebinside

I missed the left vertical bar as it had no ">>" signs on it. As a suggestion, perhaps also allow clicking at any other place at the bar (also for opening the files), Having to "precisely" click the signs is somewhat annoying.

I opened the web developer tools (firefox 99.0), mint-001 1.00 edition (part of the Linux Mint LTS 20 distribution). Just opening the GH page gacve the following error: Screenshot from 2022-04-11 18-48-18

The bottom "went out of scope" error seems to happen when you move the mouse over and out the window (which then loses focus as my mouse defines the focus), so that is harmless I think.

I also have a long error when clicking (I think in the left file view). Top-part dump: Screenshot from 2022-04-11 18-52-25

and bottom part (the "P" line is shown in both parts) Screenshot from 2022-04-11 18-51-47

A similar long error happens when you click in the comparison window at the left (after opening it). Just the top part this time (looking at the error message again I now realize this image may be too short): Screenshot from 2022-04-11 18-55-48

And last but not least, I noticed "-1" values in the latter view, which is wrong as I was pretty sure my scanner does produce line and column information :p
So I checked by dumping the 5 first tokens of each file, and at the bottom-right the first matched token in the comparison json file:

Screenshot from 2022-04-11 19-48-30

You can see the parse does produce the tokens with the information. Hacked Submission.java file:

// Line 171
        tokenList = language.parse(submissionRootFile, relativeFilePaths);
        System.out.printf("Parsed file %s, %d tokens%n", submissionRootFile.toString(), tokenList.size());
        for (int i = 0; i < 5 && i < tokenList.size(); i++) {
            System.out.printf("Token %d: %s%n", i, tokenList.getToken(i).toString());
        }
        System.out.printf("%n");

        if (!language.hasErrors()) {

Alberth289346 avatar Apr 11 '22 18:04 Alberth289346

Thank you for the detailed report, we'll have a look at it in #357.

sebinside avatar Apr 12 '22 17:04 sebinside