Showing 32 of 559 total issues
File lara.js
has 607 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Bugsnag from '@bugsnag/js'
import Bloodhound from 'corejs-typeahead'
import loadjQueryPlugin from 'corejs-typeahead'
import Pusher from 'pusher-js'
import Echo from 'laravel-echo'
User
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class User extends BaseModel implements AuthenticatableContract, CanResetPasswordContract, AuthorizableContract
{
use Authenticatable, Authorizable, CanResetPassword, HasApiTokens, HasAvatar, Notifiable;
protected string $avatarPath = 'avatars/';
Method getBuilder
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getBuilder(string $model): Builder
{
$builder = (new $model())->newQuery();
$groups = [
Method boot
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function boot(): void
{
Validator::extend('unique_email', function ($attribute, $value, $parameters) {
if (isset($parameters[1])) {
$attribute = $parameters[1];
Method handle
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(): void
{
DB::connection()->disableQueryLog();
$conn = DB::connection();
Method boot
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function boot(Dispatcher $events): void
{
$this->app->booted(function () {
if (Request::getUser() && Request::getPassword()) {
return Auth::onceBasic('name');
Function VotesModule
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function VotesModule () {
if (window.username) {
$('body').on('click', 'button.vote-btn-up', this.addUpvote)
.on('click', 'button.vote-btn-down', this.addDownvote)
Function handle
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function handle(): void
{
DB::connection()->disableQueryLog();
$conn = DB::connection();
- Read upRead up
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
Method store
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function store(Request $request): JsonResponse
{
$rules = [
'title' => 'required|min:1|max:128|not_in:edit,thumbnail',
'description' => 'max:255',
Method register
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(EnvironmentBuilderInterface $environment): void
{
$environment
->addBlockStartParser(new Parser\Block\BlockQuoteStartParser(), 70)
->addBlockStartParser(new Parser\Block\HeadingStartParser(), 60)
Function addUpvote
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
VotesModule.prototype.addUpvote = function () {
var content = $(this).parent()
var cid = $(content).attr('data-id')
var state = $(content).attr('state')
var type = $(content).attr('data-type')
Function addDownvote
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
VotesModule.prototype.addDownvote = function () {
var content = $(this).parent()
var cid = $(content).attr('data-id')
var state = $(content).attr('state')
var type = $(content).attr('data-type')
Method parse_usernames
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parse_usernames($body)
{
$body = preg_replace_callback('/(?<=^|\s)c\/([a-z0-9_-]+)(?=$|\s|:|.)/i', function ($matches) {
$contentId = Hashids::decode($matches[1]);
Method getUrlAttribute
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getUrlAttribute(): ?string
{
$url = null;
$params = null;
Function charCount
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.charCount = function (options) {
// default configuration properties
var defaults = {
allowed: 140,
Method index
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(Request $request)
{
if ($request->has('folder')) {
$username = request('user', auth()->id());
$entity = $this->folders->getByName($username, request('folder'));
Function editEntry
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
EntriesModule.prototype.editEntry = function (e) {
var entry = $(this).parent().parent()
var entry_id = $(entry).attr('data-id')
var entry_old_text = $(entry).find('.entry_text').html()
var type = (entry.hasClass('entry_reply') === true ? 'entry_reply' : 'entry')
Function NotificationsModule
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function NotificationsModule () {
var nm = this
this.unreadNotifications = parseInt($('.notifications').attr('data-new-notifications'), 10)
this.pageTitle = document.title
Function handle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function handle(): void
{
$x = 1;
foreach (Group::all() as $group) {
- Read upRead up
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 getUrlAttribute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getUrlAttribute(): ?string
{
$url = null;
$params = null;
- Read upRead up
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"