EscolaLMS/API

View on GitHub

Showing 27 of 49 total issues

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

    public function checkUserIsCompletedScorm($scormId, $userId)
    {
        $completedSco    =   [];
        $scos   =   ScormScoModel::where('scorm_id', $scormId)->get();

Severity: Minor
Found in app/Library/ScormHelper.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

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

    function __t(?string $key = null, ?string $default = null, array $replace = [], ?string $locale = null)
    {
        if (Lang::has($key, $locale)) {
            return __($key, $replace, $locale);
        }
Severity: Minor
Found in app/Helpers/lang.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

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

    private function convertTimeInHundredth($time)
    {
        if ($time != null) {
            $timeInArray = explode(':', $time);
            $timeInArraySec = explode('.', $timeInArray[2]);
Severity: Minor
Found in app/Library/ScormHelper.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 Session::flash($status_title, $message);
Severity: Major
Found in app/Http/Controllers/Controller.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return [
                'success' => true,
                'vars' => [
                    'DB_DATABASE' => $username,
                    'DB_USERNAME' => $username,
    Severity: Major
    Found in multidomain-tool/src/Database.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return [
                  'success' => $bucket->success && $policy->success && $user->success,
                  'vars' => [
                      'AWS_ACCESS_KEY_ID' => $bucket_name,
                      'AWS_SECRET_ACCESS_KEY' => $password,
      Severity: Major
      Found in multidomain-tool/src/MinIO.php - About 30 mins to fix

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

            public function run()
            {
                $courses = Course::with('lessons')->get();
                $contents = H5PContent::with('library')->get();
                $scormScos = ScormScoModel::all();
        Severity: Minor
        Found in database/seeds/PostCoursesSeeder.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