Showing 559 of 559 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
$('.entry_edit_close').click(function () {
$(entry).find('.entry_text').html(entry_old_text)
$(entry).find('.entry_actions').show()
})
- Read upRead up
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 65.
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
$('.comment_edit_close').click(function () {
$(comment).find('.comment_text').html(comment_old_text)
$(comment).find('.comment_actions').show()
})
- Read upRead up
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 65.
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
Method parse_usernames
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parse_usernames($body)
{
$body = preg_replace_callback('/(?<=^|\s)c\/([a-z0-9_-]+)(?=$|\s|:|.)/i', function ($matches) {
$contentId = Hashids::decode($matches[1]);
Avoid using short method names like CreateUserBlockedUsersTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('user_blocked_users', function (Blueprint $table) {
$table->integer('source_id')->unsigned();
$table->foreign('source_id')
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateFoldersTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('folders', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateConversationUsersTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('conversation_users', function (Blueprint $table) {
$table->increments('id');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateCommentRepliesTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('comment_replies', function (Blueprint $table) {
$table->increments('id');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateSessionsTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->unique();
$table->unsignedInteger('user_id')->nullable();
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateVotesTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('votes', function (Blueprint $table) {
$table->boolean('up');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateUserBlockedDomainsTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('user_blocked_domains', function (Blueprint $table) {
$table->string('domain');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateContentsTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('contents', function (Blueprint $table) {
$table->increments('id');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateEntriesTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('entries', function (Blueprint $table) {
$table->increments('id');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateContentRelatedTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('content_related', function (Blueprint $table) {
$table->increments('id');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateUserBlockedGroupsTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('user_blocked_groups', function (Blueprint $table) {
$table->integer('group_id')->unsigned();
$table->foreign('group_id')
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateGroupsTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('groups', function (Blueprint $table) {
$table->increments('id');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateNotificationsTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateConversationsTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('conversations', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateConversationMessagesTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('conversation_messages', function (Blueprint $table) {
$table->bigIncrements('id');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateUsersTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like CreateUserActionsTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::create('user_actions', function (Blueprint $table) {
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users');
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}