/** * Checks Composer json and lock files. */ public function review(ReporterInterface $reporter, ReviewableInterface $file = null) { if ($file->getFileName() == 'composer.json') { $this->composerJsonDetected = true; } if ($file->getFileName() == 'composer.lock') { $this->composerLockDetected = true; } // Check if we are on the Last File if ($reporter->getCurrent() - 1 == $reporter->getTotal() && $this->composerJsonDetected && !$this->composerLockDetected) { $reporter->warning('You must commit composer.lock with composer.json', $this); } }
/** * Check the composer.lock file for security issues. * * @param ReviewableInterface $file * * @return bool */ public function canReview(ReviewableInterface $file) { if ($file->getFileName() === 'composer.lock') { return true; } return false; }
/** * Lint only the composer.json file. * * @param ReviewableInterface $file * * @return bool */ public function canReview(ReviewableInterface $file) { // only if the filename is "composer.json" return $file->getFileName() === 'composer.json'; }