Skip to content

Commit a0bb7f8

Browse files
authored
Merge pull request #248 from stronk7/move_to_moodle_cs
Move to moodle cs
2 parents 5fb8f26 + 9562ce0 commit a0bb7f8

File tree

8 files changed

+32
-25
lines changed

8 files changed

+32
-25
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ integration happens.
1111
+ Some checks require a MySQL, master-based site to be up and running.
1212
+ Some checks require a PHP engine to run (other are pure shell scripts).
1313
+ Some checks require the installation of 3rd part tools (phpunit...).
14-
+ Some checks require the presence of both local_codechecker and local_moodlecheck local plugins.
14+
+ Some checks require the presence of local_moodlecheck local plugin.
15+
+ To get all other dependencies installed, ensure that both composer and npm are run regularly.
1516
+ You can run them standalone or also with the ease and functionalities coming with different tools like:
1617
- Jenkins: http://jenkins-php.org
1718
- Travis: https://docs.travis-ci.com/user/languages/php/

composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"require": {
3-
"squizlabs/php_codesniffer": "^3.5.8",
4-
"mustache/mustache": "^2.11"
3+
"moodlehq/moodle-cs": "^3.2.3",
4+
"mustache/mustache": "^2.14.1"
5+
},
6+
"config": {
7+
"allow-plugins": {
8+
"dealerdirect/phpcodesniffer-composer-installer": true
9+
}
510
}
611
}

initial_jenkins_moodle_setup/initial_jenkins_moodle_setup.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,6 @@ else
8484
fi
8585
cd ${basedir}/${gitdir}/${moodledir} && ${gitcmd} pull origin master && ${gitcmd} reset --hard v2.4.0-beta
8686

87-
# Create the git clone for the codechecker, master branch and add it to .git/info/exclude
88-
if [ -d "${basedir}/${gitdir}/${moodledir}/local/codechecker" ]; then
89-
echo "Skip https://github.com/moodlehq/moodle-local_codechecker.git already present at local/codechecker"
90-
else
91-
cd ${basedir}/${gitdir}/${moodledir}/local && ${gitcmd} clone https://github.com/moodlehq/moodle-local_codechecker.git codechecker
92-
echo local/codechecker >> ${basedir}/${gitdir}/${moodledir}/.git/info/exclude
93-
fi
94-
cd ${basedir}/${gitdir}/${moodledir}/local/codechecker && ${gitcmd} pull origin master && ${gitcmd} reset --hard origin/master
95-
9687
# Create the git clone for the moodlecheck, master branch and add it to .git/info/exclude
9788
if [ -d "${basedir}/${gitdir}/${moodledir}/local/moodlecheck" ]; then
9889
echo "Skip https://github.com/moodlehq/moodle-local_moodlecheck.git already present at local/moodlecheck"

package-lock.json

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

remote_branch_checker/remote_branch_checker.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# $npmcmd: Optional, path to the npm executable (global)
1717
# $pushremote: (optional) Remote to push the results of prechecker to. Will create branches like MDL-1234-master-shorthash
1818
# $resettocommit: (optional) Should not be used in production runs. Reset $integrateto to a commit for testing purposes.
19-
# $phpcsstandard: (optional) directory for coding standard path
2019

2120
# Don't want debugging @ start, but want exit on error
2221
set +x
@@ -315,6 +314,7 @@ echo "Info: Preparing npm"
315314
# the list of components available in the moodle-ci-site, because getting
316315
# the list from the checked branch does require installing the site completely and
317316
# that would slowdown the checker a lot. It's ok 99% of times.
317+
echo "Info: Calculating valid components..."
318318
${phpcmd} ${mydir}/../list_valid_components/list_valid_components.php \
319319
--basedir="${WORKSPACE}" --absolute=true > "${WORKSPACE}/work/valid_components.txt"
320320

@@ -489,22 +489,16 @@ ${phpcmd} ${WORKSPACE}/check_upgrade_savepoints.php > "${WORKSPACE}/work/savepoi
489489
cat "${WORKSPACE}/work/savepoints.txt" | ${phpcmd} ${mydir}/../check_upgrade_savepoints/savepoints2checkstyle.php > "${WORKSPACE}/work/savepoints.xml"
490490
rm ${WORKSPACE}/check_upgrade_savepoints.php
491491

492-
# Run the PHPCS
493-
echo "Info: Running phpcs..."
494-
if [[ ! -n "${phpcsstandard}" ]]; then
495-
phpcsstandard="${mydir}/../../codechecker/moodle"
496-
fi
497492
# Note we have to pass the full list of components (valid_components.txt) as calculated
498493
# earlier in the script when the whole code-base was available. Now, for performance
499494
# reasons, only the patch-modified files are remaining so we cannot use phpcs abilities
500495
# to detect all components anymore. Hence using the complete, already calculated, list.
501496
# Note we need to specify where both moodle and PHPCompatibility, specifically the later, standards sit.
502497
# TODO: Some day this will work from the moodle ruleset.xml file, it doesn't right now.
503498
${phpcmd} ${mydir}/../vendor/bin/phpcs \
504-
--runtime-set installed_paths "${phpcsstandard}","${phpcsstandard}/../PHPCompatibility" \
505499
--runtime-set moodleComponentsListPath "${WORKSPACE}/work/valid_components.txt" \
506500
--report=checkstyle --report-file="${WORKSPACE}/work/cs.xml" \
507-
--extensions=php --standard=${phpcsstandard} ${WORKSPACE}
501+
--extensions=php --standard=moodle ${WORKSPACE}
508502

509503
if [[ -n "${LOCAL_CI_TESTS_RUNNING}" ]]; then
510504
# We don't run the moodlecheck tests in our testing environment because local_moodlecheck requires

run_phpunittests/run_phpunittests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ definedtests=$(grep -r "directory suffix" ${gitdir}/phpunit.xml | sed 's/^[^>]*>
112112
# Load all the existing tests
113113
existingtests=$(cd ${gitdir} && find . -name tests | sed 's/^\.\/\(.*\)$/\1/g')
114114
# Some well-known "tests" that we can ignore here
115-
ignoretests="local/codechecker/pear/PHP/tests lib/phpexcel/PHPExcel/Shared/JAMA/tests"
115+
ignoretests="lib/phpexcel/PHPExcel/Shared/JAMA/tests"
116116
# Unit test classes to look for with each file (must be 1 and only 1). MDLSITE-2096
117117
# TODO: Some day replace this with the list of abstract classes, from PHPUnit_Framework_TestCase using some classmap
118118
unittestclasses="basic_testcase advanced_testcase database_driver_testcase externallib_advanced_testcase data_loading_method_test_base question_testcase question_attempt_upgrader_test_base qbehaviour_walkthrough_test_base grade_base_testcase"

version.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
$plugin->version = 2012113000;
2828
$plugin->requires = 2013070400; // Moodle 2.6dev (Build 20130704) and upwards.
2929
$plugin->dependencies = array( // Also requires these plugins to be installed.
30-
'local_codechecker' => '2012061600',
31-
'local_moodlecheck' => '2012011000'
30+
'local_moodlecheck' => '2012011000',
3231
);
3332
$plugin->component = 'local_ci';
3433
$plugin->release = '0.9.1';

versions_check_set/versions_check_set.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ ${mydir}/../list_valid_components/list_valid_components.sh > "${WORKSPACE}/valid
7979
allfiles=$( find "${gitdir}" -name version.php | awk -F "/" '{print NF-1"\t"$0}' | sort -n | cut -f 2- )
8080

8181
# version.php files to ignore
82-
ignorefiles="(local/(ci|codechecker|moodlecheck)/version.php|.*/tests/fixtures/.*/version.php)"
82+
ignorefiles="(local/(ci|moodlecheck)/version.php|.*/tests/fixtures/.*/version.php)"
8383

8484
# Perform various checks with the version.php files
8585
for i in ${allfiles}; do

0 commit comments

Comments
 (0)