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

Use language identifiers in report #1924

Merged
merged 4 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
40 changes: 19 additions & 21 deletions report-viewer/src/model/Language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 0 additions & 2 deletions report-viewer/src/utils/CodeHighlighter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion report-viewer/tests/unit/model/factories/ValidOptions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"language": "Javac based AST plugin",
"language": "java",
"min_token_match": 9,
"submission_directories": [
".\\files"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down