badgeteam/Hatchery

View on GitHub

Showing 536 of 536 total issues

Avoid excessively long class names like CreateCategoriesTableAlterProjectsAddCategory. Keep class name length under 40.
Open

class CreateCategoriesTableAlterProjectsAddCategory extends Migration
{
    /**
     * Run the migrations.
     *

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

Method returnProjectView has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function returnProjectView(Request $request, $projects, string $badge = '')
    {
        $category = '';
        if ($request->has('category')) {
            $category = Category::where('slug', $request->get('category'))->firstOrFail();
Severity: Minor
Found in app/Http/Controllers/PublicController.php - About 1 hr to fix

    Method app has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function app(string $device, string $type, string $category, string $app): JsonResponse
        {
            /** @var Badge $badge */
            $badge = Badge::whereSlug($device)->firstOrFail();
            $categoryId = Category::whereSlug($category)->firstOrFail()->id;
    Severity: Minor
    Found in app/Http/Controllers/MchController.php - About 1 hr to fix

      Function manageBadges has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private function manageBadges(Project $project, Request $request): void
          {
              if ($request->has('badge_ids')) {
                  $project->badges()->detach();
                  $badges = Badge::find($request->get('badge_ids'));
      Severity: Minor
      Found in app/Http/Controllers/ProjectsController.php - About 1 hr 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 using short method names like CreatePasswordResetsTable::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::create(
                  'password_resets',
                  function (Blueprint $table) {

      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 AlterVersionsRemoveDependencies::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::table(
                  'versions',
                  function (Blueprint $table) {

      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()
          {
              Schema::create(
                  'users',
                  function (Blueprint $table) {

      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 AlterProjectsAddDescription::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::table(
                  'projects',
                  function (Blueprint $table) {

      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 CreateVersionsTable::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::create(
                  'versions',
                  function (Blueprint $table) {

      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 CreateProjectsTable::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::create(
                  'projects',
                  function (Blueprint $table) {

      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 AlterProjectsAddSlug::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::table(
                  'projects',
                  function (Blueprint $table) {

      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 AddPublishedAtToProjectsTable::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::table(
                  'projects',
                  function (Blueprint $table) {

      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()
          {
              Schema::create(
                  'votes',
                  function (Blueprint $table) {

      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 AlterCategoriesAddHidden::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::table(
                  'categories',
                  function (Blueprint $table) {

      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 AlterBadgeProjectAddStatus::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::table(
                  'badge_project',
                  function (Blueprint $table) {

      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 AlterVersionsMakeZipAndDependenciesNullable::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::table(
                  'versions',
                  function (Blueprint $table) {

      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 AlterUsersAddAdminBoolean::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::table(
                  'users',
                  function (Blueprint $table) {

      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 AddWebauthn::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::create('webauthn_keys', function (Blueprint $table) {
                  $table->increments('id');
                  $table->integer('user_id')->unsigned();

      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 CreateFilesTable::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::create(
                  'files',
                  function (Blueprint $table) {

      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 AlterFilesAndVersionsAddUserId::up(). The configured minimum method name length is 3.
      Open

          public function up()
          {
              Schema::table(
                  'versions',
                  function (Blueprint $table) {

      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

      Severity
      Category
      Status
      Source
      Language