rhosocial/rho.social

View on GitHub

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.
Severity: Major
Found in my.rho.social/widgets/item/assets/item/js/rho.my.address.js - About 1 day to fix

    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',
    Severity: Minor
    Found in my.rho.social/widgets/item/assets/item/js/rho.my.item.js - About 5 hrs to fix

    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',

    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',
    Severity: Major
    Found in my.rho.social/widgets/item/assets/item/js/rho.my.item.js - About 4 hrs to fix

      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

        /**
         *  _   __ __ _____ _____ ___  ____  _____
         * | | / // // ___//_  _//   ||  __||_   _|
         * | |/ // /(__  )  / / / /| || |     | |
         * |___//_//____/  /_/ /_/ |_||_|     |_|
        Severity: Minor
        Found in my.rho.social/widgets/item/assets/item/js/rho.my.address.js - About 2 hrs to fix

          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) {
          Severity: Minor
          Found in my.rho.social/widgets/item/assets/item/js/get-item.js - About 2 hrs to fix

          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(),
          Severity: Minor
          Found in contact.rho.social/modules/v1/controllers/ContactController.php - About 1 hr to fix

            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();
            Severity: Minor
            Found in console/modules/user/controllers/InfoController.php - About 1 hr to fix

            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);
            Severity: Minor
            Found in my.rho.social/widgets/item/assets/item/js/rho.my.address.js - About 1 hr to fix

              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) {
              Severity: Minor
              Found in my.rho.social/widgets/item/assets/item/js/rho.my.address.js - About 1 hr to fix

                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);
                Severity: Minor
                Found in my.rho.social/widgets/item/assets/item/js/rho.my.address.js - About 1 hr to fix

                  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);
                  Severity: Minor
                  Found in my.rho.social/widgets/item/assets/item/js/rho.my.address.js - About 1 hr to fix

                    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) {
                    Severity: Minor
                    Found in api.rho.social/modules/v1/helpers/AccessToken.php - About 1 hr to fix

                    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)
                    Severity: Major
                    Found in common/models/user/contact/AddressRelation.php - About 1 hr to fix

                      Method behaviors has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function behaviors()
                          {
                              return [
                                  'access' => [
                                      'class' => AccessControl::className(),
                      Severity: Minor
                      Found in contact.rho.social/controllers/ContactController.php - About 1 hr to fix

                        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);
                        Severity: Minor
                        Found in my.rho.social/widgets/item/assets/item/js/rho.my.address.js - About 1 hr to fix

                          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) {
                          Severity: Minor
                          Found in rho.social/modules/api/controllers/authorize/ConfirmAction.php - About 1 hr to fix

                            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) {
                            Severity: Minor
                            Found in my.rho.social/widgets/item/assets/item/js/rho.my.address.js - About 1 hr to fix

                              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);
                              Severity: Minor
                              Found in my.rho.social/widgets/item/assets/item/js/rho.my.address.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language