Skip to content

Increase the usage of combined assignment operators #364

Open
@elfring

Description

👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of combined operators accordingly.

diff --git a/Apache/Ocsinventory/Interface/History.pm b/Apache/Ocsinventory/Interface/History.pm
index d4e85fe..2bcc683 100644
--- a/Apache/Ocsinventory/Interface/History.pm
+++ b/Apache/Ocsinventory/Interface/History.pm
@@ -39,7 +39,7 @@ sub get_history_events {
   my $offset = shift;
   my @tmp;
   
-  $offset = $offset * $ENV{OCS_OPT_WEB_SERVICE_RESULTS_LIMIT};
+  $offset *= $ENV{OCS_OPT_WEB_SERVICE_RESULTS_LIMIT};
   
   my $sth = get_sth( "SELECT DATE,DELETED,EQUIVALENT FROM deleted_equiv ORDER BY DATE,DELETED LIMIT $offset, $ENV{OCS_OPT_WEB_SERVICE_RESULTS_LIMIT}" );
     
diff --git a/Apache/Ocsinventory/Interface/Ipdiscover.pm b/Apache/Ocsinventory/Interface/Ipdiscover.pm
index df45d20..4ecd04a 100644
--- a/Apache/Ocsinventory/Interface/Ipdiscover.pm
+++ b/Apache/Ocsinventory/Interface/Ipdiscover.pm
@@ -44,7 +44,7 @@ our @EXPORT = qw /
 sub get_ipdiscover_devices{
   my ($date, $offset, $nInv ) = @_;
   
-  $offset = $offset*$ENV{OCS_OPT_WEB_SERVICE_RESULTS_LIMIT};  
+  $offset *= $ENV{OCS_OPT_WEB_SERVICE_RESULTS_LIMIT};  
   
   my $sth;
   
diff --git a/Apache/Ocsinventory/Interface/SoftwareCategory.pm b/Apache/Ocsinventory/Interface/SoftwareCategory.pm
index b2ebeca..587681e 100644
--- a/Apache/Ocsinventory/Interface/SoftwareCategory.pm
+++ b/Apache/Ocsinventory/Interface/SoftwareCategory.pm
@@ -102,7 +102,7 @@ sub regex{
     }
     if((substr( $regex, 0, 1 ) eq '*') && (substr( $regex, -1) ne '*')){
       $regex = $regex =~ s/\*//gr;
-      $regex = $regex."\$";
+      $regex .= "\$";
     }
     if((substr( $regex, -1) eq '*') && (substr( $regex, 0, 1) ne '*')){
       $regex = $regex =~ s/\*//gr;
diff --git a/Apache/Ocsinventory/Server/Groups.pm b/Apache/Ocsinventory/Server/Groups.pm
index 5187877..3657485 100644
--- a/Apache/Ocsinventory/Server/Groups.pm
+++ b/Apache/Ocsinventory/Server/Groups.pm
@@ -152,7 +152,7 @@ sub _build_group_cache{
 	}
 
         my $string = join ",", @quoted_ids;
-        $request = $request." AND $id_field IN ($string)";
+        $request .= " AND $id_field IN ($string)";
 	@ids=@quoted_ids=();
       }
 
diff --git a/binutils/ocsinventory-log.pl b/binutils/ocsinventory-log.pl
index e5ae080..c31572b 100755
--- a/binutils/ocsinventory-log.pl
+++ b/binutils/ocsinventory-log.pl
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -s
 
-$f = $f || '/var/log/ocsinventory-server/activity.log';
+$f ||= '/var/log/ocsinventory-server/activity.log';
 
 unless($a){
 	$a = 0;
diff --git a/binutils/soap-client.pl b/binutils/soap-client.pl
index d6e44a0..dde33e9 100755
--- a/binutils/soap-client.pl
+++ b/binutils/soap-client.pl
@@ -35,17 +35,17 @@ use XML::Entities;
 #'videos'        => 32768,
 #'softwares'     => 65536
 
-$s = $s||'localhost';
-$u = $u||'';
-$pw = $pw||'';
-$proto = $proto||'http';
+$s ||= 'localhost';
+$u ||= '';
+$pw ||= '';
+$proto ||= 'http';
 @params = split ',', $params;
-$f = $f||get_computers_V1;
+$f ||= get_computers_V1;
 
 # You can modify some XML tags
-$c = $c||131071;
-$t=$t||"META";
-$o=$o||0;
+$c ||= 131071;
+$t ||= "META";
+$o ||= 0;
 $w=defined $w?$w:131071;
 
 if( !defined(@params) && $f eq 'get_computers_V1' ){

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions