Skip to content

Commit

Permalink
Merge pull request #776 from RotherOSS/issue-#760-perlcritic
Browse files Browse the repository at this point in the history
Issue #760 perlcritic
  • Loading branch information
bschmalhofer authored Feb 6, 2021
2 parents 2d4350a + 20fc382 commit 04738b3
Show file tree
Hide file tree
Showing 45 changed files with 168 additions and 223 deletions.
7 changes: 5 additions & 2 deletions Kernel/Autoload/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# --

use Kernel::System::Valid;
use Kernel::System::Valid; ## no critic (Modules::RequireExplicitPackage)

package Kernel::System::Valid; ## no critic (Modules::RequireFilenameMatchesPackage)

package Kernel::System::Valid; ## no critic
use strict;
use warnings;
use v5.24;
use utf8;

#
# This file demonstrates how to use the autoload mechanism of OTOBO to change existing functionality,
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Autoload/Znuny4OTOBOPasswordPolicy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# --

use Kernel::Output::HTML::Layout;
use Kernel::Output::HTML::Layout; ## no critic (Modules::RequireExplicitPackage)

package Kernel::Output::HTML::Layout; ## no critic
package Kernel::Output::HTML::Layout; ## no critic (Modules::RequireFilenameMatchesPackage)

use strict;
use warnings;
Expand Down
3 changes: 1 addition & 2 deletions Kernel/Config/Defaults.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1921,8 +1921,7 @@ via the Preferences button after logging in.

# Please see the documentation in Kernel/Config.pod.dist.
sub new {
my $Type = shift;
my %Param = @_;
my ($Type, %Param) = @_;

# allocate new hash for object
my $Self = bless {}, $Type;
Expand Down
3 changes: 1 addition & 2 deletions Kernel/Language.pm
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ Valid placeholders are '%s' and '%d'.
=cut

sub Translate {
my $Self = shift;
my( $Text, @Replacements ) = @_;
my ( $Self, $Text, @Replacements ) = @_;

$Text //= '';
$Text = $Self->{Translation}->{$Text} || $Text;
Expand Down
12 changes: 4 additions & 8 deletions Kernel/Output/HTML/Layout.pm
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,7 @@ sub Redirect {
}

sub Login {
my $Self = shift;
my %Param = @_;
my ($Self, %Param) = @_;

# set Action parameter for the loader
$Self->{Action} = 'Login';
Expand Down Expand Up @@ -1244,8 +1243,7 @@ generates the HTML for the page begin in the Agent interface.
=cut

sub Header {
my $Self = shift;
my %Param = @_;
my ($Self, %Param) = @_;

# extract params
my $Type = $Param{Type} || '';
Expand Down Expand Up @@ -3896,8 +3894,7 @@ sub HumanReadableDataSize {
}

sub CustomerLogin {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

my $Output = '';
$Param{TitleArea} = $Self->{LanguageObject}->Translate('Login') . ' - ';
Expand Down Expand Up @@ -4130,8 +4127,7 @@ sub CustomerLogin {
}

sub CustomerHeader {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

my $Type = $Param{Type} || '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ sub Configure {
}

sub Run {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

$Self->Print("<yellow>Rebuilding ticket escalation index...</yellow>\n");

Expand Down
3 changes: 1 addition & 2 deletions Kernel/System/DB/mysql.pm
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ our @ObjectDependencies = (
);

sub new {
my $Class = shift;
my %Param = @_;
my ( $Class, %Param ) = @_;

# allocate new hash for object
return bless { %Param }, $Class;
Expand Down
3 changes: 1 addition & 2 deletions Kernel/System/Main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ require/load a module
=cut

sub Require {
my $Self = shift;
my ( $Module, %Param ) = @_;
my ( $Self, $Module, %Param ) = @_;

# check required params
if ( !$Module ) {
Expand Down
11 changes: 5 additions & 6 deletions Kernel/System/MigrateFromOTRS/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ sub CleanLicenseHeader {
my $NewContent;

# Open file
open( my $FileHandle, '<:encoding(utf-8)', $FilePathAndName );
## no critic qw(InputOutput::RequireBriefOpen)
open my $FileHandle, '<:encoding(utf-8)', $FilePathAndName;

if ( !$FileHandle ) {

Expand Down Expand Up @@ -256,8 +257,7 @@ replace the XML element I<otrs_config> to I<otobo_config>.
=cut

sub MigrateXMLConfig {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

my $File = $Param{File};

Expand Down Expand Up @@ -339,7 +339,7 @@ sub CleanOTRSFileToOTOBOStyle {
my @ParserRegExLicence = _ChangeLicenseHeaderRules();

my $NewContent;
open( my $FileHandle, '<:encoding(utf-8)', $FilePathAndName );
open( my $FileHandle, '<:encoding(utf-8)', $FilePathAndName ); ## no critic (InputOutput::RequireBriefOpen)

if ( !$FileHandle ) {

Expand Down Expand Up @@ -1087,8 +1087,7 @@ settings by default.

# Note: looks like this method is currently unused
sub SettingUpdate {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

if ( !$Param{Name} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Expand Down
12 changes: 4 additions & 8 deletions Kernel/System/MigrateFromOTRS/CloneDB/Backend.pm
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ create a CloneDB backend object
=cut

sub new {
my $Class = shift;
my %Param = @_;
my ( $Class, %Param ) = @_;

# allocate new hash for object
my $Self = bless {}, $Class;
Expand Down Expand Up @@ -127,8 +126,7 @@ creates the target db object.
=cut

sub CreateOTRSDBConnection {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
if ( !$Param{OTRSDBSettings} ) {
Expand Down Expand Up @@ -185,8 +183,7 @@ transfers information from a OTRS DB to the OTOBO DB.
=cut

sub DataTransfer {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

my $LogObject = $Kernel::OM->Get('Kernel::System::Log');

Expand Down Expand Up @@ -265,8 +262,7 @@ The returned value is a hash ref with the fields I<Message>, I<Comment>, and I<S
=cut

sub SanityChecks {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

my $LanguageObject = $Kernel::OM->Get('Kernel::Language');

Expand Down
11 changes: 5 additions & 6 deletions Kernel/System/MigrateFromOTRS/CloneDB/Driver/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ The returned value is a hash ref with the fields I<Message>, I<Comment>, and I<S
=cut

sub SanityChecks {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

my $LanguageObject = $Kernel::OM->Get('Kernel::Language');

Expand Down Expand Up @@ -263,8 +262,7 @@ Get the number of rows in a table.
=cut

sub RowCount {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

my $MigrationBaseObject = $Kernel::OM->Get('Kernel::System::MigrateFromOTRS::Base');

Expand Down Expand Up @@ -305,8 +303,7 @@ Transfer the actual table data
=cut

sub DataTransfer {
my $Self = shift; # the source db backend
my %Param = @_;
my ( $Self, %Param ) = @_; # $Self is the source db backend

# check needed parameters
for my $Needed (qw(OTRSDBObject OTOBODBObject OTOBODBBackend DBInfo)) {
Expand Down Expand Up @@ -345,6 +342,8 @@ sub DataTransfer {
# Open for writing as the file usually does not exist yet.
# This approach assumes that the the webserver processes are running on a single machine.
my $LockFile = join '/', $ConfigObject->Get('Home'), 'var/tmp/migrate_from_otrs.lock';
# TODO: why still warnings from Perl::Critic ??
## no critic qw(OTOBO::ProhibitLowPrecendeceOps OTOBO::ProhibitOpen InputOutput::RequireBriefOpen)
open my $LockFh, '>', $LockFile or do {
$MigrationBaseObject->MigrationLog(
String => "Could not open lockfile $LockFile; $!",
Expand Down
18 changes: 6 additions & 12 deletions Kernel/System/MigrateFromOTRS/CloneDB/Driver/mysql.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ Please look there for a detailed reference of the functions.

# create external db connection.
sub CreateOTRSDBConnection {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check OTRSDBSettings
for my $Needed (
Expand Down Expand Up @@ -97,8 +96,7 @@ sub CreateOTRSDBConnection {

# List all columns of a table in the order of their position.
sub ColumnsList {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBObject DBName Table)) {
Expand Down Expand Up @@ -133,8 +131,7 @@ sub ColumnsList {

# Get all binary columns and return a lookup hash with table and column name as keys.
sub BlobColumnsList {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBObject DBName Table)) {
Expand Down Expand Up @@ -170,8 +167,7 @@ END_SQL
# Get column infos
# return DATA_TYPE
sub GetColumnInfos {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBObject DBName Table Column)) {
Expand Down Expand Up @@ -210,8 +206,7 @@ sub GetColumnInfos {
# Translate column infos
# return DATA_TYPE
sub TranslateColumnInfos {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBType ColumnInfos)) {
Expand Down Expand Up @@ -263,8 +258,7 @@ sub TranslateColumnInfos {

# Alter table add column
sub AlterTableAddColumn {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBObject Table Column ColumnInfos)) {
Expand Down
6 changes: 2 additions & 4 deletions Kernel/System/MigrateFromOTRS/CloneDB/Driver/oracle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ sub CreateOTRSDBConnection {

# List all columns of a table in the order of their position.
sub ColumnsList {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBObject Table)) {
Expand Down Expand Up @@ -231,8 +230,7 @@ sub ResetAutoIncrementField {

# Get all binary columns and return a lookup hash with table and column name as keys.
sub BlobColumnsList {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBObject DBName Table)) {
Expand Down
15 changes: 5 additions & 10 deletions Kernel/System/MigrateFromOTRS/CloneDB/Driver/postgresql.pm
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ sub CreateOTRSDBConnection {

# List all columns of a table in the order of their position.
sub ColumnsList {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBObject Table)) {
Expand Down Expand Up @@ -198,8 +197,7 @@ sub ResetAutoIncrementField {

# Get all binary columns and return a lookup hash with table and column name as keys.
sub BlobColumnsList {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBObject DBName Table)) {
Expand Down Expand Up @@ -235,8 +233,7 @@ END_SQL
# Get column infos
# return DATA_TYPE
sub GetColumnInfos {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBObject DBName Table Column)) {
Expand Down Expand Up @@ -274,8 +271,7 @@ sub GetColumnInfos {
# Translate column infos
# return DATA_TYPE
sub TranslateColumnInfos {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBType ColumnInfos)) {
Expand Down Expand Up @@ -330,8 +326,7 @@ sub TranslateColumnInfos {

# Alter table add column
sub AlterTableAddColumn {
my $Self = shift;
my %Param = @_;
my ( $Self, %Param ) = @_;

# check needed stuff
for my $Needed (qw(DBObject Table Column ColumnInfos)) {
Expand Down
Loading

0 comments on commit 04738b3

Please sign in to comment.