Showing 599 of 599 total issues
Function significantChanges
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function significantChanges($old, $new)
{
$retval = [];
// check if a CA was added
$x509 = new common\X509();
- 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 signRequest
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function signRequest($csr, $expiryDays): array
{
if ($csr["CSR_STRING"] === NULL) {
throw new Exception("This CA needs the CSR in a string (PEM)!");
}
- 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 __get_username_password
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def __get_username_password(self) -> None:
"""
read user password and set the password property
do nothing if silent mode is set
"""
- 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 listAllIdentityProviders
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function listAllIdentityProviders($activeOnly = 0, $country = "")
{
common\Entity::intoThePotatoes();
$handle = DBConnection::handle("INST");
$handle->exec("SET SESSION group_concat_max_len=10000");
File MapGoogle.php
has 259 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 Framework
Method scrub
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function scrub($inputJson, $fedObject) {
$optionInstance = \core\Options::instance();
$parameters = [];
$allPossibleAttribs = array_merge(API::ACTIONS[$inputJson['ACTION']]['REQ'], API::ACTIONS[$inputJson['ACTION']]['OPT'], API::ACTIONS[$inputJson['ACTION']]['FLAG']);
// some actions don't need parameters. Don't get excited when there aren't any.
Method writeConfigVars
has 55 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();
Identical blocks of code found in 2 locations. Consider refactoring. Open
} else { // one of the RADIUS DBs
$this->connection = new \mysqli(\config\ConfAssistant::DB[$databaseCapitalised]['host'], \config\ConfAssistant::DB[$databaseCapitalised]['user'], \config\ConfAssistant::DB[$databaseCapitalised]['pass'], \config\ConfAssistant::DB[$databaseCapitalised]['db']);
if ($this->connection->connect_error) {
throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
}
- 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 125.
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
if (isset(\config\Master::DB[$databaseCapitalised])) {
$this->connection = new \mysqli(\config\Master::DB[$databaseCapitalised]['host'], \config\Master::DB[$databaseCapitalised]['user'], \config\Master::DB[$databaseCapitalised]['pass'], \config\Master::DB[$databaseCapitalised]['db']);
if ($this->connection->connect_error) {
throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
}
- 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 125.
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
Method furtherStringChecks
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function furtherStringChecks($attribute, $previsionalContent, &$bad) {
$content = FALSE;
switch ($attribute) {
case "media:consortium_OI":
$content = $this->validator->consortiumOI($previsionalContent);
Method udpLogin
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function udpLogin($probeindex, $eaptype, $innerUser, $password, $opnameCheck = TRUE, $frag = TRUE, $clientcertdata = NULL) {
$preliminaries = $this->udpLoginPreliminaries($probeindex, $eaptype, $clientcertdata);
if ($preliminaries !== TRUE) {
return $preliminaries;
}
Method relevantNAPTRhostnameResolution
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function relevantNAPTRhostnameResolution()
{
// make sure the previous tests have been run before we go on
// preceding tests will cascade automatically if needed
if ($this->NAPTR_SRV_executed == RFC7585Tests::RETVAL_NOTRUNYET) {
Method mailAddressValidSecure
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function mailAddressValidSecure($address)
{
$loggerInstance = new \core\common\Logging();
if (!filter_var($address, FILTER_VALIDATE_EMAIL)) {
$loggerInstance->debug(4, "OutsideComm::mailAddressValidSecure: invalid mail address.");
File adminQuery.php
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* *****************************************************************************
* Contributions to this work were made on behalf of the GÉANT project, a
Function sendOptionsToDatabase
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function sendOptionsToDatabase($object, array $options, array $pendingattributes, string $device = NULL, int $eaptype = NULL) {
$retval = [];
foreach ($options as $iterateOption) {
foreach ($iterateOption as $name => $optionPayload) {
$optiontype = $this->optioninfoObject->optionType($name);
- 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 createMsgbox
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function createMsgbox(type, onclick) {
var body = document.getElementsByTagName("body")[0];
if (document.getElementById("overlay") === null) {
var overlay = document.createElement("div");
overlay.setAttribute("id", "overlay");
- 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 saveNetworkProfileSeparateHS
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function saveNetworkProfileSeparateHS($profileName, $network)
{
$out = '';
if (!empty($network['ssid'])) {
if ($this::separateSSIDprofiles === true && !empty($network['condition']) && $network['condition'] === 'locally_defined') {
- 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 testSslscan
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function testSslscan()
{
$A = $this->getExecPath('sslscan');
if ($A['exec'] != "" && $A['exec_is'] == "EXPLICIT" && !file_exists($A['exec'])) {
$this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>sslscan</strong> is configured explicitly and was not found on your system!");
- 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 getExternalDBEntityDetails
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getExternalDBEntityDetails($externalId, $realm = NULL)
{
$list = [];
if (\config\ConfAssistant::CONSORTIUM['name'] == "eduroam" && isset(\config\ConfAssistant::CONSORTIUM['deployment-voodoo']) && \config\ConfAssistant::CONSORTIUM['deployment-voodoo'] == "Operations Team") { // SW: APPROVED
$scanforrealm = "";
- 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 setup
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
final public function setup(AbstractProfile $profile, $token = NULL, $importPassword = NULL, $openRoaming = 0)
{
$this->loggerInstance->debug(4, "module setup start\n");
common\Entity::intoThePotatoes();
$purpose = 'installer';
- 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"