IndyIndyIndy/placeholder_images

View on GitHub

Showing 4 of 13 total issues

Function findExistingFileForImage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function findExistingFileForImage($image, Folder $targetFolder)
    {
        $fileIndexRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\FileIndexRepository::class);
        $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);

Severity: Minor
Found in Classes/Resource/Placeholder/AbstractProcessor.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 addPlaceholderImage has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        PlaceholderUploader.addPlaceholderImage = function($trigger, width, height, format, placeholder, bgcolor, textcolor, count) {
            var target = $trigger.data('target-folder');
            var irreObjectUid = $trigger.data('file-irre-object');

            NProgress.start();
Severity: Minor
Found in Resources/Public/JavaScript/PlaceholderUploader.js - About 1 hr to fix

    Method getPlaceholderButton has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getPlaceholderButton($inlineData, $nameObject, $objectPrefix, Folder $folder) : string
        {
            $buttonText = self::getTranslation('tx_placeholderimages.button.text');
            $buttonSubmitText = self::getTranslation('tx_placeholderimages.button.submit');
            $widthText = self::getTranslation('tx_placeholderimages.image.width');
    Severity: Minor
    Found in Classes/Utility/InlineControlButtonUtility.php - About 1 hr to fix

      Function addPlaceholderImage has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              PlaceholderUploader.addPlaceholderImage = function($trigger, width, height, format, placeholder, bgcolor, textcolor, count) {
      Severity: Major
      Found in Resources/Public/JavaScript/PlaceholderUploader.js - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language