DemacMedia/Magento-Multi-Location-Inventory

View on GitHub

Showing 49 of 49 total issues

Function addStoreFilter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function addStoreFilter($store, $withAdmin = true)
    {
        if(!$this->getFlag('store_filter_added')) {
            if($store instanceof Mage_Core_Model_Store) {
                $store = array($store->getId());

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 getPrioritizedLocationsForOrderQuoteItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPrioritizedLocationsForOrderQuoteItem($orderId, $quoteItemId)
    {
        //get storeview id from order id.
        $storeId = Mage::getModel('sales/order')->load($orderId)->getStoreId();

Severity: Minor
Found in app/code/community/Demac/MultiLocationInventory/Helper/Location.php - About 35 mins 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 _afterLoad has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _afterLoad()
    {
        $items      = $this->getColumnValues('id');
        $connection = $this->getConnection();
        if(count($items)) {

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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function update($data)
    {
        try {
            $data = (array) $data;
            $locationItem = Mage::getModel('demac_multilocationinventory/location')->load($data['location_id']);
Severity: Minor
Found in app/code/community/Demac/MultiLocationInventory/Model/Location/Api.php - About 25 mins 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 massDeleteAction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function massDeleteAction()
    {
        $locationIds = $this->getRequest()->getParam('demac_multilocationinventory');
        if(!is_array($locationIds)) {
            Mage::getSingleton('adminhtml/session')->addError($this->__('Please select a location(s)'));

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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function create($data)
    {
        try {
            $data = (array) $data;
Severity: Minor
Found in app/code/community/Demac/MultiLocationInventory/Model/Stock/Api.php - About 25 mins 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 _loopCancelItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function _loopCancelItem($args)
    {
        $productId = $args['product_id'];

        $row = $args['row'];

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 massStatusAction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function massStatusAction()
    {
        $locationIds = $this->getRequest()->getParam('demac_multilocationinventory');
        if(!is_array($locationIds)) {
            Mage::getSingleton('adminhtml/session')->addError($this->__('Please select a location(s)'));

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 items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function items($filters)
    {
        $collection = Mage::getResourceModel('demac_multilocationinventory/location_collection')->load();
        if(is_array($filters)) {
            try {
Severity: Minor
Found in app/code/community/Demac/MultiLocationInventory/Model/Location/Api.php - About 25 mins 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

Severity
Category
Status
Source
Language