(self)
Common validation steps of the repository.
Common validation steps of the repository.
Common validation steps of the repository .
async def common_validate(self):
        """Common validation steps of the repository."""
        # Attach helpers
        self.validate.errors = []
        self.logger = Logger(
            f"hacs.repository.{self.information.category}.{self.information.full_name}"
        )

        # Step 1: Make sure the repository exist.
        self.logger.debug("Checking repository.")
        try:
            self.repository_object = await self.github.get_repo(
                self.information.full_name
            )
        except Exception as exception:  # Gotta Catch 'Em All
            if not self.system.status.startup:
                self.logger.error(exception)
            self.validate.errors.append("Repository does not exist.")
            return

        # Step 2: Make sure the repository is not archived.
        if self.repository_object.archived:
            self.validate.errors.append("Repository is archived.")
            return

        # Step 3: Make sure the repository is not in the blacklist.
        if self.information.full_name in self.common.blacklist:
            self.validate.errors.append("Repository is in the blacklist.")
            return

        # Step 4: default branch
        self.information.default_branch = self.repository_object.default_branch

        # Step 5: Get releases.
        await self.get_releases()

        # Set repository name
        self.information.name = self.information.full_name.split("/")[1]
async def common_validate ( self ) : # Attach helpers self . validate . errors = [ ] self . logger = Logger ( f"hacs.repository.{self.information.category}.{self.information.full_name}" ) # Step 1: Make sure the repository exist. self . logger . debug ( "Checking repository." ) try : self . repository_object = await self . github . get_repo ( self . information . full_name ) except Exception as exception : # Gotta Catch 'Em All if not self . system . status . startup : self . logger . error ( exception ) self . validate . errors . append ( "Repository does not exist." ) return # Step 2: Make sure the repository is not archived. if self . repository_object . archived : self . validate . errors . append ( "Repository is archived." ) return # Step 3: Make sure the repository is not in the blacklist. if self . information . full_name in self . common . blacklist : self . validate . errors . append ( "Repository is in the blacklist." ) return # Step 4: default branch self . information . default_branch = self . repository_object . default_branch # Step 5: Get releases. await self . get_releases ( ) # Set repository name self . information . name = self . information . full_name . split ( "/" ) [ 1 ]