Showing 114 of 114 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
else {
$(input).prop('checked', false);
$(input).closest('li')
.removeClass(this.options.selectedClass);
- Read upRead up
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 62.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method execute
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$batch = new Batch($this->getName());
$this->batchManager->save($batch);
Method getStatusLabel
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getStatusLabel($status)
{
switch ($status) {
case Status::WITHDRAW_FAILED:
return $this->translator->trans('withdraw.request.failed');
Method prepareAjaxRequest
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepareAjaxRequest($queryBuilder, $search, $custom)
{
if (!empty($search)) {
$queryBuilder->where(
Method getDefaultSettingsParams
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getDefaultSettingsParams()
{
$reRunForm = $this->generateReRunForm();
$settingsForm = $this->generateSettingsForm();
Function buildSelectAll
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildSelectAll: function() {
if (typeof this.options.selectAllValue === 'number') {
this.options.selectAllValue = this.options.selectAllValue.toString();
}
Method reRunAction
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function reRunAction(Request $request)
{
$reRunForm = $this->generateReRunForm();
$settingsForm = $this->generateSettingsForm();
Function select
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
select: function(selectValues, triggerOnChange) {
if(!$.isArray(selectValues)) {
selectValues = [selectValues];
}
Method processVendors
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processVendors()
{
$vendors = $this->vendorManager->findAll();
$logs = array();
Function buttonText
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
buttonText: function(options, select) {
if (this.disabledText.length > 0
&& (select.prop('disabled') || (options.length == 0 && this.disableIfEmpty))) {
return this.disabledText;
Method prepareAjaxData
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepareAjaxData($data)
{
foreach ($data as $key => $logRow) {
$data[$key]['startedAt'] = $logRow['startedAt']->format('Y-m-d H:i:s');
Method getCycleDate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCycleDate(array $cycleDays, DateTime $cronDate)
{
$currentDay = (int) date('j', $cronDate->getTimestamp());
$currentMonth = (int) date('n', $cronDate->getTimestamp());
$currentYear = (int) date('Y', $cronDate->getTimestamp());
Method create
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
$miraklId,
$hipayId,
$login,
$statusWalletAccount,
$status,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
LoggerInterface $logger,
CashoutInitializer $processor,
array $cycleDays,
$cycleHour,
$cycleMinute,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
$miraklId = null,
$hipayId = null,
$login = null,
$statusWalletAccount = null,
$status = null,
Function selectAll
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
selectAll: function (justVisible, triggerOnSelectAll) {
var justVisible = typeof justVisible === 'undefined' ? true : justVisible;
var allLis = $("li:not(.divider):not(.disabled):not(.multiselect-group)", this.$ul);
var visibleLis = $("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)", this.$ul).filter(':visible');
Function deselectAll
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
deselectAll: function (justVisible, triggerOnDeselectAll) {
var justVisible = typeof justVisible === 'undefined' ? true : justVisible;
var allLis = $("li:not(.divider):not(.disabled):not(.multiselect-group)", this.$ul);
var visibleLis = $("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)", this.$ul).filter(':visible');
Function deselect
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
deselect: function(deselectValues, triggerOnChange) {
if(!$.isArray(deselectValues)) {
deselectValues = [deselectValues];
}
Method register
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Application $app)
{
$app['vendors.repository'] = $app->share(function ($app) {
return $app['orm.em']->getRepository('HiPay\\Wallet\\Mirakl\\Integration\\Entity\\Vendor');
});
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($elem.is(':selected')) {
$input.prop('checked', true);
if (this.options.selectedClass) {
$input.closest('li')
- Read upRead up
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 57.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76