diff --git a/src/components/404internal/Chat404.tsx b/src/components/404internal/Chat404.tsx index 674b4c06486b0dcbd6652ed686195d0ca9adbff5..51f1cf60e99beefc721e459f9588519a0fcc2470 100644 --- a/src/components/404internal/Chat404.tsx +++ b/src/components/404internal/Chat404.tsx @@ -284,6 +284,7 @@ class Chat404 extends React.Component<Props, State> { default: notExhaustive(value) + return null } }) } diff --git a/src/components/codeEditors/aceEditors/aceEditorsStorageHelper.ts b/src/components/codeEditors/aceEditors/aceEditorsStorageHelper.ts index 5b8d028343c768cb55acc36fc2d3f06dfb6772df..1bd98b59824fdabd3da51aba64fb71dc67ace3fc 100644 --- a/src/components/codeEditors/aceEditors/aceEditorsStorageHelper.ts +++ b/src/components/codeEditors/aceEditors/aceEditorsStorageHelper.ts @@ -72,11 +72,17 @@ export class AceEditorsStorageHelper { tabs.push(initialWrappedTab) } + /** + * + * @param id + * @param tab + * @returns true: id was removed, false: tab was not found + */ public static removeTabToEditor(id: string, tab: AceStoredTabLike): boolean { const tabs = this.editorsMap[id] - if (!tabs) return true + if (!tabs) return false const index = tabs.findIndex(p => p.tab.id === tab.id) @@ -84,6 +90,7 @@ export class AceEditorsStorageHelper { tabs.splice(index,1) + return true } public static getEditor(id: string): EditorWrapperTab[] | undefined { @@ -207,4 +214,4 @@ export interface EditorWrapperTabExport { modeId: string //e.g. ace/mode/java value: string //editor content } -} \ No newline at end of file +} diff --git a/src/constants.ts b/src/constants.ts index 87a9f0bfe379a9d6d7d90f818d9b988dc2b7f0d8..6536091dc9f475e24cfa1021a1790d38941d0370 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -13,7 +13,7 @@ import Logger from './helpers/logger' * y - breaking changes / new features * z - fixes, small changes */ -export const versionString = '2.5.14' +export const versionString = '2.5.15' export const supportMail = 'yapex@informatik.uni-halle.de' diff --git a/src/helpers/markdownHelper.ts b/src/helpers/markdownHelper.ts index 23cb7d7b44c25bb13fad74ef6b48b8dc48887e40..0bfe2e7ad0092e0b856df61e30e710076a4492f7 100644 --- a/src/helpers/markdownHelper.ts +++ b/src/helpers/markdownHelper.ts @@ -310,9 +310,9 @@ mdRenderer.renderer.rules.fence = (tokens, idx, options, env, self) => { return withCopyBtn } -function getCodeFenceProperties(langLine: string): CodeFenceProperties { +function getCodeFenceProperties(langLine: string): CodeFenceProperties |null { - if (!langLine) return + if (!langLine) return null //first is the lang diff --git a/src/state/actions/doExerciseSite/doExerciseCrudActions.ts b/src/state/actions/doExerciseSite/doExerciseCrudActions.ts index 6cda5d9ee87df2444476f23d2c83659eb9326571..7858de8ff847a05021e6d71fa7eb975c8bde8bcd 100644 --- a/src/state/actions/doExerciseSite/doExerciseCrudActions.ts +++ b/src/state/actions/doExerciseSite/doExerciseCrudActions.ts @@ -166,7 +166,7 @@ export function _saveDoExerciseSolution(releaseCode: string, shouldClearAllTestR /** * run the given tests, sets the test states to running and selects the last or the first failed test * @param {RunTestCommandForBackend} runNormalTestCommand - * @returns {AwaitActionsWithResult<boolean>} true: all tests passed, false: at least 1 did not compile or not passed + * @returns [hasAnyTestFailed] true: some test has not compiled or not passed, false: all tests passed */ export function runDoExerciseTest(runNormalTestCommand: RunTestCommandForBackend): AwaitActionsWithResult<boolean> { return async (dispatch, getState) => { @@ -202,7 +202,7 @@ export function runDoExerciseTest(runNormalTestCommand: RunTestCommandForBackend getI18n(globalState.getState().i18nState.langId,'Warning'), getI18n(globalState.getState().i18nState.langId,'Probably no test has run'), globalState.getState().i18nState.langId ) - return + return true } const firstFailedTest = ranTests.find(p => !p || !p.result || !p.result.hasCompiled || !p.result.passed) @@ -215,7 +215,7 @@ export function runDoExerciseTest(runNormalTestCommand: RunTestCommandForBackend dispatch(setSelectedConsoleViewTest(ranTests[ranTests.length - 1])) } - return !!firstFailedTest + return firstFailedTest !== undefined } } @@ -230,7 +230,7 @@ export function _runDoExerciseTest(runNormalTestCommand: RunTestCommandForBacken * * @param {RunTestCommandForBackend} runNormalTestCommand * @param langId - * @returns {AwaitActionsWithResult<boolean>} true: all tests passed, false: at least 1 did not compile or not passed + * @returns [hasAnyTestFailed] true: some test has not compiled or not passed, false: all tests passed */ export function runCustomDoExerciseTest(runNormalTestCommand: RunTestCommandForBackend, langId: KnownLangs): AwaitActionsWithResult<boolean> { return async (dispatch, getState) => { @@ -273,7 +273,7 @@ export function runCustomDoExerciseTest(runNormalTestCommand: RunTestCommandForB getI18n(globalState.getState().i18nState.langId,'Warning'), getI18n(globalState.getState().i18nState.langId,'Probably no test has run'), globalState.getState().i18nState.langId ) - return + return true } const ranTests = runNormalTestCommand.testIds @@ -294,7 +294,7 @@ export function runCustomDoExerciseTest(runNormalTestCommand: RunTestCommandForB dispatch(setSelectedConsoleViewTest(updatedTest)) } - return !!firstFailedTest + return firstFailedTest !== undefined } } @@ -412,7 +412,7 @@ export function _justRunProgramDoExercise(justRunProgramCommand: JustRunProgramC /** * run the given tests, sets the test states to running and selects the last or the first failed test - * @returns {AwaitActionsWithResult<boolean>} true: all tests passed, false: at least 1 did not compile or not passed + * @returns [hasAnyTestFailed] true: some test has not compiled or not passed, false: all tests passed */ export function runAfterNormalTest(runTestWithSolution: RunTestCommandForBackend): AwaitActionsWithResult<boolean> { return async (dispatch, getState) => { @@ -451,7 +451,7 @@ export function runAfterNormalTest(runTestWithSolution: RunTestCommandForBackend warningDialog(getI18n(globalState.getState().i18nState.langId,'Warning'), getI18n(globalState.getState().i18nState.langId,'Probably no test has run'), globalState.getState().i18nState.langId ) - return + return true } const firstFailedTest = ranTests.find(p => !p || !p.result || !p.result.hasCompiled || !p.result.passed) @@ -464,7 +464,7 @@ export function runAfterNormalTest(runTestWithSolution: RunTestCommandForBackend dispatch(setSelectedConsoleViewTest(ranTests[ranTests.length - 1])) } - return !!firstFailedTest + return firstFailedTest !== undefined } } @@ -478,7 +478,7 @@ export function _runAfterNormalTest(runTestWithSolution: RunTestCommandForBacken /** * run the given tests, sets the test states to running and selects the last or the first failed test - * @returns {AwaitActionsWithResult<boolean>} true: all tests passed, false: at least 1 did not compile or not passed + * @returns [hasAnyTestFailed] true: some test has not compiled or not passed, false: all tests passed */ export function runAfterSubmitTest(runTestWithSolution: RunTestCommandForBackend): AwaitActionsWithResult<boolean> { return async (dispatch, getState) => { @@ -517,7 +517,7 @@ export function runAfterSubmitTest(runTestWithSolution: RunTestCommandForBackend warningDialog(getI18n(globalState.getState().i18nState.langId,'Warning'), getI18n(globalState.getState().i18nState.langId,'Probably no test has run'), globalState.getState().i18nState.langId ) - return + return true } const firstFailedTest = ranTests.find(p => !p || !p.result || !p.result.hasCompiled || !p.result.passed) @@ -530,7 +530,7 @@ export function runAfterSubmitTest(runTestWithSolution: RunTestCommandForBackend dispatch(setSelectedConsoleViewTest(ranTests[ranTests.length - 1])) } - return !!firstFailedTest + return firstFailedTest !== undefined } } @@ -543,7 +543,7 @@ export function _runAfterSubmitTest(runTestWithSolution: RunTestCommandForBacken /** * run the given tests, sets the test states to running and selects the last or the first failed test - * @returns {AwaitActionsWithResult<boolean>} true: all tests passed, false: at least 1 did not compile or not passed + * @returns [hasAnyTestFailed] true: some test has not compiled or not passed, false: all tests passed */ export function runAfterCustomTest(runNormalTestCommand: RunTestCommandForBackend): AwaitActionsWithResult<boolean> { return async (dispatch, getState) => { @@ -577,7 +577,7 @@ export function runAfterCustomTest(runNormalTestCommand: RunTestCommandForBacken getI18n(globalState.getState().i18nState.langId,'Warning'), getI18n(globalState.getState().i18nState.langId,'Probably no test has run'), globalState.getState().i18nState.langId ) - return + return true } const ranTests = runNormalTestCommand.testIds @@ -603,7 +603,7 @@ export function runAfterCustomTest(runNormalTestCommand: RunTestCommandForBacken dispatch(setSelectedConsoleViewTest({...customTestCopy, result: ranTests[ranTests.length - 1].result})) } - return !!firstFailedTest + return firstFailedTest !== undefined } } diff --git a/src/state/actions/editCustomProjectSite/editCustomProjectCrudActions.ts b/src/state/actions/editCustomProjectSite/editCustomProjectCrudActions.ts index c63b439972cbcd28bb9174dbb6b2cf64063f86e8..336452cb78cc5da2300972ed430b41e01a2eb08d 100644 --- a/src/state/actions/editCustomProjectSite/editCustomProjectCrudActions.ts +++ b/src/state/actions/editCustomProjectSite/editCustomProjectCrudActions.ts @@ -89,7 +89,7 @@ export function getCustomProjectTestResultsAsync(customProjectId: number, * copied from doExerciseCrudActions > runCustomDoExerciseTest * @param {RunTestCommandForBackend} runNormalTestCommand * @param langId - * @returns {AwaitActionsWithResult<boolean>} true: all tests passed, false: at least 1 did not compile or not passed + * @returns {AwaitActionsWithResult<boolean>} [hasAnyTestFailed?] true: at least 1 did not compile or not passed, false: all passed */ export function runCustomProjectTestAsync(runNormalTestCommand: RunTestCommandCustomProjectForBackend, langId: KnownLangs): AwaitActionsWithResult<boolean> { return async (dispatch, getState) => { @@ -131,7 +131,7 @@ export function runCustomProjectTestAsync(runNormalTestCommand: RunTestCommandCu getI18n(globalState.getState().i18nState.langId, 'Warning'), getI18n(globalState.getState().i18nState.langId, 'Probably no test has run'), globalState.getState().i18nState.langId ) - return + return true } const ranTests = runNormalTestCommand.testIds @@ -152,7 +152,7 @@ export function runCustomProjectTestAsync(runNormalTestCommand: RunTestCommandCu dispatch(setSelectedConsoleViewTest(updatedTest)) } - return !!firstFailedTest + return firstFailedTest !== undefined } } diff --git a/src/state/actions/tutorViewSite/tutorViewSiteCrudActions.ts b/src/state/actions/tutorViewSite/tutorViewSiteCrudActions.ts index b698331e5b5aa52178fcab7a39630d97cf419fc2..a160ccccada12f8739a3b830e95fb4961caba824 100644 --- a/src/state/actions/tutorViewSite/tutorViewSiteCrudActions.ts +++ b/src/state/actions/tutorViewSite/tutorViewSiteCrudActions.ts @@ -128,6 +128,11 @@ export function _changeSingleAssessmentTutorViewAsync(assessment: AssessmentFull } +/** + * + * @param runTestAsTutorCommand + * @returns [hasAnyTestFailed] true: some test has not compiled or not passed, false: all tests passed + */ export function runNormalTestAsTutor(runTestAsTutorCommand: RunTutorTestCommandForBackend): AwaitActionsWithResult<boolean> { return async (dispatch, getState) => { //if we run the same test twice and the output won't change then this looks like nothing happened... @@ -165,7 +170,7 @@ export function runNormalTestAsTutor(runTestAsTutorCommand: RunTutorTestCommandF warningDialog(getI18n(globalState.getState().i18nState.langId,'Warning'), getI18n(globalState.getState().i18nState.langId,'Probably no test has run'), globalState.getState().i18nState.langId ) - return + return true } const firstFailedTest = ranTests.find(p => !p || !p.result || !p.result.hasCompiled || !p.result.passed) @@ -178,7 +183,7 @@ export function runNormalTestAsTutor(runTestAsTutorCommand: RunTutorTestCommandF dispatch(setSelectedConsoleViewTest(ranTests[ranTests.length - 1])) } - return !!firstFailedTest + return firstFailedTest !== undefined } } @@ -189,6 +194,11 @@ export function _runNormalTestAsTutor(runTestAsTutorCommand: RunTutorTestCommand } } +/** + * + * @param runTestAsTutorCommand + * @returns [hasAnyTestFailed] true: some test has not compiled or not passed, false: all tests passed + */ export function runSubmitTestAsTutor(runTestAsTutorCommand: RunTutorTestCommandForBackend): AwaitActionsWithResult<boolean> { return async (dispatch, getState) => { @@ -227,7 +237,7 @@ export function runSubmitTestAsTutor(runTestAsTutorCommand: RunTutorTestCommandF getI18n(globalState.getState().i18nState.langId,'Probably no test has run'), globalState.getState().i18nState.langId ) - return + return true } const firstFailedTest = ranTests.find(p => !p || !p.result || !p.result.hasCompiled || !p.result.passed) @@ -240,7 +250,7 @@ export function runSubmitTestAsTutor(runTestAsTutorCommand: RunTutorTestCommandF dispatch(setSelectedConsoleViewTest(ranTests[ranTests.length - 1])) } - return !!firstFailedTest + return firstFailedTest !== undefined } } diff --git a/tsconfig.json b/tsconfig.json index 53efa85b95d1baa704d06b8dfe5992612ef05816..421215de62174a0d4e9ee342f3422580df6695a3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,9 @@ "suppressImplicitAnyIndexErrors": true, "lib": ["es2015", "dom","es5","scripthost", "es2015.promise"], "allowJs": true, - "importHelpers": true + "importHelpers": true, + "noImplicitReturns": true, + "strictNullChecks": false //TODO at some point enable this to fix many bugs... }, "include": [ "./src/*",