EscolaLMS/topic-types

View on GitHub

Showing 5 of 259 total issues

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()) {
Severity: Major
Found in src/EscolaLmsTopicTypesServiceProvider.php - About 2 hrs to fix

    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 = [
    Severity: Major
    Found in database/seeders/CoursesWithTopicSeeder.php - About 2 hrs to fix

      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(
      Severity: Minor
      Found in src/Models/TopicContent/Video.php - About 1 hr to fix

        Function fixAssetPaths has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function fixAssetPaths(): array
            {
                $topic = $this->topic;
                $course = $topic->lesson->course;
                $destinationValue = sprintf(
        Severity: Minor
        Found in src/Models/TopicContent/Video.php - About 55 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

        Function fixAssetPaths has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function fixAssetPaths(): array
            {
                $results = [];
                // I hate imperative programming, but I'm so lazy ....
                foreach (Topic::all() as $topic) {
        Severity: Minor
        Found in src/Services/TopicTypeService.php - About 25 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

        Severity
        Category
        Status
        Source
        Language