Skip to content

Commit 3514c0a

Browse files
authored
Merge pull request #1073 from moodle-an-hochschulen/issue-1014
Make codechecker happy again
2 parents f1d419c + 097b3a1 commit 3514c0a

File tree

103 files changed

+3801
-2160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+3801
-2160
lines changed
Lines changed: 19 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,23 @@
11
name: Moodle Plugin CI
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
inputs:
8+
moodle-core-branch:
9+
description: 'Moodle core branch to test against (if not provided, the branch will be auto-detected)'
10+
required: false
11+
type: string
12+
repository_dispatch:
13+
types: [moodle-plugin-ci]
414

515
jobs:
6-
test:
7-
runs-on: ubuntu-22.04
8-
9-
services:
10-
postgres:
11-
image: postgres:14
12-
env:
13-
POSTGRES_USER: 'postgres'
14-
POSTGRES_HOST_AUTH_METHOD: 'trust'
15-
ports:
16-
- 5432:5432
17-
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
18-
19-
mariadb:
20-
image: mariadb:10
21-
env:
22-
MYSQL_USER: 'root'
23-
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
24-
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
25-
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"
26-
ports:
27-
- 3306:3306
28-
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
29-
30-
strategy:
31-
fail-fast: false
32-
matrix:
33-
php: ['8.2', '8.3', '8.4']
34-
moodle-branch: ['MOODLE_500_STABLE']
35-
database: [pgsql, mariadb]
36-
37-
steps:
38-
- name: Check out repository code
39-
uses: actions/checkout@v4
40-
with:
41-
path: plugin
42-
43-
- name: Setup PHP ${{ matrix.php }}
44-
uses: shivammathur/setup-php@v2
45-
with:
46-
php-version: ${{ matrix.php }}
47-
extensions: ${{ matrix.extensions }}
48-
ini-values: max_input_vars=5000
49-
coverage: none
50-
51-
- name: Initialise moodle-plugin-ci
52-
run: |
53-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
54-
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
55-
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
56-
sudo locale-gen en_AU.UTF-8
57-
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
58-
59-
- name: Install moodle-plugin-ci
60-
run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
61-
env:
62-
DB: ${{ matrix.database }}
63-
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
64-
65-
- name: PHP Lint
66-
if: ${{ !cancelled() }}
67-
run: moodle-plugin-ci phplint
68-
69-
- name: PHP Mess Detector
70-
continue-on-error: true # This step will show errors but will not fail
71-
if: ${{ !cancelled() }}
72-
run: moodle-plugin-ci phpmd
73-
74-
- name: Moodle Code Checker
75-
if: ${{ !cancelled() }}
76-
run: moodle-plugin-ci phpcs --max-warnings 0
77-
78-
- name: Boost Union Code Checker
79-
uses: JJ/github-pr-contains-action@releases/v14
80-
if: ${{ !cancelled() }}
81-
with:
82-
github-token: ${{github.token}}
83-
diffDoesNotContain: "theme->settings->"
84-
85-
- name: Moodle PHPDoc Checker
86-
if: ${{ !cancelled() }}
87-
run: moodle-plugin-ci phpdoc --max-warnings 0
88-
89-
- name: Validating
90-
if: ${{ !cancelled() }}
91-
run: moodle-plugin-ci validate
92-
93-
- name: Check upgrade savepoints
94-
if: ${{ !cancelled() }}
95-
run: moodle-plugin-ci savepoints
96-
97-
- name: Mustache Lint
98-
continue-on-error: true # This step will show errors but will not fail
99-
if: ${{ !cancelled() }}
100-
run: moodle-plugin-ci mustache
101-
102-
- name: Grunt
103-
if: ${{ !cancelled() }}
104-
run: moodle-plugin-ci grunt --max-lint-warnings 0
105-
106-
- name: PHPUnit tests
107-
if: ${{ !cancelled() }}
108-
run: moodle-plugin-ci phpunit --fail-on-warning
109-
110-
- name: Raise Behat timeout (Required for theme_boost_union_general.feature)
111-
if: ${{ !cancelled() }}
112-
run: moodle-plugin-ci add-config '$CFG->behat_increasetimeout = 3;'
113-
114-
- name: Behat features
115-
id: behat
116-
if: ${{ !cancelled() }}
117-
run: moodle-plugin-ci behat --profile chrome --suite boost_union
118-
119-
- name: Upload Behat Faildump
120-
if: ${{ failure() && steps.behat.outcome == 'failure' }}
121-
uses: actions/upload-artifact@v4
122-
with:
123-
name: Behat Faildump (${{ join(matrix.*, ', ') }})
124-
path: ${{ github.workspace }}/moodledata/behat_dump
125-
retention-days: 7
126-
if-no-files-found: ignore
127-
128-
- name: Mark cancelled jobs as failed.
129-
if: ${{ cancelled() }}
130-
run: exit 1
16+
moodle-plugin-ci:
17+
uses: moodle-an-hochschulen/moodle-workflows/.github/workflows/moodle-plugin-ci.yml@main
18+
with:
19+
moodle-core-branch: ${{ inputs.moodle-core-branch || github.event.client_payload.moodle-core-branch }}
20+
pr-check-diff-does-not-contain: "theme->settings->"
21+
behat-suite: "boost_union"
22+
behat-timeout: 3 # Required for theme_boost_union_general.feature
23+
mustache-continue-on-error: true
Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,17 @@
1-
#
2-
# Whenever a new tag starting with "v" is pushed, add the tagged version
3-
# to the Moodle Plugins directory at https://moodle.org/plugins
4-
#
5-
# revision: 2021070201
6-
#
7-
name: Releasing in the Plugins directory
1+
name: Moodle Plugin Release
82

9-
on:
10-
push:
11-
tags:
12-
- v*
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Git tag to be released'
11+
required: true
1312

14-
workflow_dispatch:
15-
inputs:
16-
tag:
17-
description: 'Tag to be released'
18-
required: true
19-
20-
defaults:
21-
run:
22-
shell: bash
23-
24-
jobs:
25-
release-at-moodle-org:
26-
runs-on: ubuntu-latest
27-
env:
28-
PLUGIN: theme_boost_union
29-
CURL: curl -s
30-
ENDPOINT: https://moodle.org/webservice/rest/server.php
31-
TOKEN: ${{ secrets.MOODLE_ORG_TOKEN }}
32-
FUNCTION: local_plugins_add_version
33-
34-
steps:
35-
- name: Call the service function
36-
id: add-version
37-
run: |
38-
if [[ ! -z "${{ github.event.inputs.tag }}" ]]; then
39-
TAGNAME="${{ github.event.inputs.tag }}"
40-
elif [[ $GITHUB_REF = refs/tags/* ]]; then
41-
TAGNAME="${GITHUB_REF##*/}"
42-
fi
43-
if [[ -z "${TAGNAME}" ]]; then
44-
echo "No tag name has been provided!"
45-
exit 1
46-
fi
47-
ZIPURL="https://api.github.com/repos/${{ github.repository }}/zipball/${TAGNAME}"
48-
RESPONSE=$(${CURL} ${ENDPOINT} --data-urlencode "wstoken=${TOKEN}" \
49-
--data-urlencode "wsfunction=${FUNCTION}" \
50-
--data-urlencode "moodlewsrestformat=json" \
51-
--data-urlencode "frankenstyle=${PLUGIN}" \
52-
--data-urlencode "zipurl=${ZIPURL}" \
53-
--data-urlencode "vcssystem=git" \
54-
--data-urlencode "vcsrepositoryurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \
55-
--data-urlencode "vcstag=${TAGNAME}" \
56-
--data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \
57-
--data-urlencode "altdownloadurl=${ZIPURL}")
58-
echo "response=${RESPONSE}" >> $GITHUB_OUTPUT
59-
60-
- name: Evaluate the response
61-
id: evaluate-response
62-
env:
63-
RESPONSE: ${{ steps.add-version.outputs.response }}
64-
run: |
65-
jq <<< ${RESPONSE}
66-
jq --exit-status ".id" <<< ${RESPONSE} > /dev/null
13+
jobs:
14+
release:
15+
uses: moodle-an-hochschulen/moodle-workflows/.github/workflows/moodle-release.yml@main
16+
secrets:
17+
MOODLE_ORG_TOKEN: ${{ secrets.MOODLE_ORG_TOKEN }}

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Changes
66

77
### Unreleased
88

9+
* 2025-10-15 - Make codechecker happy again
10+
* 2025-10-15 - Tests: Switch Github actions workflows to reusable workflows by Moodle an Hochschulen e.V.
911
* 2025-10-20 - Tests: Add tests for Boost Union features which might but must not affect other active themes, resolves #761
1012
* 2025-10-16 - Feature: Add Bootstrap alert to Boost Union settings if Boost Union (or Boost Union Child) is not the active theme, resolves #773.
1113
* 2025-10-15 - Improvement: On course cards, display the course fields as Bootstrap badges, resolves #1070

accessibility/declaration.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
require(__DIR__ . '/../../../config.php'); // phpcs:disable moodle.Files.RequireLogin.Missing
3030

3131
// Require the necessary libraries.
32-
require_once($CFG->dirroot.'/theme/boost_union/lib.php');
33-
require_once($CFG->dirroot.'/theme/boost_union/locallib.php');
32+
require_once($CFG->dirroot . '/theme/boost_union/lib.php');
33+
require_once($CFG->dirroot . '/theme/boost_union/locallib.php');
3434

3535
// Set page URL.
3636
$PAGE->set_url('/theme/boost_union/accessibility/declaration.php');
@@ -50,8 +50,10 @@
5050
// If the declaration of accessibility page is disabled, we just show a short friendly warning page and are done.
5151
if ($config->enableaccessibilitydeclaration != THEME_BOOST_UNION_SETTING_SELECT_YES) {
5252
echo $OUTPUT->header();
53-
$notification = new \core\output\notification(get_string('accessibilitydeclarationdisabled', 'theme_boost_union'),
54-
\core\output\notification::NOTIFY_INFO);
53+
$notification = new \core\output\notification(
54+
get_string('accessibilitydeclarationdisabled', 'theme_boost_union'),
55+
\core\output\notification::NOTIFY_INFO
56+
);
5557
$notification->set_show_closebutton(false);
5658
echo $OUTPUT->render($notification);
5759
echo $OUTPUT->footer();

accessibility/support.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
require(__DIR__ . '/../../../config.php'); // phpcs:disable moodle.Files.RequireLogin.Missing
3030

3131
// Require the necessary libraries.
32-
require_once($CFG->dirroot.'/theme/boost_union/lib.php');
33-
require_once($CFG->dirroot.'/theme/boost_union/locallib.php');
32+
require_once($CFG->dirroot . '/theme/boost_union/lib.php');
33+
require_once($CFG->dirroot . '/theme/boost_union/locallib.php');
3434

3535
// Set page URL.
3636
$PAGE->set_url('/theme/boost_union/accessibility/support.php');
@@ -50,17 +50,21 @@
5050
// If the accessibility support page is disabled, we just show a short friendly warning page and are done.
5151
if ($config->enableaccessibilitysupport != THEME_BOOST_UNION_SETTING_SELECT_YES) {
5252
echo $OUTPUT->header();
53-
$notification = new \core\output\notification(get_string('accessibilitysupportdisabled', 'theme_boost_union'),
54-
\core\output\notification::NOTIFY_INFO);
53+
$notification = new \core\output\notification(
54+
get_string('accessibilitysupportdisabled', 'theme_boost_union'),
55+
\core\output\notification::NOTIFY_INFO
56+
);
5557
$notification->set_show_closebutton(false);
5658
echo $OUTPUT->render($notification);
5759
echo $OUTPUT->footer();
5860
die;
5961
}
6062

6163
// If user login is required, we redirect to the login page.
62-
if (isset($config->allowaccessibilitysupportwithoutlogin) &&
63-
$config->allowaccessibilitysupportwithoutlogin != THEME_BOOST_UNION_SETTING_SELECT_YES) {
64+
if (
65+
isset($config->allowaccessibilitysupportwithoutlogin) &&
66+
$config->allowaccessibilitysupportwithoutlogin != THEME_BOOST_UNION_SETTING_SELECT_YES
67+
) {
6468
if (!isloggedin() || isguestuser()) {
6569
redirect(get_login_url());
6670
}
@@ -114,7 +118,7 @@
114118

115119
// Compose the mail content from form data.
116120
$subjectprefix = get_string('accessibilitysupportusermailsubject', 'theme_boost_union');
117-
$subject = '['.$subjectprefix.'] '.$data->subject;
121+
$subject = '[' . $subjectprefix . '] ' . $data->subject;
118122
$renderer = $PAGE->get_renderer('core');
119123
$message = $renderer->render_from_template('theme_boost_union/accessibility-support-email-body', $data);
120124

classes/admin_externalpage_tabs.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3535
*/
3636
class admin_externalpage_tabs {
37-
3837
/**
3938
* @var array Holds the tabs in this tab tree.
4039
*/

classes/admin_setting_configdatetime.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
* them as an array named after $name (so we only use $name2 internally for the setting)
4040
*/
4141
class admin_setting_configdatetime extends \admin_setting {
42-
4342
/**
4443
* Get the selected time.
4544
*
@@ -86,52 +85,52 @@ public function output_html($data, $query = '') {
8685
$default = $this->get_defaultsetting();
8786

8887
if (is_array($default)) {
89-
$defaultinfo = $default['y'].'-'.$default['M'].'-'.$default['d'].' '.$default['h'].':'.$default['m'];
88+
$defaultinfo = $default['y'] . '-' . $default['M'] . '-' . $default['d'] . ' ' . $default['h'] . ':' . $default['m'];
9089
} else {
9190
$defaultinfo = null;
9291
}
9392

9493
$return = '<div class="form-datetime defaultsnext">';
9594

96-
$return .= '<select id="'.$this->get_id().'y" name="'.$this->get_full_name().
95+
$return .= '<select id="' . $this->get_id() . 'y" name="' . $this->get_full_name() .
9796
'[y]" class="form-select d-inline-block me-2">';
9897
for ($i = 2020; $i <= date("Y") + 10; $i++) {
99-
$return .= '<option value="'.$i.'"'.($i == $data['y'] ? ' selected="selected"' : '').'>'.$i.'</option>';
98+
$return .= '<option value="' . $i . '"' . ($i == $data['y'] ? ' selected="selected"' : '') . '>' . $i . '</option>';
10099
}
101100
$return .= '</select>';
102101

103-
$return .= '<select id="'.$this->get_id().'M" name="'.$this->get_full_name().
102+
$return .= '<select id="' . $this->get_id() . 'M" name="' . $this->get_full_name() .
104103
'[M]" class="form-select d-inline-block me-2">';
105104
for ($i = 1; $i <= 12; $i++) {
106105
$sel = ($i == $data['M'] ? ' selected="selected"' : '');
107106
$dateobj = \DateTime::createFromFormat('!m', $i);
108-
$return .= '<option value="'.$i.'"'.$sel.'>'.userdate($dateobj->getTimestamp(), '%B').'</option>';
107+
$return .= '<option value="' . $i . '"' . $sel . '>' . userdate($dateobj->getTimestamp(), '%B') . '</option>';
109108
}
110109
$return .= '</select>';
111110

112-
$return .= '<select id="'.$this->get_id().'d" name="'.$this->get_full_name().
111+
$return .= '<select id="' . $this->get_id() . 'd" name="' . $this->get_full_name() .
113112
'[d]" class="form-select d-inline-block me-2">';
114113
for ($i = 1; $i <= 31; $i++) {
115114
$sel = ($i == $data['d'] ? ' selected="selected"' : '');
116-
$return .= '<option value="'.$i.'"'.$sel.'>'.sprintf('%02d', $i).'</option>';
115+
$return .= '<option value="' . $i . '"' . $sel . '>' . sprintf('%02d', $i) . '</option>';
117116
}
118117
$return .= '</select>';
119118

120-
$return .= '<select id="'.$this->get_id().'h" name="'.$this->get_full_name().
119+
$return .= '<select id="' . $this->get_id() . 'h" name="' . $this->get_full_name() .
121120
'[h]" class="form-select d-inline-block me-1">';
122121
for ($i = 0; $i < 24; $i++) {
123122
$sel = ($i == $data['h'] ? ' selected="selected"' : '');
124-
$return .= '<option value="'.$i.'"'.$sel.'>'.sprintf('%02d', $i).'</option>';
123+
$return .= '<option value="' . $i . '"' . $sel . '>' . sprintf('%02d', $i) . '</option>';
125124
}
126125
$return .= '</select>';
127126

128127
$return .= '<span class="me-1">:</span>';
129128

130-
$return .= '<select id="'.$this->get_id().'m" name="'.$this->get_full_name().
129+
$return .= '<select id="' . $this->get_id() . 'm" name="' . $this->get_full_name() .
131130
'[m]" class="form-select d-inline-block me-2">';
132131
for ($i = 0; $i < 60; $i += 5) {
133132
$sel = ($i == $data['m'] ? ' selected="selected"' : '');
134-
$return .= '<option value="'.$i.'"'.$sel.'>'.sprintf('%02d', $i).'</option>';
133+
$return .= '<option value="' . $i . '"' . $sel . '>' . sprintf('%02d', $i) . '</option>';
135134
}
136135
$return .= '</select>';
137136

classes/admin_setting_configstoredfilealwayscallback.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3535
*/
3636
class admin_setting_configstoredfilealwayscallback extends \admin_setting_configstoredfile {
37-
3837
// This class is basically a admin_setting_configstoredfile class but which circumvents MDL-59082
3938
// and triggers the updatecallback everytime the setting is saved regardless if any values have changed.
4039
// As soon as MDL-59082 is fixed in Moodle core, this class could be removed again.

0 commit comments

Comments
 (0)