Method mysql
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mysql()
{
$this->db->query('DROP TABLE IF EXISTS `errorlog`;');
$this->db->query('ALTER TABLE `assetstore` ADD KEY `name` (`name`);');
$this->db->query('
- Create a ticketCreate a ticket
Method sqlite
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sqlite()
{
$this->db->query('DROP TABLE IF EXISTS "errorlog";');
$this->db->query('CREATE INDEX IF NOT EXISTS "assetstore_name_idx" ON "assetstore" ("name");');
$this->db->query('CREATE INDEX IF NOT EXISTS "bitstream_assetstore_id_idx" ON "bitstream" ("assetstore_id");');
- Create a ticketCreate a ticket
Method pgsql
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function pgsql()
{
$this->db->query('DROP TABLE IF EXISTS "errorlog";');
$this->db->query('ALTER TABLE "communityinvitation" ADD UNIQUE ("user_id", "group_id");');
$this->db->query('ALTER TABLE "feed2community" ADD UNIQUE ("community_id", "feed_id");');
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function pgsql()
{
$this->db->query('DROP TABLE IF EXISTS "errorlog";');
$this->db->query('ALTER TABLE "communityinvitation" ADD UNIQUE ("user_id", "group_id");');
$this->db->query('ALTER TABLE "feed2community" ADD UNIQUE ("community_id", "feed_id");');
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 422.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function sqlite()
{
$this->db->query('DROP TABLE IF EXISTS "errorlog";');
$this->db->query('CREATE INDEX IF NOT EXISTS "assetstore_name_idx" ON "assetstore" ("name");');
$this->db->query('CREATE INDEX IF NOT EXISTS "bitstream_assetstore_id_idx" ON "bitstream" ("assetstore_id");');
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 422.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Upgrade_3_4_2 extends MIDASUpgrade
- Create a ticketCreate a ticket
- Exclude checks
The class Upgrade_3_4_2 is not named in CamelCase. Open
class Upgrade_3_4_2 extends MIDASUpgrade
{
/** Upgrade a MySQL database. */
public function mysql()
{
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Line exceeds 120 characters; contains 122 characters Open
$this->db->query('CREATE INDEX IF NOT EXISTS "user_lastname_firstname_idx" ON "user" ("lastname", "firstname");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$this->db->query('CREATE UNIQUE INDEX IF NOT EXISTS "setting_name_module_idx" ON "setting" ("name", "module");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$this->db->query('CREATE INDEX IF NOT EXISTS "pendinguser_lastname_firstname_idx" ON "pendinguser" ("lastname", "firstname");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
$this->db->query('CREATE UNIQUE INDEX IF NOT EXISTS "itemrevision_item_revision_idx" ON "itemrevision" ("item_id", "revision");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
$this->db->query('CREATE UNIQUE INDEX IF NOT EXISTS "userapi_user_id_application_name_idx" ON "userapi" ("user_id", "application_name");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
$this->db->query('CREATE UNIQUE INDEX IF NOT EXISTS "user2group_group_user_id_idx" ON "user2group" ("group_id", "user_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$this->db->query('CREATE INDEX IF NOT EXISTS "newuserinvitation_inviter_id_idx" ON "newuserinvitation" ("inviter_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$this->db->query('CREATE INDEX "communityinvitation_idx_community_id" ON "communityinvitation" ("community_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
$this->db->query('CREATE UNIQUE INDEX IF NOT EXISTS "communityinvitation_user_group_id_idx" ON "communityinvitation" ("user_id", "group_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
$this->db->query('CREATE UNIQUE INDEX IF NOT EXISTS "feed2community_community_feed_id_idx" ON "feed2community" ("community_id", "feed_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$this->db->query('CREATE INDEX "pendinguser_idx_lastname_firstname" ON "pendinguser" ("lastname", "firstname");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$this->db->query('CREATE INDEX IF NOT EXISTS "newuserinvitation_group_id_idx" ON "newuserinvitation" ("group_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$this->db->query('ALTER TABLE `userapi` ADD UNIQUE KEY `user_id_application_name` (`user_id`, `application_name`);');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$this->db->query('CREATE INDEX IF NOT EXISTS "community_membergroup_id_idx" ON "community" ("membergroup_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$this->db->query('CREATE INDEX IF NOT EXISTS "metadatavalue_itemrevision_id_idx" ON "metadatavalue" ("itemrevision_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$this->db->query('CREATE INDEX IF NOT EXISTS "bitstream_itemrevision_id_idx" ON "bitstream" ("itemrevision_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$this->db->query('CREATE INDEX IF NOT EXISTS "community_moderatorgroup_id_idx" ON "community" ("moderatorgroup_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
$this->db->query('CREATE UNIQUE INDEX IF NOT EXISTS "feedpolicygroup_feed_group_id_idx" ON "feedpolicygroup" ("feed_id", "group_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
$this->db->query('CREATE UNIQUE INDEX IF NOT EXISTS "feedpolicyuser_feed_user_id_idx" ON "feedpolicyuser" ("feed_id", "user_id");');
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$this->db->query('CREATE INDEX IF NOT EXISTS "communityinvitation_community_id_idx" ON "communityinvitation" ("community_id");');
- Create a ticketCreate a ticket
- Exclude checks
Class name "Upgrade_3_4_2" is not in camel caps format Open
class Upgrade_3_4_2 extends MIDASUpgrade
- Create a ticketCreate a ticket
- Exclude checks