Showing 599 of 599 total issues
Function listAllIdentityProviders
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function listAllIdentityProviders($activeOnly = 0, $country = "")
{
common\Entity::intoThePotatoes();
$handle = DBConnection::handle("INST");
$handle->exec("SET SESSION group_concat_max_len=10000");
- 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 weNeedToTalk
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function weNeedToTalk() {
$this->determineMailsToSend();
foreach ($this->mailQueue as $oneMail) {
$theMail = $this->mailStack[$oneMail];
// if user interaction would have been good, but the user didn't
- 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 autodetectCAWithProbe
has a Cognitive Complexity of 18 (exceeds 5 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) {
- 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 __construct
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($token)
{
parent::__construct();
$this->globalInfo = [
\core\common\Entity::L_OK => _("All tests passed."),
Method previewCAinHTML
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function previewCAinHTML($cAReference) {
\core\common\Entity::intoThePotatoes();
$validator = new \web\lib\common\InputValidation();
$ref = $validator->databaseReference($cAReference);
$caExpiryTrashhold = \config\ConfAssistant::CERT_WARNINGS['expiry_warning'];
Method __construct
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($invitationId)
{
parent::__construct();
$this->invitationTokenString = $invitationId;
$handle = DBConnection::handle("INST");
Method exec
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exec($querystring, $types = NULL, &...$arguments)
{
// log exact query to audit log, if it's not a SELECT
$isMoreThanSelect = FALSE;
if (preg_match("/^(SELECT\ |SET\ )/i", $querystring) == 0 && preg_match("/^DESC/i", $querystring) == 0) {
Method writeConfigVars
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function writeConfigVars($file) {
$eapMethod = \core\common\EAP::eapDisplayName($this->selectedEap);
$contacts = $this->mkSupportContacts();
$tou = $this->mkUserConsent();
$outerId = $this->determineOuterIdString();
Method testGeoip
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function testGeoip()
{
$host_4 = '145.0.2.50';
$host_6 = '2001:610:188:444::50';
switch (\config\Master::GEOIP['version']) {
DeviceXML
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class DeviceXML extends \core\DeviceConfig
{
/**
* @var array $AuthMethodElements is used to limit
UIElements
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class UIElements extends \core\common\Entity {
/**
* the custom displayable variant of the term 'federation'
*
UserAPI
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class UserAPI extends CAT
{
/**
* nothing special to be done here.
Method productheader
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function productheader($area) {
\core\common\Entity::intoThePotatoes();
$language = $this->languageInstance->getLang();
// this <div is closing in footer, keep it in PHP for Netbeans syntax
// highlighting to work
File RFC6614Tests.php
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* *****************************************************************************
* Contributions to this work were made on behalf of the GÉANT project, a
Similar blocks of code found in 2 locations. Consider refactoring. Open
Logopath::IDP_SUSPECTED_PROBLEM_INTERACTIVE_EVIDENCED => [
"to" => [Logopath::TARGET_IDP],
"cc" => [],
"bcc" => [],
"reply-to" => [Logopath::TARGET_ENDUSER],
- 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 127.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
Logopath::IDP_SUSPECTED_PROBLEM_INTERACTIVE_FORCED => [
"to" => [Logopath::TARGET_IDP],
"cc" => [],
"bcc" => [],
"reply-to" => [Logopath::TARGET_ENDUSER],
- 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 127.
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 accountstatus.php
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* Contributions to this work were made on behalf of the GÉANT project, a
* project that has received funding from the European Union’s Horizon 2020
* research and innovation programme under Grant Agreement No. 731122 (GN4-2).
Function writeInstaller
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function writeInstaller()
{
$dom = textdomain(NULL);
textdomain("devices");
// create certificate files and save their names in $caFiles array
- 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 listIdentityProvidersWithProfiles
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function listIdentityProvidersWithProfiles() {
$handle = DBConnection::handle("INST");
$handle->exec("SET SESSION group_concat_max_len=10000");
$idpQuery = IdPlist::setAllIdentyProvidersQuery(1);
$allIDPs = $handle->exec($idpQuery);
- 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 packetCountEvaluation
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function packetCountEvaluation(&$testresults, $packetcount) {
$reqs = $packetcount[1] ?? 0;
$accepts = $packetcount[2] ?? 0;
$rejects = $packetcount[3] ?? 0;
$challenges = $packetcount[11] ?? 0;
- 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"