diff --git a/lang/en/local_moodlecheck.php b/lang/en/local_moodlecheck.php index c4b9805..bed9bb3 100644 --- a/lang/en/local_moodlecheck.php +++ b/lang/en/local_moodlecheck.php @@ -73,9 +73,3 @@ $string['rule_categoryvalid'] = 'Category tag is valid'; $string['error_categoryvalid'] = 'Category {$a->category} is not valid'; - -$string['rule_filehascopyright'] = 'Files have @copyright tag'; -$string['error_filehascopyright'] = 'File-level phpdocs block does not have @copyright tag'; - -$string['rule_filehaslicense'] = 'Files have @license tag'; -$string['error_filehaslicense'] = 'File-level phpdocs block does not have @license tag'; diff --git a/rules/phpdocs_basic.php b/rules/phpdocs_basic.php index 2fc5702..05a42ea 100644 --- a/rules/phpdocs_basic.php +++ b/rules/phpdocs_basic.php @@ -33,8 +33,6 @@ local_moodlecheck_registry::add_rule('functionarguments')->set_callback('local_moodlecheck_functionarguments'); local_moodlecheck_registry::add_rule('variableshasvar')->set_callback('local_moodlecheck_variableshasvar'); local_moodlecheck_registry::add_rule('definedoccorrect')->set_callback('local_moodlecheck_definedoccorrect'); -local_moodlecheck_registry::add_rule('filehascopyright')->set_callback('local_moodlecheck_filehascopyright'); -local_moodlecheck_registry::add_rule('filehaslicense')->set_callback('local_moodlecheck_filehaslicense'); local_moodlecheck_registry::add_rule('phpdocsinvalidinlinetag')->set_callback('local_moodlecheck_phpdocsinvalidinlinetag'); local_moodlecheck_registry::add_rule('phpdocsuncurlyinlinetag')->set_callback('local_moodlecheck_phpdocsuncurlyinlinetag'); local_moodlecheck_registry::add_rule('phpdoccontentsinlinetag')->set_callback('local_moodlecheck_phpdoccontentsinlinetag'); @@ -381,31 +379,3 @@ function local_moodlecheck_definedoccorrect(local_moodlecheck_file $file) { } return $errors; } - -/** - * Makes sure that files have copyright tag - * - * @param local_moodlecheck_file $file - * @return array of found errors - */ -function local_moodlecheck_filehascopyright(local_moodlecheck_file $file) { - $phpdocs = $file->find_file_phpdocs(); - if ($phpdocs && !count($phpdocs->get_tags('copyright', true))) { - return [['line' => $phpdocs->get_line_number($file, '@copyright')]]; - } - return []; -} - -/** - * Makes sure that files have license tag - * - * @param local_moodlecheck_file $file - * @return array of found errors - */ -function local_moodlecheck_filehaslicense(local_moodlecheck_file $file) { - $phpdocs = $file->find_file_phpdocs(); - if ($phpdocs && !count($phpdocs->get_tags('license', true))) { - return [['line' => $phpdocs->get_line_number($file, '@license')]]; - } - return []; -} diff --git a/tests/fixtures/classtags.php b/tests/fixtures/classtags.php deleted file mode 100644 index 0a01c9e..0000000 --- a/tests/fixtures/classtags.php +++ /dev/null @@ -1,29 +0,0 @@ -. - -/** - * Fixture file providing a class. - * - * @package local_moodlecheck - * @copyright 2018 David Mudrák - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * This is a dummy class without any tags. - */ -class dummy_class_without_tags { -} diff --git a/tests/moodlecheck_rules_test.php b/tests/moodlecheck_rules_test.php index 5645af2..c7fffbc 100644 --- a/tests/moodlecheck_rules_test.php +++ b/tests/moodlecheck_rules_test.php @@ -73,24 +73,6 @@ public function test_constantclass(): void { $this->assertSame(0, $found->length); } - /** - * Assert that classes do not need to have any particular phpdocs tags. - * - * @covers ::local_moodlecheck_filehascopyright - * @covers ::local_moodlecheck_filehaslicense - */ - public function test_classtags(): void { - global $PAGE; - - $output = $PAGE->get_renderer('local_moodlecheck'); - $path = new local_moodlecheck_path('local/moodlecheck/tests/fixtures/classtags.php ', null); - - $result = $output->display_path($path, 'xml'); - - $this->assertStringNotContainsString('classeshavecopyright', $result); - $this->assertStringNotContainsString('classeshavelicense', $result); - } - /** * Ensure that token_get_all() does not return PHP Warnings. *