Showing 48 of 1,384 total issues
Function address
has 283 lines of code (exceeds 25 allowed). Consider refactoring. Open
rho.my.address = (function ($) {
var pub = {
/**
* selector: REQUIRED.
* url: REQUIRED.
Function item
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
rho.my.item = (function ($) {
var pub = {
pageCountUrl: '/api/item/page-count',
itemWidgetsUrl: '/api/item/widget-list',
itemWidgetUrl: '/api/item/widget-get',
- 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 panel
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
rho.contact.panel = (function ($) {
var pub = {
pageCountUrl: '/v1/contact/page-count',
itemWidgetsUrl: '/v1/contact/widget-list',
itemWidgetUrl: '/v1/contact/widget-get',
- 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 item
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
rho.my.item = (function ($) {
var pub = {
pageCountUrl: '/api/item/page-count',
itemWidgetsUrl: '/api/item/widget-list',
itemWidgetUrl: '/api/item/widget-get',
Function panel
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
rho.contact.panel = (function ($) {
var pub = {
pageCountUrl: '/v1/contact/page-count',
itemWidgetsUrl: '/v1/contact/widget-list',
itemWidgetUrl: '/v1/contact/widget-get',
File rho.my.address.js
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* _ __ __ _____ _____ ___ ____ _____
* | | / // // ___//_ _// || __||_ _|
* | |/ // /(__ ) / / / /| || | | |
* |___//_//____/ /_/ /_/ |_||_| |_|
Function setPagination
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function setPagination()
{
$("#page-total").text(total_page);
$("#page-current").text(current_page + 1);
if (current_page <= 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"
Further reading
Method behaviors
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function behaviors()
{
return [
'contentNegotiator' => [
'class' => ContentNegotiator::className(),
Function actionIndex
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function actionIndex($id)
{
$user = null;
if (preg_match(Number::GUID_REGEX, $id)) {
$user = User::find()->guid($id)->one();
- 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 setProvinceSelector
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setProvinceSelector(form) {
var addressId = form.attr("address_id");
var provinceSelector = form.find(pub.province.selector);
var citySelector = form.find(pub.city.selector);
var districtSelector = form.find(pub.district.selector);
Function setCitySelector
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setCitySelector(form) {
var addressId = form.attr("address_id");
var citySelector = form.find(pub.city.selector);
var districtSelector = form.find(pub.district.selector);
rho.post(pub.city.url, {country: pub.value[addressId]["country"], province: pub.value[addressId]["province"]}, function (data, status) {
Function changeProvinceSelector
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function changeProvinceSelector(selector) {
var currentCountry = selector.find(pub.country.selector);
var currentProvince = selector.find(pub.province.selector);
var currentCity = selector.find(pub.city.selector);
var currentDistrict = selector.find(pub.district.selector);
Function setCountrySelector
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setCountrySelector(form) {
var addressId = form.attr("address_id");
var countrySelector = form.find(pub.country.selector);
var provinceSelector = form.find(pub.province.selector);
var citySelector = form.find(pub.city.selector);
Function generateAccessToken
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function generateAccessToken()
{
if (function_exists('mcrypt_create_iv')) {
$randomData = mcrypt_create_iv(20, MCRYPT_DEV_URANDOM);
if ($randomData !== false && strlen($randomData) === 20) {
- 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 createAddress
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createAddress($country, $province, $city, $district, $street, $building, $room, $post_code, $description = '', $permission = Address::PERMISSION_MUTUAL)
Method behaviors
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
Function changeCitySelector
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function changeCitySelector(selector) {
var currentCountry = selector.find(pub.country.selector);
var currentProvince = selector.find(pub.province.selector);
var currentCity = selector.find(pub.city.selector);
var currentDistrict = selector.find(pub.district.selector);
Method run
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run($response_type = null, $client_id = null, $state = null, $redirect_uri = null, $scope = null)
{
// log user in forcely before validate.
$checkResult = $this->checkResponseType($response_type);
if ($checkResult !== true) {
Function setDistrictSelector
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setDistrictSelector(form) {
var addressId = form.attr("address_id");
var districtSelector = form.find(pub.district.selector);
rho.post(pub.district.url, {country: pub.value[addressId]["country"], province: pub.value[addressId]["province"], city: pub.value[addressId]["city"]}, function (data, status) {
if (data.length === 0) {
Function changeDistrictSelector
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function changeDistrictSelector(selector) {
var currentCountry = selector.find(pub.country.selector);
var currentProvince = selector.find(pub.province.selector);
var currentCity = selector.find(pub.city.selector);
var currentDistrict = selector.find(pub.district.selector);