Skip to content

Commit

Permalink
Remove filehascopyright, filehaslicense (moodlehq#139)
Browse files Browse the repository at this point in the history
Replaced by moodlehq/moodle-cs#125

Co-authored-by: Eloy Lafuente <[email protected]>
  • Loading branch information
andrewnicols and stronk7 authored Mar 19, 2024
1 parent 13b12d6 commit 5398c9c
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 83 deletions.
6 changes: 0 additions & 6 deletions lang/en/local_moodlecheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,3 @@

$string['rule_categoryvalid'] = 'Category tag is valid';
$string['error_categoryvalid'] = 'Category <b>{$a->category}</b> 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';
30 changes: 0 additions & 30 deletions rules/phpdocs_basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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 [];
}
29 changes: 0 additions & 29 deletions tests/fixtures/classtags.php

This file was deleted.

18 changes: 0 additions & 18 deletions tests/moodlecheck_rules_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit 5398c9c

Please sign in to comment.