Showing 599 of 599 total issues
Method __construct
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($profileId, $idpObject = NULL) {
parent::__construct($profileId, $idpObject);
$this->entityOptionTable = "profile_option";
$this->entityIdColumn = "profile_id";
Method genericAPIStatus
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function genericAPIStatus($type, $param1 = NULL, $param2 = NULL)
{
$endpoints = [
'tlr_test' => "https://monitor.eduroam.org/mapi/index.php?type=tlr_test&tlr=$param1",
'federation_via_tlr' => "https://monitor.eduroam.org/mapi/index.php?type=federation_via_tlr&federation=$param1",
Method collectCAPath
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function collectCAPath()
{
$capathtest = [];
$capathtest[] = '<p><strong>'._("Checking server handshake...")."</strong><p>";
$allfailed = TRUE;
Method __construct
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
parent::__construct();
\core\common\Entity::intoThePotatoes();
$this->userEmail = FALSE;
$this->additionalScreenshot = FALSE;
Method autodetectCAWithProbe
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function autodetectCAWithProbe($outerId) {
// for EAP-TLS to be a viable option, we need to pass a random client cert to make eapol_test happy
// the following PEM data is one of the SENSE EAPLab client certs (not secret at all)
$clientcert = file_get_contents(dirname(__FILE__) . "/clientcert.p12");
if ($clientcert === FALSE) {
File DeviceW8W10.php
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* *****************************************************************************
* Contributions to this work were made on behalf of the GÉANT project, a
Identical blocks of code found in 2 locations. Consider refactoring. Open
private function glueServerNames() {
$serverList = $this->attributes['eap:server_name'];
if (!$serverList) {
return '';
}
- 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 139.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
private function glueServerNames() {
$serverList = $this->attributes['eap:server_name'];
if (!$serverList) {
return '';
}
- 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 139.
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
File IdPlist.php
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* *****************************************************************************
* Contributions to this work were made on behalf of the GÉANT project, a
Method selectElement
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function selectElement($rowid, $list)
{
$jsmagic = "onchange='
if (/#ML#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
document.getElementById(\"S$rowid-input-langselect\").style.display = \"block\";
Method prefillText
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function prefillText(int $rowid, string $optionName, string $optionValue, $optionLang)
{
\core\common\Entity::intoThePotatoes();
$retval = "";
$optioninfo = \core\Options::instance();
Method issueCertificate
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function issueCertificate($token, $importPassword, $certtype)
{
$loggerInstance = new common\Logging();
$databaseHandle = DBConnection::handle("INST");
$loggerInstance->debug(5, "generateCertificate() - starting.\n");
Function testDatabases
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function testDatabases()
{
$databaseName1 = 'INST';
try {
$db1 = DBConnection::handle($databaseName1);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function testDeviceCache
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function testDeviceCache()
{
if ((!empty(\devices\Devices::$Options['no_cache'])) && \devices\Devices::$Options['no_cache']) {
$global_no_cache = 1;
} else {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __construct
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($token)
{
parent::__construct();
$this->globalInfo = [
\core\common\Entity::L_OK => _("All tests passed."),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function checkLineparse
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function checkLineparse($inputarray, $desiredCheck) {
foreach ($inputarray as $lineid => $line) {
switch ($desiredCheck) {
case self::LINEPARSE_CHECK_REJECTIGNORE:
if (preg_match("/Attribute 18 (Reply-Message)/", $line) && preg_match("/Reject instead of Ignore at eduroam.org/", $inputarray[$lineid + 1])) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function consolidateUdpResult
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function consolidateUdpResult($host) {
\core\common\Entity::intoThePotatoes();
$ret = [];
$serverCert = [];
$udpResult = $this->UDP_reachability_result[$host];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __select_p12_file
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def __select_p12_file(self) -> str:
"""
prompt user for the PFX file selection
this method is not being called in the silent mode
therefore there is no code for this case
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method findLoginIdPByEmail
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function findLoginIdPByEmail($mail, $lang)
{
$loggerInstance = new common\Logging();
$listOfProviders = [];
$matchedProviders = [];
Method __construct
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($idpObject, $deploymentIdRaw, $consortium = 'eduroam')
{
parent::__construct($idpObject, $deploymentIdRaw); // we now have access to our INST database handle and logging
$this->entityOptionTable = "deployment_option";
$this->entityIdColumn = "deployment_id";