Command/GenerateCertCommand.php
Method execute
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('<info>Generate private / public keys for JIRA</info>');
$countryQuestion = new Question('Enter the country name (eg. US): ');
The method execute() has 106 lines of code. Current threshold is set to 100. Avoid really long methods. Open
Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('<info>Generate private / public keys for JIRA</info>');
$countryQuestion = new Question('Enter the country name (eg. US): ');
- Exclude checks
Remove error control operator '@' on line 112. Open
Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('<info>Generate private / public keys for JIRA</info>');
$countryQuestion = new Question('Enter the country name (eg. US): ');
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Avoid excessively long variable names like $organizationalUnitQuestion. Keep variable name length under 20. Open
Open
$organizationalUnitQuestion = new Question('Enter the organization unit name: ');
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid variables with short names like $dn. Configured minimum length is 3. Open
Open
$dn = [
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}