Showing 186 of 479 total issues
Method ajax
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function ajax()
{
return datatables()
->eloquent($this->applyScopes($this->query()))
->editColumn('ship.typeName', function ($row) {
Method validate_menu
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function validate_menu(string $package_name, array $menu_data)
{
if (! is_string($package_name))
throw new PackageMenuBuilderException(
Method getUsers
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getUsers(Request $request)
{
$users = User::with('characters')
->standard()
->where('name', 'like', ["%{$request->query('q', '')}%"]);
Method getCharacterMailTimeline
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getCharacterMailTimeline(int $message_id = null)
{
// Get the User for permissions and affiliation
// checks
$user = auth()->user();
Method apply
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function apply($query)
{
return $query->whereHas('recipients', function ($sub_query) {
if ($this->requested_characters != null) {
Method getTopTransactionsData
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getTopTransactionsData(CharacterInfo $character)
{
if (! request()->has('characters'))
return abort(500);
Function index
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
public function index(Request $request)
{
$squads = Squad::with('members', 'moderators', 'applications');
if ($request->has('filters')) {
- 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 getCharacterJournalStandingsWithProfile
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getCharacterJournalStandingsWithProfile(int $character_id, int $profile_id)
{
return CharacterAffiliation::with('character', 'corporation', 'alliance', 'faction')
->select(
Method apply
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function apply($query)
{
// extract querying table (from)
$table = $query->getQuery()->from;
Method getTopMailContent
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getTopMailContent(CharacterInfo $character, int $from)
{
$character_ids = collect($character->character_id);
Method isEligible
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
final public function isEligible(Model $member): bool
{
// in case no filters exists, bypass check
if (! property_exists($this->getFilters(), 'and') && ! property_exists($this->getFilters(), 'or'))
return true;
Method ajax
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function ajax()
{
return datatables()
->eloquent($this->applyScopes($this->query()))
->editColumn('category', function ($row) {
Method getSearchCharacterAssetsData
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getSearchCharacterAssetsData(Request $request)
{
$scope = new CharacterScope('character.asset');
$query = CharacterAsset::with('character', 'type', 'type.group', 'station', 'container', 'container.station',
Function draw
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
public function draw(Model $row)
{
// in case the location is in station range -> use station relation.
if ($row->location_id < 64000000)
return $row->station->name;
- 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 postChangeCharacter
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function postChangeCharacter(Request $request)
{
$request->validate([
'character_id' => 'integer|exists:character_infos,character_id|required',
]);
Method draw
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function draw(Model $row)
{
if ($row->location_type == 'station')
return $row->station->name;
Method characterTopWalletJournalInteractions
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function characterTopWalletJournalInteractions(Collection $character_ids): Builder
{
return CharacterWalletJournal::select('first_party_id', 'second_party_id', 'ref_type', 'category', 'entity_id as party_id', 'name as party_name', DB::raw('count(*) as total'),
DB::raw("
Method ajax
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function ajax()
{
$station_column = $this->getStationColumn($this);
$location_column = $this->getLocationFlagColumn($this);
Method data
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function data()
{
return datatables()
->eloquent($this->applyScopes($this->query()))
->editColumn('date', function ($row) {
Method postAddStandingsFromCorpOrChar
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function postAddStandingsFromCorpOrChar(StandingsExistingElementAdd $request)
{
// Get the standings profile that will be updated.
$standings_profile = StandingsProfile::find($request->input('id'));