User specific files should not appear in .gitignore

  • Minor
  • Codestyle

More information: https://insight.sensiolabs.com/what-we-analyse/git.user_specific_ignored_file

in .gitignore, line 3
  1. /vendor/
  2. /var/
  3. .DS_Store

    .DS_Store is user-specific and should not appear in a project .gitignore. Consider adding it to the user global .gitignore instead.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Agustin Amenabar
  4. # Elastic Beanstalk Files
  5. .elasticbeanstalk/*
  6. !.elasticbeanstalk/*.cfg.yml
  7. !.elasticbeanstalk/*.global.yml

Commented code should not be committed

  • Minor
  • Deadcode

More information: https://insight.sensiolabs.com/what-we-analyse/php.commented_out_code

  1. $gravity = ' -gravity ' . $gravityValue;
  2. $resizingConstraints = '';
  3. $resizingConstraints .= $preserveNaturalSize ? '\>' : '';
  4. if ($crop) {
  5. $resizingConstraints .= '^';
  6. //$extent .= '+repage';//

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Sadok
  7. /**
  8. * still need to solve the combination of ^
  9. * -extent and +repage . Will need to do calculations with the
  10. * original image dimentions vs. the target dimentions.
  11. */

Unused method, property, variable or parameter

  • Minor
  • Deadcode

More information: https://insight.sensiolabs.com/what-we-analyse/php.unused_local_variable_or_private_member

  1. $manager = $this->app['image.processor'];
  2. $image = new Image($options, $imageSrc, $this->app['params']);
  3. try {
  4. $image = $manager->process($image);
  5. } catch (\Exception $e) {
  6. $imageContent = null;

    This imageContent local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sadok
  7. $image->unlinkUsedFiles();
  8. $formattedMessage = '<pre>' . $e->getMessage() . '</pre>';
  9. return new Response($formattedMessage, Response::HTTP_FORBIDDEN);
  10. }

Unused use statement should be avoided 3

  • Minor
  • Deadcode

More information: https://insight.sensiolabs.com/what-we-analyse/php.unused_use_statement

in app.php, line 6
  1. <?php
  2. use Core\Resolver\ControllerResolver;
  3. use Core\Service\ImageProcessor;
  4. use Monolog\Logger;
  5. use Silex\Provider\RoutingServiceProvider;

    The class Silex\Provider\RoutingServiceProvider is declared but never used. You should remove the use statement.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sadok
  6. use Symfony\Component\Config\FileLocator;
  7. use Symfony\Component\Routing\Loader\YamlFileLoader;
  8. use Symfony\Component\Routing\RouteCollection;
  9. use Symfony\Component\Yaml\Yaml;
  1. <?php
  2. namespace Core\Controller;
  3. use Core\Entity\Image;
  4. use Core\Service\ImageProcessor;

    The class Core\Service\ImageProcessor is declared but never used. You should remove the use statement.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sadok
  5. use Silex\Application;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\HttpFoundation\Response;
  8. class CoreController
  1. namespace Core\Controller;
  2. use Core\Entity\Image;
  3. use Core\Service\ImageProcessor;
  4. use Silex\Application;
  5. use Symfony\Component\HttpFoundation\Request;

    The class Symfony\Component\HttpFoundation\Request is declared but never used. You should remove the use statement.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sadok
  6. use Symfony\Component\HttpFoundation\Response;
  7. class CoreController
  8. {
  9. /**

Text files should end with a newline character

  • Info
  • Codestyle

More information: https://insight.sensiolabs.com/what-we-analyse/missing_e_o_l

  1. <p><a href="https://github.com/flyimg/flyimg" target="_blank">Check the docs for more info</a>.</p>
  2. <p>Happy imaging!</p>
  3. {% endblock %}

    This file ends with no newline character. It won't render properly on a terminal, and it's considered a bad practice. Add a simple line feed as the last character to fix it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Sadok