lightster/hodor

View on GitHub

Showing 16 of 36 total issues

Method transactionalUp has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function transactionalUp(YoPdo $yo_pdo)
    {
        $sql = <<<SQL
CREATE SEQUENCE buffered_jobs_buffered_job_id_seq;
CREATE SEQUENCE failed_jobs_failed_job_id_seq;
Severity: Major
Found in migrations/postgres/20151022112749_CreateInitialSchema.php - About 3 hrs to fix

Method transactionalUp has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function transactionalUp(YoPdo $yo_pdo)
    {
        $sql = <<<SQL
CREATE TABLE scheduled_jobs
(
Severity: Major
Found in migrations/postgres/20170501024010_AddScheduledJobsTable.php - About 2 hrs to fix

Method addDefaultServices has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addDefaultServices($config_file = null)
    {
        $this->addConfigFileService($config_file);

        $this['hodor.config.factory'] = $this->share(
Severity: Minor
Found in src/Hodor/Database/Phpmig/Container.php - About 1 hr to fix

Method processScheduledJobs has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function processScheduledJobs()
    {
        $sql = <<<SQL
INSERT INTO buffered_jobs
(
Severity: Minor
Found in src/Hodor/Database/Adapter/Postgres/Superqueuer.php - About 1 hr to fix

Method configure has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function configure()
    {
        $this
            ->setName('test:generate-config')
            ->setDescription('Generate a config file for tests')
Severity: Minor
Found in src/Hodor/Command/TestGenerateConfigCommand.php - About 1 hr to fix

Method markJobAsFinished has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function markJobAsFinished($status, array $meta)
    {
        $sql = <<<SQL
SELECT *
FROM queued_jobs
Severity: Minor
Found in src/Hodor/Database/Adapter/Postgres/Dequeuer.php - About 1 hr to fix

Method transactionalUp has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function transactionalUp(YoPdo $yo_pdo)
    {
        $sql = <<<SQL
ALTER TABLE buffered_jobs
    ADD COLUMN mutex_id VARCHAR DEFAULT 'hodor:' || currval('buffered_jobs_buffered_job_id_seq'::regclass);
Severity: Minor
Found in migrations/postgres/20151228082041_AddMutexId.php - About 1 hr to fix

Method getJobsToRunGenerator has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getJobsToRunGenerator()
    {
        $this->processScheduledJobs();

        $sql = <<<SQL
Severity: Minor
Found in src/Hodor/Database/Adapter/Postgres/Superqueuer.php - About 1 hr to fix

Method bufferJob has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function bufferJob($queue_name, array $job)
    {
        $table_name = 'buffered_jobs';
        $status_column = 'inserted';
        if (isset($job['options']['run_after'])) {
Severity: Minor
Found in src/Hodor/Database/Adapter/Postgres/BufferWorker.php - About 1 hr to fix

Method down has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function down(Migration $migration)
    {
        $version = $migration->getVersion();
        $sql = <<<SQL
SELECT *
Severity: Minor
Found in src/Hodor/Database/Phpmig/PgsqlPhpmigAdapter.php - About 1 hr to fix

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

    public function getJobsToRunGenerator()
    {
        $buffered_jobs = $this->sortBufferedJobs(
            $this->filterFutureJobs($this->database->getAll('buffered_jobs'))
        );
Severity: Minor
Found in src/Hodor/Database/Adapter/Testing/Superqueuer.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

Avoid too many return statements within this method.
Open

                return __DIR__ . '/MigrationTemplate.php';
Severity: Major
Found in src/Hodor/Database/Phpmig/Container.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return $buffered_jobs;
Severity: Major
Found in src/Hodor/Database/Adapter/Testing/Superqueuer.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return new PgsqlPhpmigAdapter($db_adapter);
Severity: Major
Found in src/Hodor/Database/Phpmig/Container.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return $container['phpmig.adapter']->getMigrationsPath();
Severity: Major
Found in src/Hodor/Database/Phpmig/Container.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return $db_factory->getAdapter($db_config)->getYoPdo();
Severity: Major
Found in src/Hodor/Database/Phpmig/Container.php - About 30 mins to fix
Severity
Category
Status
Source
Language