Showing 16,700 of 16,700 total issues
Function file
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function file($field, array $options = array())
{
$page = Page::html();
// View
- 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 loadFileListByEof
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function loadFileListByEof()
{
// Check if there's a valid Central Dir signature.
// Let's consider a file comment smaller than 1024 characters...
// Actually, it length can be 65536.. But we're not going to support it.
Method listUsers
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function listUsers($view)
{
extract(Admin::params('bp', 'page', 'auth', 'website'));
$page->title = 'View Users at '.$website;
$html = '';
Method page
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function page()
{
$page = Page::html();
$get = $page->request->query->all();
if ($page->get('adminer') == 'css') {
Function exec
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private static function exec($action, $table, $values = null)
{
$action = strtolower($action);
if (!isset(self::$stmt[$action][$table])) {
switch ($action) {
- 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 process
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function process()
{
$page = Page::html();
$file = $page->file('analytics.csv');
$temp = $page->file('analytics-temp.csv');
- 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 page
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function page()
{
extract(Admin::params('bp', 'page'));
$html = '';
- 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 setup
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function setup(Auth $auth, Blog $blog, array $map)
{
$html = '';
if (!isset(static::$version['bootstrap'])) {
return $html;
Function visitors
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function visitors()
{
extract(Admin::params('bp', 'website', 'page', 'path', 'admin'));
$page->title = 'Visitors at '.$website;
$html = '';
- 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 __call
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function __call($method, $arguments)
{
switch ($method) {
case 'start':
if (self::$debugbar->hasCollector('time')) {
- 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 startStop
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function startStop($count, $range, $label = 'Y-m-d H:i:s', array $values = array())
{
$array = array();
$range = substr($range, 0, 3);
if (in_array($range, array('sec', 'min', 'hou', 'day', 'wee', 'mon', 'yea'))) {
- 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 page
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function page()
{
extract(Admin::params('bp', 'page'));
$html = '';
Method save
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function save(array $files, array $remove = array())
{
$page = Page::html();
if (($retrieve = $page->post('retrieve')) && isset($files[$retrieve])) {
exit(is_file($files[$retrieve]) ? file_get_contents($files[$retrieve]) : '');
Method database
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function database()
{
$page = Page::html();
$db = new SQLite($page->file('Analytics.db'));
if ($db->created || version_compare(self::VERSION, $db->settings('version'), '>')) {
Function display_wyciwyg
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function display_wyciwyg (classes, data, retrieve, file, line, col) {
acefile.compare = data;
$("#toolbar div.file").text(file);
$("#toolbar div.status").hide();
if (classes.hasClass("noMarkup")) {
- 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 collect
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function collect()
{
// return array();
$responseHeaders = $this->response->headers->all();
Method exec
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function exec($action, $table, $values = null)
{
$action = strtolower($action);
if (!isset(self::$stmt[$action][$table])) {
switch ($action) {
Method wyciwyg
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function wyciwyg()
{
extract(self::params('bp', 'page', 'plugin'));
$html = "\n\n".<<<EOT
<div id="wyciwyg" style="display:none; width:100%; padding:0 10px;">
Function display_wyciwyg
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function display_wyciwyg (classes, data, retrieve, file, line, col) {
acefile.compare = data;
$("#toolbar div.file").text(file);
$("#toolbar div.status").hide();
if (classes.hasClass("noMarkup")) {
Similar blocks of code found in 3 locations. Consider refactoring. Open
foreach ($this->startStop(180, 'minute', 'Y-m-d H:i:s') as $x => $info) { // D M j
list($start, $stop) = $info;
$this->db->execute($stmt, array($start, $stop));
list($loaded, $server) = $this->db->fetch($stmt);
$data[] = '{x:"'.$x.'", loaded:'.round($loaded, 2).', server:'.round($server, 2).'}';
- 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 130.
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