diff --git a/core/src/main/java/de/jplag/reporting/reportobject/ReportObjectFactory.java b/core/src/main/java/de/jplag/reporting/reportobject/ReportObjectFactory.java index bb1fb4d39..a1520f92b 100644 --- a/core/src/main/java/de/jplag/reporting/reportobject/ReportObjectFactory.java +++ b/core/src/main/java/de/jplag/reporting/reportobject/ReportObjectFactory.java @@ -149,7 +149,7 @@ private void writeOverview(JPlagResult result) { missingComparisons); OverviewReport overviewReport = new OverviewReport(REPORT_VIEWER_VERSION, folders.stream().map(File::getPath).toList(), // submissionFolderPath baseCodePath, // baseCodeFolderPath - result.getOptions().language().getName(), // language + result.getOptions().language().getIdentifier(), // language result.getOptions().fileSuffixes(), // fileExtensions submissionNameToIdMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)), // submissionIds submissionNameToNameToComparisonFileName, // result.getOptions().getMinimumTokenMatch(), diff --git a/report-viewer/src/model/Language.ts b/report-viewer/src/model/Language.ts index 198f28399..4a206b49d 100644 --- a/report-viewer/src/model/Language.ts +++ b/report-viewer/src/model/Language.ts @@ -2,28 +2,26 @@ * Enum for the language parsers JPlag supports */ enum ParserLanguage { - JAVA = 'Javac based AST plugin', - PYTHON = 'Python3 Parser', - C = 'C Scanner', - CPP_OLD = 'C/C++ Scanner [basic markup]', - CPP = 'C++ Parser', - CPP_2 = 'C/C++ Parser', - C_SHARP = 'C# 6 Parser', + JAVA = 'java', + PYTHON = 'python3', + C = 'c', + CPP = 'cpp', + C_SHARP = 'csharp', EMF_METAMODEL_DYNAMIC = 'emf-dynamic', - EMF_METAMODEL = 'EMF metamodel', - EMF_MODEL = 'EMF models (dynamically created token set)', - GO = 'Go Parser', - KOTLIN = 'Kotlin Parser', - R_LANG = 'R Parser', - RUST = 'Rust Language Module', - SCALA = 'Scala parser', - SCHEME = 'SchemeR4RS Parser [basic markup]', - SWIFT = 'Swift Parser', - TEXT = 'Text Parser (naive)', - SCXML = 'SCXML (Statechart XML)', - LLVM = 'LLVMIR Parser', - JAVASCRIPT = 'JavaScript', - TYPESCRIPT = 'Typescript Parser' + EMF_METAMODEL = 'emf', + EMF_MODEL = 'emf-model', + GO = 'go', + KOTLIN = 'kotlin', + R_LANG = 'rlang', + RUST = 'rust', + SCALA = 'scale', + SCHEME = 'scheme', + SWIFT = 'swift', + TEXT = 'text', + SCXML = 'scxml', + LLVM = 'llvmir', + JAVASCRIPT = 'javascript', + TYPESCRIPT = 'typescript' } type Language = ParserLanguage | 'unknown language' diff --git a/report-viewer/src/utils/CodeHighlighter.ts b/report-viewer/src/utils/CodeHighlighter.ts index ae3e958cb..3191840e0 100644 --- a/report-viewer/src/utils/CodeHighlighter.ts +++ b/report-viewer/src/utils/CodeHighlighter.ts @@ -40,8 +40,6 @@ function getHighlightLanguage(lang: Language) { case ParserLanguage.C: return 'c' case ParserLanguage.CPP: - case ParserLanguage.CPP_OLD: - case ParserLanguage.CPP_2: return 'cpp' case ParserLanguage.C_SHARP: return 'csharp' diff --git a/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts b/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts index 6852f5fbf..6104668ce 100644 --- a/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts +++ b/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts @@ -2,6 +2,7 @@ import { beforeAll, describe, expect, it, vi } from 'vitest' import { OverviewFactory } from '@/model/factories/OverviewFactory' import { MetricType } from '@/model/MetricType' import { Distribution } from '@/model/Distribution' +import { ParserLanguage } from '@/model/Language' import validNew from './ValidOverview.json' import outdated from './OutdatedOverview.json' @@ -41,7 +42,7 @@ describe('Test JSON to Overview', () => { expect(await OverviewFactory.getOverview()).toEqual({ _submissionFolderPath: ['files'], _baseCodeFolderPath: '', - _language: 'Javac based AST plugin', + _language: ParserLanguage.JAVA, _fileExtensions: ['.java', '.JAVA'], _matchSensitivity: 9, _dateOfExecution: '12/07/23', diff --git a/report-viewer/tests/unit/model/factories/ValidOptions.json b/report-viewer/tests/unit/model/factories/ValidOptions.json index 7081e8a80..1c4fbb595 100644 --- a/report-viewer/tests/unit/model/factories/ValidOptions.json +++ b/report-viewer/tests/unit/model/factories/ValidOptions.json @@ -1,5 +1,5 @@ { - "language": "Javac based AST plugin", + "language": "java", "min_token_match": 9, "submission_directories": [ ".\\files" diff --git a/report-viewer/tests/unit/model/factories/ValidOverview.json b/report-viewer/tests/unit/model/factories/ValidOverview.json index 44787eea5..1ddfd238e 100644 --- a/report-viewer/tests/unit/model/factories/ValidOverview.json +++ b/report-viewer/tests/unit/model/factories/ValidOverview.json @@ -2,7 +2,7 @@ "jplag_version": { "major": 6, "minor": 0, "patch": 0 }, "submission_folder_path": ["files"], "base_code_folder_path": "", - "language": "Javac based AST plugin", + "language": "java", "file_extensions": [".java", ".JAVA"], "submission_id_to_display_name": { "A": "A", "B": "B", "C": "C", "D": "D" }, "submission_ids_to_comparison_file_name": {