honeybadger-io/honeybadger-laravel

View on GitHub

Showing 12 of 12 total issues

Method writeEnv has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

private function writeEnv(): void
{
$this->tasks->addTask(
'Write HONEYBADGER_API_KEY to .env',
function () {
Severity: Major
Found in src/Commands/HoneybadgerInstallCommand.php - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    if (isset($this->config['app_endpoint'])) {
    $this->tasks->addTask(
    'Write HONEYBADGER_APP_ENDPOINT to .env',
    function () {
    return $this->installer->writeConfig([
    Severity: Major
    Found in src/Commands/HoneybadgerInstallCommand.php and 1 other location - About 1 hr to fix
    src/Commands/HoneybadgerInstallCommand.php on lines 172..191

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    if (isset($this->config['endpoint'])) {
    $this->tasks->addTask(
    'Write HONEYBADGER_ENDPOINT to .env',
    function () {
    return $this->installer->writeConfig([
    Severity: Major
    Found in src/Commands/HoneybadgerInstallCommand.php and 1 other location - About 1 hr to fix
    src/Commands/HoneybadgerInstallCommand.php on lines 193..211

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    <?php
     
    namespace Honeybadger\HoneybadgerLaravel;
     
    use Honeybadger\Contracts\Reporter;
    Severity: Major
    Found in src/HoneybadgerLogEventDriver.php and 1 other location - About 1 hr to fix
    src/HoneybadgerLogDriver.php on lines 1..22

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    <?php
     
    namespace Honeybadger\HoneybadgerLaravel;
     
    use Honeybadger\Contracts\Reporter;
    Severity: Major
    Found in src/HoneybadgerLogDriver.php and 1 other location - About 1 hr to fix
    src/HoneybadgerLogEventDriver.php on lines 1..22

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    Event::macro('pingHoneybadgerOnSuccess', function (string $checkinIdOrName, $environments = null) {
    return $this->onSuccess(function () use ($checkinIdOrName, $environments) {
    if ($environments === null || app()->environment($environments)) {
    app(Reporter::class)->checkin($checkinIdOrName);
    }
    Severity: Minor
    Found in src/HoneybadgerServiceProvider.php and 1 other location - About 40 mins to fix
    src/HoneybadgerServiceProvider.php on lines 129..135

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    Event::macro('thenPingHoneybadger', function (string $checkinIdOrName, $environments = null) {
    return $this->then(function () use ($checkinIdOrName, $environments) {
    if ($environments === null || app()->environment($environments)) {
    app(Reporter::class)->checkin($checkinIdOrName);
    }
    Severity: Minor
    Found in src/HoneybadgerServiceProvider.php and 1 other location - About 40 mins to fix
    src/HoneybadgerServiceProvider.php on lines 138..144

    Avoid too many return statements within this method.
    Open

    return $this->installer->writeConfig([
    'HONEYBADGER_APP_ENDPOINT' => $this->config['app_endpoint'],
    ], base_path('.env'));
    Severity: Major
    Found in src/Commands/HoneybadgerInstallCommand.php - About 30 mins to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      public function getEventPayload($event): EventPayload
      {
      $metadata = [
      'connectionName' => $event->connectionName,
      'command' => $this->formatCommand($event->command, $event->parameters),
      Severity: Minor
      Found in src/Events/RedisCommandExecuted.php and 1 other location - About 30 mins to fix
      src/Events/DatabaseQueryExecuted.php on lines 16..30

      Avoid too many return statements within this method.
      Open

      return $this->installer->writeConfig([
      'HONEYBADGER_APP_ENDPOINT' => $this->config['app_endpoint'],
      ], base_path('.env.example'));
      Severity: Major
      Found in src/Commands/HoneybadgerInstallCommand.php - About 30 mins to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        public function getEventPayload($event): EventPayload
        {
        $metadata = [
        'connectionName' => $event->connectionName,
        'sql' => $this->sanitize($event->sql, $event->connection),
        Severity: Minor
        Found in src/Events/DatabaseQueryExecuted.php and 1 other location - About 30 mins to fix
        src/Events/RedisCommandExecuted.php on lines 18..32

        Function setLaravelRouteActionContext has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        private function setLaravelRouteActionContext()
        {
        $currentRoute = Route::getCurrentRoute();
        if ($currentRoute === null) {
        return;
        Severity: Minor
        Found in src/ContextManager.php - About 25 mins to fix
        Severity
        Category
        Status
        Source
        Language