Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

operation_module_code_clean #3751

Merged
merged 29 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fe16764
operation_module_code_clean
SagarZeddlabz Dec 11, 2024
7b9b2ee
updated
sagar1862000 Dec 12, 2024
ca3f5fe
issues resolved
sagar1862000 Dec 12, 2024
7a2bb34
migration issue
sagar1862000 Dec 12, 2024
b98ade0
m
sagar1862000 Dec 12, 2024
d48a2de
M
sagar1862000 Dec 12, 2024
d5a0f5a
M
sagar1862000 Dec 12, 2024
a8405a9
indentation error solved
sagar1862000 Dec 12, 2024
99da9e1
indentation error solved
sagar1862000 Dec 12, 2024
1813038
imports related error solved
sagar1862000 Dec 12, 2024
933e3d0
imports related error solved
sagar1862000 Dec 12, 2024
fd1045d
imports related error solved
sagar1862000 Dec 12, 2024
e39eb25
homeController related error solved
sagar1862000 Dec 12, 2024
d983b40
office location cleanups in user modules
rathorevaibhav Dec 24, 2024
fd9e7d4
more cleanups
rathorevaibhav Dec 27, 2024
d8ad8aa
reverted unnecssary change
rathorevaibhav Dec 27, 2024
220849a
updated composer
rathorevaibhav Dec 27, 2024
107fa24
updated composer
rathorevaibhav Dec 27, 2024
6ee2d98
added packge in require-dev
rathorevaibhav Dec 27, 2024
e02b973
phpcsfixer addition
rathorevaibhav Jan 9, 2025
b3c16cf
ci updates
rathorevaibhav Jan 9, 2025
1280e6a
fully_qualified_strict_types set to false
rathorevaibhav Jan 9, 2025
ea771b4
ci fixes
rathorevaibhav Jan 9, 2025
2b31556
phpcs fixer
rathorevaibhav Jan 9, 2025
a22c28e
other ci fixes
rathorevaibhav Jan 9, 2025
44a06bb
psr12
rathorevaibhav Jan 9, 2025
eb47b95
all fixes
rathorevaibhav Jan 9, 2025
a5571d4
migration fixes
rathorevaibhav Jan 9, 2025
db46c19
coderabbit fix
rathorevaibhav Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup PHP v7.4
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"

- name: Install composer dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist

- name: Setup env file
run: cp ./.env.example .env

- name: Configure application encryption key
run: php artisan key:generate

- name: Install NPM Dependencies
run: npm install
- name: clear cache

- name: Clear cache
run: php artisan cache:clear

- name: ColoredCowLaravelCI
run: "php artisan check:ci --with-tty"
run: php artisan check:ci --with-tty
53 changes: 30 additions & 23 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use PhpCsFixer\Finder;

$rules = [
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
Expand All @@ -13,77 +14,82 @@
'blank_line_before_statement' => [
'statements' => ['return'],
],
'braces' => true,
'cast_spaces' => true,
'class_definition' => true,
'class_attributes_separation' => [
'elements' => [
'trait_import' => 'none',
],
],
'class_definition' => true,
'concat_space' => [
'spacing' => 'one',
],
'control_structure_braces' => true,
'control_structure_continuation_position' => true,
'declare_equal_normalize' => true,
'declare_parentheses' => true,
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'fully_qualified_strict_types' => true,
'fully_qualified_strict_types' => false,
'function_declaration' => true,
'function_typehint_space' => true,
'heredoc_to_nowdoc' => true,
'include' => true,
'increment_style' => ['style' => 'post'],
'indentation_type' => true,
'linebreak_after_opening_tag' => true,
'line_ending' => true,
'linebreak_after_opening_tag' => true,
'lowercase_cast' => true,
'lowercase_keywords' => true,
'lowercase_static_reference' => true,
'magic_method_casing' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'method_argument_space' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'native_function_casing' => true,
'no_alias_functions' => true,
'no_extra_blank_lines' => [
'tokens' => [
'extra',
'throw',
'use',
],
],
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_closing_tag' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => [
'tokens' => [
'curly_brace_block',
],
],
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => [
'use' => 'echo',
],
'no_multiline_whitespace_around_double_arrow' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'no_multiple_statements_per_line' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_spaces_inside_parenthesis' => true,
'no_trailing_comma_in_singleline' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unneeded_control_parentheses' => true,
'no_unreachable_default_argument_value' => true,
'no_unused_imports' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'phpdoc_align' => [
'tags' => ['param', 'return', 'throws', 'type'],
],
'phpdoc_indent' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => true,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_scalar' => true,
Expand All @@ -97,31 +103,32 @@
'short_scalar_cast' => true,
'simplified_null_return' => true,
'single_blank_line_at_eof' => true,
'single_blank_line_before_namespace' => true,
'single_class_element_per_statement' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_line_comment_style' => [
'comment_types' => ['hash'],
],
'single_quote' => true,
'single_space_around_construct' => true,
'space_after_semicolon' => true,
'spaces_inside_parentheses' => ['space' => 'none'],
'standardize_not_equals' => true,
'statement_indentation' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline' => true,
'trim_array_spaces' => true,
'type_declaration_spaces' => true,
'unary_operator_spaces' => true,
'trailing_comma_in_multiline' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'visibility_required' => [
'elements' => ['method', 'property'],
],
'whitespace_after_comma_in_array' => true,
'no_unused_imports' => true,
];


$finder = Finder::create()
->notPath('bootstrap')
->notPath('storage')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private function createCalendarEvent(ApplicationRound $applicationRound)
$applicationLink = URL::route($route, $applicationRound->application->id);
$description = "<a href='{$applicationLink}'>Application Link</a> for Job role: <a href='{$applicationRound->application->job->link}'>{$applicationRound->application->job->title}</a>";

$event = new CalendarEventService;
$event = new CalendarEventService();

$event->create([
'summary' => $summary,
Expand Down
7 changes: 5 additions & 2 deletions Modules/Client/Entities/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

class Client extends Model
{
use HasHierarchy, HasFactory, Filters;
use HasHierarchy;
use HasFactory;
use Filters;

protected $fillable = ['name', 'key_account_manager_id', 'status', 'is_channel_partner', 'has_departments', 'channel_partner_id', 'parent_organisation_id', 'client_id', 'is_billable'];

Expand Down Expand Up @@ -152,6 +154,7 @@ public function getBillableAmountForTerm(int $monthsToSubtract, $projects, $peri
public function getTaxAmountForTerm(int $monthsToSubtract, $projects, $periodStartDate = null, $periodEndDate = null)
{
$monthsToSubtract = $monthsToSubtract ?? 1;

// Todo: Implement tax calculation correctly as per the IGST rules
return round($this->getBillableAmountForTerm($monthsToSubtract, $projects, $periodStartDate, $periodEndDate) * ($this->country->initials == 'IN' ? config('invoice.tax-details.igst') : 0), 2);
}
Expand Down Expand Up @@ -409,7 +412,7 @@ public function getClientsAttribute()

protected static function booted()
{
static::addGlobalScope(new ClientGlobalScope);
static::addGlobalScope(new ClientGlobalScope());
}

protected static function newFactory()
Expand Down
4 changes: 2 additions & 2 deletions Modules/Client/Entities/Scopes/ClientGlobalScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class ClientGlobalScope implements Scope
/**
* Apply the scope to a given Eloquent query builder.
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @param \Illuminate\Database\Eloquent\Model $model
* @param \Illuminate\Database\Eloquent\Builder $builder
* @param \Illuminate\Database\Eloquent\Model $model
*
* @return \Illuminate\Database\Eloquent\Builder
*/
Expand Down
4 changes: 3 additions & 1 deletion Modules/Client/Http/Controllers/ModuleBaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@

class ModuleBaseController extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
}
4 changes: 2 additions & 2 deletions Modules/Client/Rules/ClientNameExist.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public function __construct()
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @param string $attribute
* @param mixed $value
*
* @return bool
*/
Expand Down
3 changes: 2 additions & 1 deletion Modules/CodeTrek/Emails/CodeTrekApplicantRoundMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

class CodeTrekApplicantRoundMail extends Mailable
{
use Queueable, SerializesModels;
use Queueable;
use SerializesModels;
public $applicationRound;
public $codetrekApplicant;

Expand Down
3 changes: 2 additions & 1 deletion Modules/CodeTrek/Emails/CodetrekMailApplicant.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

class CodetrekMailApplicant extends Mailable
{
use Queueable, SerializesModels;
use Queueable;
use SerializesModels;
public $applicant;

/**
Expand Down
9 changes: 2 additions & 7 deletions Modules/CodeTrek/Entities/CodeTrekApplicant.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\CodeTrek\Database\factories\CodeTrekApplicantFactory;
use Modules\Operations\Entities\OfficeLocation;
use Modules\User\Entities\User;

class CodeTrekApplicant extends Model
{
use SoftDeletes, HasFactory;
use SoftDeletes;
use HasFactory;
protected $guarded = [];

public function roundDetails()
Expand All @@ -25,11 +25,6 @@ public static function factory()
return new CodeTrekApplicantFactory();
}

public function center()
{
return $this->belongsTo(OfficeLocation::class, 'center_id');
}

public function getDaysInCodetrekAttribute()
{
$internshipStartDate = Carbon::parse($this->internship_start_date);
Expand Down
7 changes: 1 addition & 6 deletions Modules/CodeTrek/Http/Controllers/CodeTrekController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Modules\CodeTrek\Entities\CodeTrekApplicant;
use Modules\CodeTrek\Http\Requests\CodeTrekRequest;
use Modules\CodeTrek\Services\CodeTrekService;
use Modules\Operations\Entities\OfficeLocation;
use Modules\User\Entities\User;

class CodeTrekController extends Controller
Expand All @@ -28,7 +27,6 @@ public function index(Request $request)
{
// $this->authorize('view', $applicant); There are some issues in the production, which is why these lines are commented out.

$centres = OfficeLocation::all();
$mentors = User::all();
$applicantData = $this->service->getCodeTrekApplicants($request->all());
$applicants = $applicantData['applicants'];
Expand All @@ -41,7 +39,6 @@ public function index(Request $request)

return view('codetrek::index', [
'applicants' => $applicants,
'centres' => $centres,
'mentors' => $mentors,
'reportApplicationCounts' => $reportApplicationCounts,
'statusCounts' => $statusCounts,
Expand Down Expand Up @@ -78,12 +75,10 @@ public function edit(CodeTrekApplicant $applicant)
{
// $this->authorize('update', $applicant); There are some issues in the production, which is why these lines are commented out.

$centres = OfficeLocation::all();

$mentors = User::all();
$this->service->edit($applicant);

return view('codetrek::edit', ['applicant' => $applicant, 'centres' => $centres, 'mentors' => $mentors]);
return view('codetrek::edit', ['applicant' => $applicant, 'mentors' => $mentors]);
}
public function evaluate(CodeTrekApplicant $applicant)
{
Expand Down
10 changes: 5 additions & 5 deletions Modules/CodeTrek/Policies/CodetrekApplicantPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CodeTrekApplicantPolicy
/**
* Determine whether the user can view any models.
*
* @param \Modules\User\Entities\User $user
* @param \Modules\User\Entities\User $user
*
* @return mixed
*/
Expand All @@ -24,7 +24,7 @@ public function viewAny(User $user)
/**
* Determine whether the user can view the model.
*
* @param \Modules\User\Entities\User $user
* @param \Modules\User\Entities\User $user
*
* @return mixed
*/
Expand All @@ -36,7 +36,7 @@ public function view(User $user)
/**
* Determine whether the user can create models.
*
* @param \Modules\User\Entities\User $user
* @param \Modules\User\Entities\User $user
*
* @return mixed
*/
Expand All @@ -48,7 +48,7 @@ public function create(User $user)
/**
* Determine whether the user can update the model.
*
* @param \Modules\User\Entities\User $user
* @param \Modules\User\Entities\User $user
*
* @return mixed
*/
Expand All @@ -60,7 +60,7 @@ public function update(User $user)
/**
* Determine whether the user can delete the model.
*
* @param \Modules\User\Entities\User $user
* @param \Modules\User\Entities\User $user
*
* @return mixed
*/
Expand Down
Loading
Loading