warlof/slackbot

View on GitHub

Showing 220 of 220 total issues

Method up has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function up()
    {
        Schema::create('slack_channels', function (Blueprint $table) {
            $table->string('id');
            $table->string('name');
Severity: Major
Found in src/database/migrations/2016_06_24_003800_create_slackbot_tables.php - About 2 hrs to fix

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

        protected $schedule = [
            [
                'command'    => 'slack:user:policy',
                'expression' => '*,30 * * * *',
                'allow_overlap'     => false,
    src/database/migrations/2017_12_19_160800_schedule_seeder_v230.php on lines 27..52

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 136.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        protected $schedule = [
            [
                'command'    => 'slack:user:sync',
                'expression' => '*/15 * * * *',
                'allow_overlap'     => false,
    src/database/migrations/2018_06_12_165812_schedule_seeder_v300.php on lines 27..52

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 136.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    <?php
    /**
     * This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
     *
     * Copyright (C) 2016, 2017, 2018, 2019  Loïc Leuilliot <loic.leuilliot@gmail.com>
    Severity: Major
    Found in src/lang/fr/seat.php and 4 other locations - About 2 hrs to fix
    src/lang/af/seat.php on lines 1..48
    src/lang/de/seat.php on lines 1..48
    src/lang/en/seat.php on lines 1..48
    src/lang/zh/seat.php on lines 1..48

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 135.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    <?php
    /**
     * This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
     *
     * Copyright (C) 2016, 2017, 2018, 2019  Loïc Leuilliot <loic.leuilliot@gmail.com>
    Severity: Major
    Found in src/lang/en/seat.php and 4 other locations - About 2 hrs to fix
    src/lang/af/seat.php on lines 1..48
    src/lang/de/seat.php on lines 1..48
    src/lang/fr/seat.php on lines 1..48
    src/lang/zh/seat.php on lines 1..48

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 135.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    <?php
    /**
     * This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
     *
     * Copyright (C) 2016, 2017, 2018, 2019  Loïc Leuilliot <loic.leuilliot@gmail.com>
    Severity: Major
    Found in src/lang/zh/seat.php and 4 other locations - About 2 hrs to fix
    src/lang/af/seat.php on lines 1..48
    src/lang/de/seat.php on lines 1..48
    src/lang/en/seat.php on lines 1..48
    src/lang/fr/seat.php on lines 1..48

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 135.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    <?php
    /**
     * This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
     *
     * Copyright (C) 2016, 2017, 2018, 2019  Loïc Leuilliot <loic.leuilliot@gmail.com>
    Severity: Major
    Found in src/lang/de/seat.php and 4 other locations - About 2 hrs to fix
    src/lang/af/seat.php on lines 1..48
    src/lang/en/seat.php on lines 1..48
    src/lang/fr/seat.php on lines 1..48
    src/lang/zh/seat.php on lines 1..48

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 135.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    <?php
    /**
     * This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
     *
     * Copyright (C) 2016, 2017, 2018, 2019  Loïc Leuilliot <loic.leuilliot@gmail.com>
    Severity: Major
    Found in src/lang/af/seat.php and 4 other locations - About 2 hrs to fix
    src/lang/de/seat.php on lines 1..48
    src/lang/en/seat.php on lines 1..48
    src/lang/fr/seat.php on lines 1..48
    src/lang/zh/seat.php on lines 1..48

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 135.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    File SlackbotJsonController.php has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
     *
     * Copyright (C) 2016, 2017, 2018, 2019  Loïc Leuilliot <loic.leuilliot@gmail.com>
    Severity: Minor
    Found in src/Http/Controllers/SlackbotJsonController.php - About 2 hrs to fix

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

              Schema::create('slack_channel_users', function (Blueprint $table) {
                  $table->unsignedInteger('group_id');
                  $table->string('channel_id');
                  $table->boolean('enable');
                  $table->timestamps();
      src/database/migrations/2016_06_24_003800_create_slackbot_tables.php on lines 85..102

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 127.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              Schema::create('slack_channel_roles', function (Blueprint $table) {
                  $table->unsignedInteger('role_id');
                  $table->string('channel_id');
                  $table->boolean('enable');
                  $table->timestamps();
      src/database/migrations/2016_06_24_003800_create_slackbot_tables.php on lines 104..121

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 127.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          private function postAllianceRelation($channelId, $allianceId)
          {
              $relation = SlackChannelAlliance::where('alliance_id', '=', $allianceId)
                  ->where('channel_id', '=', $channelId)
                  ->get();
      Severity: Major
      Found in src/Http/Controllers/SlackbotJsonController.php and 3 other locations - About 2 hrs to fix
      src/Http/Controllers/SlackbotJsonController.php on lines 285..304
      src/Http/Controllers/SlackbotJsonController.php on lines 306..325
      src/Http/Controllers/SlackbotJsonController.php on lines 327..346

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 126.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          private function postRoleRelation($channelId, $roleId)
          {
              $relation = SlackChannelRole::where('role_id', '=', $roleId)
                  ->where('channel_id', '=', $channelId)
                  ->get();
      Severity: Major
      Found in src/Http/Controllers/SlackbotJsonController.php and 3 other locations - About 2 hrs to fix
      src/Http/Controllers/SlackbotJsonController.php on lines 285..304
      src/Http/Controllers/SlackbotJsonController.php on lines 327..346
      src/Http/Controllers/SlackbotJsonController.php on lines 371..390

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 126.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          private function postGroupRelation($channelId, $groupId)
          {
              $relation = SlackChannelUser::where('channel_id', '=', $channelId)
                  ->where('group_id', '=', $groupId)
                  ->get();
      Severity: Major
      Found in src/Http/Controllers/SlackbotJsonController.php and 3 other locations - About 2 hrs to fix
      src/Http/Controllers/SlackbotJsonController.php on lines 306..325
      src/Http/Controllers/SlackbotJsonController.php on lines 327..346
      src/Http/Controllers/SlackbotJsonController.php on lines 371..390

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 126.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          private function postCorporationRelation($channelId, $corporationId)
          {
              $relation = SlackChannelCorporation::where('corporation_id', '=', $corporationId)
                  ->where('channel_id', '=', $channelId)
                  ->get();
      Severity: Major
      Found in src/Http/Controllers/SlackbotJsonController.php and 3 other locations - About 2 hrs to fix
      src/Http/Controllers/SlackbotJsonController.php on lines 285..304
      src/Http/Controllers/SlackbotJsonController.php on lines 306..325
      src/Http/Controllers/SlackbotJsonController.php on lines 371..390

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 126.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method httpRequest has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function httpRequest(string $method, string $uri, array $headers = [], array $body = []) : SlackResponse
          {
              $request_body = null;
      
              $headers = array_merge($headers, [
      Severity: Minor
      Found in src/Repositories/Slack/Fetchers/GuzzleFetcher.php - About 1 hr to fix

        Method callback has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function callback(Request $request)
            {
                // get back pending OAuth credentials validation from session
                $oauthCredentials = session()->get('warlof.slackbot.credentials');
        
        
        Severity: Minor
        Found in src/Http/Controllers/Services/OAuthController.php - About 1 hr to fix

          Method bindingSlackUser has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function bindingSlackUser(Collection $users)
              {
                  logger()->debug('bindingSlackUser', ['users' => $users]);
          
                  foreach ($users as $user) {
          Severity: Minor
          Found in src/Jobs/SyncUser.php - About 1 hr to fix

            Method getConnector has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function getConnector() : SlackApi
                {
                    if (!is_null($this->slack))
                        return $this->slack;
            
            
            Severity: Minor
            Found in src/Http/Controllers/Services/Traits/SlackApiConnector.php - About 1 hr to fix

              Method callback has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function callback(Request $request)
                  {
                      $this->validate($request, [
                          'token' => 'required|string',
                          'type' => 'required|in:url_verification,event_callback',
              Severity: Minor
              Found in src/Http/Controllers/Services/EventController.php - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language