visavi/rotor

View on GitHub

Showing 512 of 512 total issues

Avoid too many return statements within this method.
Open

        return round($num / 1000, 1) . 'K';
Severity: Major
Found in app/helpers.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return redirect('users?page=' . $end . '&user=' . $user . '&type=' . $type . '&sort=' . $sort);
    Severity: Major
    Found in app/Http/Controllers/User/ListController.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return view('users/login', compact('cookieLogin', 'isFlood'));
      Severity: Major
      Found in app/Http/Controllers/User/UserController.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return $num;
        Severity: Major
        Found in app/helpers.php - About 30 mins to fix

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

                  {title: 'Heading 3', name: '<i class="fa fa-heading">3</i>', className: 'bb-heading3', key: '3', openWith: '<h3(!( class="[![Class]!]")!)>', closeWith: '</h3>', placeHolder: translate.editor.enter_title},
          Severity: Minor
          Found in public/assets/js/markitup-set.js and 2 other locations - About 30 mins to fix
          public/assets/js/markitup-set.js on lines 104..104
          public/assets/js/markitup-set.js on lines 105..105

          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 45.

          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 3 locations. Consider refactoring.
          Open

          <?php
          
          return [
              'delete_confirm'      => 'Do you really want to delete messages?',
              'system'              => 'System',
          Severity: Minor
          Found in resources/lang/en/messages.php and 2 other locations - About 30 mins to fix
          resources/lang/ru/messages.php on lines 1..21
          resources/lang/ua/messages.php on lines 1..21

          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 90.

          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 3 locations. Consider refactoring.
          Open

          <?php
          
          return [
              'delete_confirm'      => 'Ви дійсно хочете видалити повідомлення?',
              'system'              => 'Система',
          Severity: Minor
          Found in resources/lang/ua/messages.php and 2 other locations - About 30 mins to fix
          resources/lang/en/messages.php on lines 1..21
          resources/lang/ru/messages.php on lines 1..21

          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 90.

          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 3 locations. Consider refactoring.
          Open

                  {title: 'Heading 1', name: '<i class="fa fa-heading">1</i>', className: 'bb-heading1', key: '1', openWith: '<h1(!( class="[![Class]!]")!)>', closeWith: '</h1>', placeHolder: translate.editor.enter_title},
          Severity: Minor
          Found in public/assets/js/markitup-set.js and 2 other locations - About 30 mins to fix
          public/assets/js/markitup-set.js on lines 105..105
          public/assets/js/markitup-set.js on lines 106..106

          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 45.

          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 3 locations. Consider refactoring.
          Open

                  {title: 'Heading 2', name: '<i class="fa fa-heading">2</i>', className: 'bb-heading2', key: '2', openWith: '<h2(!( class="[![Class]!]")!)>', closeWith: '</h2>', placeHolder: translate.editor.enter_title},
          Severity: Minor
          Found in public/assets/js/markitup-set.js and 2 other locations - About 30 mins to fix
          public/assets/js/markitup-set.js on lines 104..104
          public/assets/js/markitup-set.js on lines 106..106

          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 45.

          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 3 locations. Consider refactoring.
          Open

          <?php
          
          return [
              'delete_confirm'      => 'Вы действительно хотите удалить сообщения?',
              'system'              => 'Система',
          Severity: Minor
          Found in resources/lang/ru/messages.php and 2 other locations - About 30 mins to fix
          resources/lang/en/messages.php on lines 1..21
          resources/lang/ua/messages.php on lines 1..21

          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 90.

          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

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

              public function edit(int $id, Request $request, Validator $validator): View|RedirectResponse
              {
                  $places = PaidAdvert::PLACES;
          
                  /** @var PaidAdvert $advert */
          Severity: Minor
          Found in app/Http/Controllers/Admin/PaidAdvertController.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public function change(Request $request, Validator $validator)
              {
                  $user = User::query()->where('login', $request->input('user'))->with('lastBan')->first();
          
                  if (! $user) {
          Severity: Minor
          Found in app/Http/Controllers/Admin/BanController.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public function edit(int $id, Request $request, Validator $validator)
              {
                  $page = int($request->input('page', 1));
          
                  if (! $user = getUser()) {
          Severity: Minor
          Found in app/Http/Controllers/Admin/ChatController.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public function deleteDown(int $id, Request $request): RedirectResponse
              {
                  /** @var Down $down */
                  $down = Down::query()->find($id);
          
          
          Severity: Minor
          Found in app/Http/Controllers/Admin/LoadController.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public function recovery(Request $request, Validator $validator)
              {
                  if (getUser()) {
                      setFlash('danger', __('main.already_authorized'));
          
          
          Severity: Minor
          Found in app/Http/Controllers/MailController.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public function create(Request $request, Validator $validator)
              {
                  if ($request->isMethod('post')) {
                      $keys = int($request->input('keys'));
          
          
          Severity: Minor
          Found in app/Http/Controllers/Admin/InvitationController.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public function close(int $id, Request $request): RedirectResponse
              {
                  $vote = Vote::query()->where('id', $id)->first();
          
                  if (! $vote) {
          Severity: Minor
          Found in app/Http/Controllers/Admin/VoteController.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public function handle(Request $request, Closure $next)
              {
                  if ($this->isBanned($request)) {
                      return redirect('ipban');
                  }
          Severity: Minor
          Found in app/Http/Middleware/CheckAccessSite.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public function publish(int $id, Request $request): RedirectResponse
              {
                  /** @var Down $down */
                  $down = Down::query()->find($id);
          
          
          Severity: Minor
          Found in app/Http/Controllers/Admin/LoadController.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              public function edit(int $id, Request $request, Validator $validator)
              {
                  if (! $user = getUser()) {
                      abort(403);
                  }
          Severity: Minor
          Found in app/Http/Controllers/GuestbookController.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Severity
          Category
          Status
          Source
          Language