ernestwisniewski/kbin

View on GitHub

Showing 226 of 573 total issues

Function expandComments has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    async expandComments(event) {
        event.preventDefault();

        if (this.loadingValue === true) {
            return;
Severity: Minor
Found in assets/controllers/post_controller.js - About 1 hr to fix

    Method up has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function up(Schema $schema): void
        {
            // this up() migration is auto-generated, please modify it to your needs
            $this->addSql('CREATE SEQUENCE oauth2_user_consent_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
            $this->addSql('CREATE TABLE oauth2_access_token (identifier CHAR(80) NOT NULL, client VARCHAR(32) NOT NULL, expiry TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, user_identifier VARCHAR(128) DEFAULT NULL, scopes TEXT DEFAULT NULL, revoked BOOLEAN NOT NULL, PRIMARY KEY(identifier))');
    Severity: Minor
    Found in migrations/Version20230719060447.php - About 1 hr to fix

      Function expandComments has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          async expandComments(event) {
              event.preventDefault();
      
              if (this.loadingValue === true) {
                  return;
      Severity: Minor
      Found in assets/controllers/post_controller.js - 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

      Function addMainSubject has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          async addMainSubject(data) {
              try {
                  const url = router().generate(`ajax_fetch_${getTypeFromNotification(data)}`, {id: data.detail.id});
      
                  let response = await fetch(url);
      Severity: Minor
      Found in assets/controllers/subject_list_controller.js - About 1 hr to fix

        Method jsonSerialize has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function jsonSerialize(): mixed
            {
                if (null === self::$keysToDelete) {
                    self::$keysToDelete = [
                        'image',
        Severity: Minor
        Found in src/Kbin/PostComment/DTO/PostCommentResponseDto.php - About 1 hr to fix

          Function findByObjectId has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public function findByObjectId(string $apId): ?array
              {
                  $parsed = parse_url($apId);
                  if ($parsed['host'] === $this->settingsManager->get('KBIN_DOMAIN')) {
                      $exploded = array_filter(explode('/', $parsed['path']));
          Severity: Minor
          Found in src/Repository/ApActivityRepository.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

          Function preparePageResults has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public function preparePageResults(iterable $posts): ?iterable
              {
                  $firstIndexes = [];
                  $tmp = [];
                  $duplicates = [];
          Severity: Minor
          Found in src/Kbin/Entry/EntryCrosspost.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

          Method magazine has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function magazine(
                  Magazine $magazine,
                  ?string $sortBy,
                  ?string $time,
                  PostRepository $repository,
          Severity: Minor
          Found in src/Controller/Post/PostFrontController.php - About 1 hr to fix

            Method jsonSerialize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function jsonSerialize(): mixed
                {
                    if (null === self::$keysToDelete) {
                        self::$keysToDelete = [
                            'image',
            Severity: Minor
            Found in src/Kbin/EntryComment/DTO/EntryCommentResponseDto.php - About 1 hr to fix

              Method jsonSerialize has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function jsonSerialize(): mixed
                  {
                      if (null === self::$keysToDelete) {
                          self::$keysToDelete = [
                              'image',
              Severity: Minor
              Found in src/Kbin/Post/DTO/PostResponseDto.php - About 1 hr to fix

                Method create has 12 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        string $username,
                        string $email = null,
                        ImageDto $avatar = null,
                        ImageDto $cover = null,
                        string $about = null,
                Severity: Major
                Found in src/Kbin/User/DTO/UserDto.php - About 1 hr to fix

                  Function getForm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      async getForm(event) {
                          event.preventDefault();
                  
                          if ('' !== this.containerTarget.innerHTML.trim()) {
                              if (false === confirm('Do you really want to leave?')) {
                  Severity: Minor
                  Found in assets/controllers/subject_controller.js - About 1 hr to fix

                    Method getUserReputation has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getUserReputation(User $user, string $className, int $page = 1): PagerfantaInterface
                        {
                            $conn = $this->getEntityManager()
                                ->getConnection();
                    
                    
                    Severity: Minor
                    Found in src/Repository/ReputationRepository.php - About 1 hr to fix

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

                          private function filter(QueryBuilder $qb, Criteria $criteria): void
                          {
                              if ($criteria->post) {
                                  $qb->andWhere('c.post = :post')
                                      ->setParameter('post', $criteria->post);
                      Severity: Minor
                      Found in src/Repository/PostCommentRepository.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

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

                          public function consent(Request $request, EntityManagerInterface $entityManager): Response
                          {
                              $clientId = $request->query->get('client_id');
                              if (!$clientId || !ctype_alnum($clientId) || !$this->getUser()) {
                                  return $this->redirectToRoute('front');
                      Severity: Minor
                      Found in src/Controller/Security/LoginController.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

                      Method getDailyStats has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function getDailyStats(string $table, string $relation = null): array
                          {
                              $conn = $this->getEntityManager()
                                  ->getConnection();
                      
                      
                      Severity: Minor
                      Found in src/Repository/StatsVotesRepository.php - About 1 hr to fix

                        Method findPaginated has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function findPaginated(MagazinePageView $criteria): PagerfantaInterface
                            {
                                $qb = $this->createQueryBuilder('m')
                                    ->andWhere('m.visibility = :visibility')
                                    ->setParameter('visibility', VisibilityInterface::VISIBILITY_VISIBLE);
                        Severity: Minor
                        Found in src/Repository/MagazineRepository.php - About 1 hr to fix

                          Method views has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              #[OA\Response(
                                  response: 200,
                                  description: 'Views by interval retrieved. These are not guaranteed to be continuous.',
                                  content: new OA\JsonContent(
                                      properties: [
                          Severity: Minor
                          Found in src/Controller/Api/Magazine/Admin/MagazineRetrieveStatsApi.php - About 1 hr to fix

                            Method __construct has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function __construct(
                                    string $email,
                                    string $username,
                                    string $password,
                                    string $apProfileId = null,
                            Severity: Minor
                            Found in src/Entity/User.php - About 1 hr to fix

                              Method views has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  #[OA\Response(
                                      response: 200,
                                      description: 'Views by interval retrieved. These are not guaranteed to be continuous.',
                                      content: new OA\JsonContent(
                                          properties: [
                              Severity: Minor
                              Found in src/Controller/Api/Instance/InstanceRetrieveStatsApi.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language