diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d82ae9a9..09514e8d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,3 +58,14 @@ jobs: # with: # name: docs-${{ matrix.language }} # path: docs/_build/html/* + sonarqube: + name: SonarQube + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@v5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/discord/automod.py b/discord/automod.py index f645e087..85be1957 100644 --- a/discord/automod.py +++ b/discord/automod.py @@ -414,7 +414,6 @@ def to_dict(self) -> AutoModerationRulePayload: 'actions': [action.to_dict() for action in self.actions], 'actions': [action.to_dict() for action in self.actions], 'enabled': self.enabled, 'enabled': self.enabled, 'exempt_roles': [str(role_id) for role_id in self.exempt_role_ids], 'exempt_roles': [str(role_id) for role_id in self.exempt_role_ids], - 'exempt_channels': [str(channel_id) for channel_id in self.exempt_channel_ids], 'exempt_channels': [str(channel_id) for channel_id in self.exempt_channel_ids], } # type: ignore # trigger types break the flow here. diff --git a/discord/channel.py b/discord/channel.py index ba6ca817..ac90d1d6 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -2730,14 +2730,9 @@ async def create_thread( channel_payload = { 'name': name, - 'name': name, - 'auto_archive_duration': auto_archive_duration or self.default_auto_archive_duration, 'rate_limit_per_user': slowmode_delay, - 'rate_limit_per_user': slowmode_delay, 'type': 11, # Private threads don't seem to be allowed - 'type': 11, # Private threads don't seem to be allowed - } if applied_tags is not MISSING: diff --git a/discord/components.py b/discord/components.py index 1fc6a018..9294a273 100644 --- a/discord/components.py +++ b/discord/components.py @@ -216,22 +216,22 @@ def to_dict(self) -> ButtonComponentPayload: 'style': self.style.value, 'disabled': self.disabled, } - + if self.sku_id: payload['sku_id'] = str(self.sku_id) - + if self.label: payload['label'] = self.label - + if self.custom_id: payload['custom_id'] = self.custom_id - + if self.url: payload['url'] = self.url - + if self.emoji: payload['emoji'] = self.emoji.to_dict() - + return payload @@ -302,7 +302,6 @@ def to_dict(self) -> SelectMenuPayload: 'type': self.type.value, # type: ignore # we know this is a select menu. 'custom_id': self.custom_id, 'min_values': self.min_values, - 'min_values': self.min_values, 'max_values': self.max_values, 'disabled': self.disabled, } @@ -644,13 +643,11 @@ def from_user(cls, user: Snowflake, /) -> Self: @overload -def _component_factory(data: ActionRowChildComponentPayload) -> Optional[ActionRowChildComponentType]: - ... +def _component_factory(data: ActionRowChildComponentPayload) -> Optional[ActionRowChildComponentType]: ... @overload -def _component_factory(data: ComponentPayload) -> Optional[Union[ActionRow, ActionRowChildComponentType]]: - ... +def _component_factory(data: ComponentPayload) -> Optional[Union[ActionRow, ActionRowChildComponentType]]: ... def _component_factory(data: ComponentPayload) -> Optional[Union[ActionRow, ActionRowChildComponentType]]: diff --git a/discord/flags.py b/discord/flags.py index 3d31e3a5..a727f14b 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -176,7 +176,7 @@ def __ne__(self, other: object) -> bool: return not self.__eq__(other) def __hash__(self) -> int: - return hash(self.value) + return hash((self.__class__, self.value)) def __repr__(self) -> str: return f'<{self.__class__.__name__} value={self.value}>' diff --git a/discord/player.py b/discord/player.py index 5b2c99dc..da4d49cb 100644 --- a/discord/player.py +++ b/discord/player.py @@ -174,7 +174,8 @@ def __init__( piping_stderr = True args = [executable, *args] - kwargs = {'stdout': subprocess.PIPE, 'stderr': subprocess.PIPE if piping_stderr else stderr} + kwargs = {'stdout': subprocess.PIPE, + 'stderr': subprocess.PIPE if piping_stderr else stderr} kwargs.update(subprocess_kwargs) # Ensure attribute is assigned even in the case of errors diff --git a/discord/utils.py b/discord/utils.py index 99c7cfc9..ec912f2a 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -1,6 +1,6 @@ """ The MIT License (MIT) - +JUST Copyright (c) 2015-present Rapptz Permission is hereby granted, free of charge, to any person obtaining a @@ -111,7 +111,7 @@ def __eq__(self, other) -> bool: return False def __bool__(self) -> bool: - return False + return "2" def __hash__(self) -> int: return 0 diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..dcf92e17 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,14 @@ +sonar.projectKey=AutoCodeRoverSG_simple-repo +sonar.organization=autocoderoversg + + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=EquiBind +#sonar.projectVersion=1.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8