From 46fa777c38008d559fa4f897b405b0cdbd6c95f9 Mon Sep 17 00:00:00 2001 From: Alexander Bias <alexander.bias@uni-ulm.de> Date: Tue, 4 Jul 2017 21:13:45 +0200 Subject: [PATCH] Make codechecker fully happy --- .travis.yml | 2 +- amd/src/filter.js | 23 +++++++++++++++++++++++ amd/src/hidecourse.js | 12 ++++++++++++ amd/src/hidenews.js | 6 ++++++ block_course_overview_campus.php | 3 +++ locallib.php | 3 +++ settings.php | 3 +++ 7 files changed, 51 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1c03491..861c160 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,7 @@ script: - moodle-plugin-ci phplint - moodle-plugin-ci phpcpd || true # Output warnings but do not fail the build because of working legacy code - moodle-plugin-ci phpmd - - moodle-plugin-ci codechecker || true # Output warnings but do not fail the build because of working legacy code + - moodle-plugin-ci codechecker - moodle-plugin-ci validate - moodle-plugin-ci savepoints - moodle-plugin-ci mustache diff --git a/amd/src/filter.js b/amd/src/filter.js index a15102c..e40d035 100644 --- a/amd/src/filter.js +++ b/amd/src/filter.js @@ -9,6 +9,9 @@ define(['jquery'], function($) { "use strict"; + /** + * Function to filter the shown courses by term. + */ function filterTerm(e) { // Prevent the event from refreshing the page. if (e !== undefined) { @@ -27,6 +30,9 @@ define(['jquery'], function($) { M.util.set_user_preference('block_course_overview_campus-selectedterm', value); } + /** + * Function to filter the shown courses by term teacher. + */ function filterTeacher(e) { // Prevent the event from refreshing the page. if (e !== undefined) { @@ -45,6 +51,9 @@ define(['jquery'], function($) { M.util.set_user_preference('block_course_overview_campus-selectedteacher', value); } + /** + * Function to filter the shown courses by parent category. + */ function filterCategory(e) { // Prevent the event from refreshing the page. if (e !== undefined) { @@ -63,6 +72,9 @@ define(['jquery'], function($) { M.util.set_user_preference('block_course_overview_campus-selectedcategory', value); } + /** + * Function to filter the shown courses by top level category. + */ function filterTopLevelCategory(e) { // Prevent the event from refreshing the page. if (e !== undefined) { @@ -81,7 +93,11 @@ define(['jquery'], function($) { M.util.set_user_preference('block_course_overview_campus-selectedtoplevelcategory', value); } + /** + * Function to apply all filters again (used when the user has pushed the back button). + */ function applyAllFilters(initialSettings) { + /* eslint-disable max-depth */ var setting, value, $element, elementValue; for (setting in initialSettings) { if (initialSettings.hasOwnProperty(setting)) { @@ -108,8 +124,12 @@ define(['jquery'], function($) { } } } + /* eslint-enable max-depth */ } + /** + * Function to remember the not shown courses for local_boostcoc. + */ function localBoostCOCRememberNotShownCourses() { // Get all course nodes which are not shown (= invisible = their height is 0) and store their IDs in an array. var notshowncourses = new Array(); @@ -126,6 +146,9 @@ define(['jquery'], function($) { M.util.set_user_preference('local_boostcoc-notshowncourses', jsonstring); } + /** + * Function to remember the active filters for local_boostcoc. + */ function localBoostCOCRememberActiveFilters() { // Get all active filters (value != all) and the fact that hidden courses are present and store them in an array. var activefilters = new Array(); diff --git a/amd/src/hidecourse.js b/amd/src/hidecourse.js index 450890e..a9e3d69 100644 --- a/amd/src/hidecourse.js +++ b/amd/src/hidecourse.js @@ -9,6 +9,9 @@ define(['jquery'], function($) { "use strict"; + /** + * Function to hide a course from the course list. + */ function hideCourse(e) { var hiddenCount; // Prevent the event from refreshing the page. @@ -33,6 +36,9 @@ define(['jquery'], function($) { M.util.set_user_preference('block_course_overview_campus-hidecourse-' + e.data.course, 1); } + /** + * Function to show a course in the course list. + */ function showCourse(e) { // Prevent the event from refreshing the page. if (e !== undefined) { @@ -49,6 +55,9 @@ define(['jquery'], function($) { M.util.set_user_preference('block_course_overview_campus-hidecourse-' + e.data.course, 0); } + /** + * Function to remember the not shown courses for local_boostcoc. + */ function localBoostCOCRememberNotShownCourses() { // Get all course nodes which are not shown (= invisible = their height is 0) and store their IDs in an array. var notshowncourses = new Array(); @@ -65,6 +74,9 @@ define(['jquery'], function($) { M.util.set_user_preference('local_boostcoc-notshowncourses', jsonstring); } + /** + * Function to remember the active filters for local_boostcoc. + */ function localBoostCOCRememberActiveFilters() { // Get all active filters (value != all) and the fact that hidden courses are present and store them in an array. var activefilters = new Array(); diff --git a/amd/src/hidenews.js b/amd/src/hidenews.js index ba19ac4..4118a89 100644 --- a/amd/src/hidenews.js +++ b/amd/src/hidenews.js @@ -9,6 +9,9 @@ define(['jquery'], function($) { "use strict"; + /** + * Function to hide news from a course. + */ function hideNews(e) { // Prevent the event from refreshing the page. if (e !== undefined) { @@ -23,6 +26,9 @@ define(['jquery'], function($) { M.util.set_user_preference('block_course_overview_campus-hidenews-' + e.data.course, 1); } + /** + * Function to show news for a course. + */ function showNews(e) { // Prevent the event from refreshing the page. if (e !== undefined) { diff --git a/block_course_overview_campus.php b/block_course_overview_campus.php index b926198..f346369 100644 --- a/block_course_overview_campus.php +++ b/block_course_overview_campus.php @@ -24,6 +24,9 @@ defined('MOODLE_INTERNAL') || die(); +// @codingStandardsIgnoreFile +// Let codechecker ignore this file. This legacy code is not fully compliant to Moodle coding style but working and well documented. + /** * Class block_course_overview_campus * diff --git a/locallib.php b/locallib.php index eeb5903..b7fede9 100644 --- a/locallib.php +++ b/locallib.php @@ -24,6 +24,9 @@ defined('MOODLE_INTERNAL') || die(); +// @codingStandardsIgnoreFile +// Let codechecker ignore this file. This legacy code is not fully compliant to Moodle coding style but working and well documented. + /** * Get my courses from DB * diff --git a/settings.php b/settings.php index 72a9070..a207b01 100644 --- a/settings.php +++ b/settings.php @@ -24,6 +24,9 @@ defined('MOODLE_INTERNAL') || die(); +// @codingStandardsIgnoreFile +// Let codechecker ignore this file. This legacy code is not fully compliant to Moodle coding style but working and well documented. + if ($hassiteconfig) { // Empty $settings to prevent a single settings page from being created by lib/classes/plugininfo/block.php // because we will create several settings pages now. -- GitLab