Showing 506 of 851 total issues
Method postEdit
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postEdit($PostInfo)
{
global $CurUserRole, $CurUserName, $TimeStamp;
if ($this->config['AllowEditing'] === 'true') {
Auth(4, $PostInfo['UserID'], true);
Function initColorSelector
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initColorSelector () {
var obj = editor.queryCommandValue('background');
if (obj) {
var color = obj['background-color'],
repeat = obj['background-repeat'] || 'repeat',
Method getManageInfo
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getManageInfo($manageType)
{
global $CurUserID;
switch ($manageType) {
case 'topic':
Function Brush
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Brush()
{
// Contributed by Joel 'Jaykul' Bennett, http://PoshCode.org | http://HuddledMasses.org
var keywords = 'while validateset validaterange validatepattern validatelength validatecount ' +
'until trap switch return ref process param parameter in if global: '+
Consider simplifying this complex logical expression. Open
if(data['url']) {
return [{
src: data['url'],
_src: data['url'],
width: data['width'] || '',
Consider simplifying this complex logical expression. Open
if (($cn > 0x3FFF && $cn < 0x9FA6) || ($cn > 0xF8FF && $cn < 0xFA2D) || ($cn > 0xABFF && $cn < 0xD7A4) || ($cn > 0x3040 && $cn < 0x312B)) {
if ($lastc != 1 && $onstr != '') {
$this->simpleResult[$s]['w'] = $onstr;
if ($lastc == 2) {
if (!preg_match('/' . $notNumberMatch . '/i', iconv(UCS2, 'utf-8', $onstr)))
Consider simplifying this complex logical expression. Open
if (function_exists('imagecreate') && function_exists('imagecolorset') && function_exists('imagecopyresized') && function_exists('imagecolorallocate') && function_exists('imagesetpixel') && function_exists('imagechar') && function_exists('imagecreatefromgif') && function_exists('imagepng')) {
$im = imagecreate($width, $height);
$backgroundcolor = imagecolorallocate($im, 255, 255, 255);
Function initButtons
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initButtons() {
dialog.onok = function () {
var remote = false, list = [], id, tabs = $G('tabhead').children;
for (var i = 0; i < tabs.length; i++) {
Method CheckOpenID
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function CheckOpenID()
{
global $DB, $AppID, $OauthObject, $TimeStamp, $Config, $CurUserID, $Lang;
$OauthUserID = $DB->single("SELECT UserID FROM " . PREFIX . "app_users
WHERE AppID=:AppID AND OpenID = :OpenID", array(
Function callByBrowser
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
baidu.sio.callByBrowser = function (url, opt_callback, opt_options) {
var scr = document.createElement("SCRIPT"),
scriptLoaded = 0,
options = opt_options || {},
charset = options['charset'],
Function setSelection
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setSelection(from, to, oldFrom, oldTo) {
goalColumn = null;
if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
if (posEq(sel.from, from) && posEq(sel.to, to)) return;
if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
Function jsonp
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
var jsonp = function (domains, path, config, callback) {
if (isObject(config.getLib)) {
config._extend(config.getLib);
callback(config);
return;
Function onContextMenu
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onContextMenu(e) {
var pos = posFromMouse(e);
if (!pos || window.opera) return; // Opera is difficult.
if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
operation(setCursor)(pos.line, pos.ch);
Method cleanNodes
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function cleanNodes(DOMElement $elem, $isFirstNode = false)
{
$nodeName = strtolower($elem->nodeName);
$textContent = $elem->textContent;
if ($isFirstNode || array_key_exists($nodeName, $this->config->WhiteListTag)) {
Method mb_pathinfo
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function mb_pathinfo($path, $options = null)
{
$ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
$pathinfo = array();
if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
Function getSeriesAndCategories
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function getSeriesAndCategories () {
var form = document.forms[ 'data-form' ],
series = [],
categories = [],
- 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 CurIP
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function CurIP()
{
$IsCDN = false; //未使用CDN时,应直接使用 $_SERVER['REMOTE_ADDR'] 以防止客户端伪造IP
$IP = false;
if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
- 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 MakeDict
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function MakeDict($source_file, $target_file = '')
{
$target_file = ($target_file == '' ? $this->mainDicFile : $target_file);
$allk = array();
$fp = fopen($source_file, 'r');
- 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 coordsChar
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function coordsChar(x, y) {
if (y < 0) y = 0;
var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);
var lineNo = lineAtHeight(doc, heightPos);
if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};
Function Brush
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Brush()
{
function process(match, regexInfo)
{
var constructor = SyntaxHighlighter.Match,