Skip to content

Commit 5398c9c

Browse files
Remove filehascopyright, filehaslicense (#139)
Replaced by moodlehq/moodle-cs#125 Co-authored-by: Eloy Lafuente <[email protected]>
1 parent 13b12d6 commit 5398c9c

File tree

4 files changed

+0
-83
lines changed

4 files changed

+0
-83
lines changed

lang/en/local_moodlecheck.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,3 @@
7373

7474
$string['rule_categoryvalid'] = 'Category tag is valid';
7575
$string['error_categoryvalid'] = 'Category <b>{$a->category}</b> is not valid';
76-
77-
$string['rule_filehascopyright'] = 'Files have @copyright tag';
78-
$string['error_filehascopyright'] = 'File-level phpdocs block does not have @copyright tag';
79-
80-
$string['rule_filehaslicense'] = 'Files have @license tag';
81-
$string['error_filehaslicense'] = 'File-level phpdocs block does not have @license tag';

rules/phpdocs_basic.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
local_moodlecheck_registry::add_rule('functionarguments')->set_callback('local_moodlecheck_functionarguments');
3434
local_moodlecheck_registry::add_rule('variableshasvar')->set_callback('local_moodlecheck_variableshasvar');
3535
local_moodlecheck_registry::add_rule('definedoccorrect')->set_callback('local_moodlecheck_definedoccorrect');
36-
local_moodlecheck_registry::add_rule('filehascopyright')->set_callback('local_moodlecheck_filehascopyright');
37-
local_moodlecheck_registry::add_rule('filehaslicense')->set_callback('local_moodlecheck_filehaslicense');
3836
local_moodlecheck_registry::add_rule('phpdocsinvalidinlinetag')->set_callback('local_moodlecheck_phpdocsinvalidinlinetag');
3937
local_moodlecheck_registry::add_rule('phpdocsuncurlyinlinetag')->set_callback('local_moodlecheck_phpdocsuncurlyinlinetag');
4038
local_moodlecheck_registry::add_rule('phpdoccontentsinlinetag')->set_callback('local_moodlecheck_phpdoccontentsinlinetag');
@@ -381,31 +379,3 @@ function local_moodlecheck_definedoccorrect(local_moodlecheck_file $file) {
381379
}
382380
return $errors;
383381
}
384-
385-
/**
386-
* Makes sure that files have copyright tag
387-
*
388-
* @param local_moodlecheck_file $file
389-
* @return array of found errors
390-
*/
391-
function local_moodlecheck_filehascopyright(local_moodlecheck_file $file) {
392-
$phpdocs = $file->find_file_phpdocs();
393-
if ($phpdocs && !count($phpdocs->get_tags('copyright', true))) {
394-
return [['line' => $phpdocs->get_line_number($file, '@copyright')]];
395-
}
396-
return [];
397-
}
398-
399-
/**
400-
* Makes sure that files have license tag
401-
*
402-
* @param local_moodlecheck_file $file
403-
* @return array of found errors
404-
*/
405-
function local_moodlecheck_filehaslicense(local_moodlecheck_file $file) {
406-
$phpdocs = $file->find_file_phpdocs();
407-
if ($phpdocs && !count($phpdocs->get_tags('license', true))) {
408-
return [['line' => $phpdocs->get_line_number($file, '@license')]];
409-
}
410-
return [];
411-
}

tests/fixtures/classtags.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/moodlecheck_rules_test.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,6 @@ public function test_constantclass(): void {
7373
$this->assertSame(0, $found->length);
7474
}
7575

76-
/**
77-
* Assert that classes do not need to have any particular phpdocs tags.
78-
*
79-
* @covers ::local_moodlecheck_filehascopyright
80-
* @covers ::local_moodlecheck_filehaslicense
81-
*/
82-
public function test_classtags(): void {
83-
global $PAGE;
84-
85-
$output = $PAGE->get_renderer('local_moodlecheck');
86-
$path = new local_moodlecheck_path('local/moodlecheck/tests/fixtures/classtags.php ', null);
87-
88-
$result = $output->display_path($path, 'xml');
89-
90-
$this->assertStringNotContainsString('classeshavecopyright', $result);
91-
$this->assertStringNotContainsString('classeshavelicense', $result);
92-
}
93-
9476
/**
9577
* Ensure that token_get_all() does not return PHP Warnings.
9678
*

0 commit comments

Comments
 (0)