Showing 259 of 259 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
namespace EscolaLms\TopicTypes\Http\Resources\TopicType\Export;
use EscolaLms\TopicTypes\Http\Resources\TopicType\Contacts\TopicTypeResourceContract;
- 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 139.
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
<?php
namespace EscolaLms\TopicTypes\Http\Resources\TopicType\Export;
use EscolaLms\Cmi5\Models\Cmi5Au;
- 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 139.
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 boot
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function boot()
{
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
$this->mergeConfigFrom(__DIR__ . '/../config/topic-h5p.php', 'topic-h5p');
if ($this->app->runningInConsole()) {
Method run
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
$this->faker = $this->makeFaker();
$this->faker->addProvider(new FakerProvider($this->faker));
$randomTags = [
Avoid excessively long class names like AddLengthAndPageCountFieldsToTopicPdfsTable. Keep class name length under 40. Open
class AddLengthAndPageCountFieldsToTopicPdfsTable extends Migration
{
public function up(): void
{
Schema::table('topic_pdfs', function (Blueprint $table) {
- Read upRead up
- Exclude checks
LongClassName
Since: 2.9
Detects when classes or interfaces are declared with excessively long names.
Example
class ATooLongClassNameThatHintsAtADesignProblem {
}
interface ATooLongInterfaceNameThatHintsAtADesignProblem {
}
Source https://phpmd.org/rules/naming.html#longclassname
Avoid using short method names like CreateTopicCmi5AusTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('topic_cmi5_aus', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('value', 255);
- 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 CreateTopicVideosTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('topic_videos', function (Blueprint $table) {
$table->bigIncrements('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 CreateTopicScormScosTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('topic_scorm_scos', function (Blueprint $table) {
$table->bigIncrements('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 AddLengthAndPageCountFieldsToTopicPdfsTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::table('topic_pdfs', function (Blueprint $table) {
$table->bigInteger('length')->nullable();
$table->integer('page_count')->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 CreateTopicImagesTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('topic_images', function (Blueprint $table) {
$table->bigIncrements('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 AddLengthColumnToTopicVideosTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::table('topic_videos', function (Blueprint $table) {
$table->bigInteger('length')->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 CreateTopicAudiosTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('topic_audios', function (Blueprint $table) {
$table->bigIncrements('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 CreateTopicPdfsTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('topic_pdfs', function (Blueprint $table) {
$table->bigIncrements('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 CreateTopicOembedsTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('topic_oembeds', function (Blueprint $table) {
$table->bigIncrements('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 AddLengthFieldToTopicRichtextsTable::up(). The configured minimum method name length is 3. Open
public function up(): void
{
Schema::table('topic_richtexts', function (Blueprint $table) {
$table->bigInteger('length')->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 CreateTopicH5PsTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('topic_h5ps', function (Blueprint $table) {
$table->bigIncrements('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 CreateTopicRichtextsTable::up(). The configured minimum method name length is 3. Open
public function up()
{
Schema::create('topic_richtexts', function (Blueprint $table) {
$table->bigIncrements('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
Method fixAssetPaths
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fixAssetPaths(): array
{
$topic = $this->topic;
$course = $topic->lesson->course;
$destinationValue = sprintf(
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class CreateTopicOembedsTable extends Migration
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class CreateTopicRichtextsTable extends Migration
- Exclude checks