diff --git a/CHANGELOG.md b/CHANGELOG.md index a517c8a..0117605 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). The format of this change log follows the advice given at [Keep a CHANGELOG](https://keepachangelog.com). ## [Unreleased] +### Changed +- Made codes for `moodle.Commenting.MissingDocblock` more specific to the scenario (Fixes #154). ## [v3.4.6] - 2024-04-03 ### Fixed diff --git a/moodle/Sniffs/Commenting/MissingDocblockSniff.php b/moodle/Sniffs/Commenting/MissingDocblockSniff.php index 4467a06..2e0e1c9 100644 --- a/moodle/Sniffs/Commenting/MissingDocblockSniff.php +++ b/moodle/Sniffs/Commenting/MissingDocblockSniff.php @@ -100,7 +100,7 @@ protected function processScopes(File $phpcsFile, int $stackPtr): void { if ($fileblock === null) { $objectName = TokenUtil::getObjectName($phpcsFile, $stackPtr); - $phpcsFile->addError('Missing docblock for file %s', $stackPtr, 'Missing', [$objectName]); + $phpcsFile->addError('Missing docblock for file %s', $stackPtr, 'File', [$objectName]); } } @@ -109,7 +109,7 @@ protected function processScopes(File $phpcsFile, int $stackPtr): void { $objectName = TokenUtil::getObjectName($phpcsFile, $typePtr); $objectType = TokenUtil::getObjectType($phpcsFile, $typePtr); - $phpcsFile->addError('Missing docblock for %s %s', $typePtr, 'Missing', [$objectType, $objectName]); + $phpcsFile->addError('Missing docblock for %s %s', $typePtr, $objectType, [$objectType, $objectName]); } if ($artifactCount === 1) { @@ -196,9 +196,9 @@ protected function processFunctions(File $phpcsFile, int $stackPtr): void { ); } } elseif ($extendsOrImplements) { - $phpcsFile->addWarning('Missing docblock for %s %s', $typePtr, 'Missing', [$objectType, $objectName]); + $phpcsFile->addWarning('Missing docblock for %s %s', $typePtr, $objectType, [$objectType, $objectName]); } else { - $phpcsFile->addError('Missing docblock for %s %s', $typePtr, 'Missing', [$objectType, $objectName]); + $phpcsFile->addError('Missing docblock for %s %s', $typePtr, $objectType, [$objectType, $objectName]); } } } @@ -245,14 +245,14 @@ protected function processConstants(File $phpcsFile, int $stackPtr): void { $phpcsFile->addError( 'Missing docblock for constant %s::%s', $typePtr, - 'Missing', + 'Constant', [$containerName, $objectName] ); } else { $phpcsFile->addError( 'Missing docblock for constant %s', $typePtr, - 'Missing', + 'Constant', [$objectName] ); }