Anapher/Strive

View on GitHub

Showing 735 of 735 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        private static Type GetBaseType(Type type, Type baseType)
        {
            while (type.BaseType != null)
            {
                type = type.BaseType;
src/Services/ConferenceManagement/Strive.Core/Services/Poll/Utilities/PollAnswerValidatorWrapper.cs on lines 41..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 76.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        [Theory]
        [MemberData(nameof(UnequalLists))]
        public void ScrambledEquals_UnequalLists_ReturnFalse(IReadOnlyList<string> list1, IReadOnlyList<string> list2)
        {
            var result = list1.ScrambledEquals(list2);
src/Services/ConferenceManagement/Strive.Core.Tests/Extensions/EnumerableExtensionsTests.cs on lines 28..34

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 76.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        private static Type GetBaseType(Type type, Type baseType)
        {
            while (type.BaseType != null)
            {
                type = type.BaseType;
src/Services/ConferenceManagement/Strive.Core/Services/Poll/Utilities/PollAnswerAggregatorWrapper.cs on lines 45..57

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 76.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function DetailedErrorStatus has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function DetailedErrorStatus({ health: { connection, connector } }: Props) {
   const { t } = useTranslation();

   if (connector.status !== 'ok') {
      if (connector.webRtcStatus === 'connecting') {

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 TroubleshootMicrophone has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function TroubleshootMicrophone({ expanded, onChange }: Props) {
   const { t } = useTranslation();
   const gain = useSelector((state: RootState) => state.settings.obj.mic.audioGain);

   const localMic = useMicrophone(gain, true);

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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

   private async initialize(): Promise<void> {
      const signalr = appHubConn.current;
      if (!signalr) {
         throw new Error('SignalR connection is not available.');
      }
Severity: Minor
Found in src/Web/WebSPA/Client/src/store/webrtc/WebRtcManager.ts - About 45 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 TabCommon has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function TabCommon({
   form: {
      control,
      watch,
      register,

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 RenderPollScene has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function RenderPollScene({ className, scene, dimensions }: RenderSceneProps<PollScene>) {
   const classes = useStyles();
   const { t } = useTranslation();
   const canOpenPoll = usePermission(POLL_CAN_OPEN);
   const dispatch = useDispatch();

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 deeply nested control flow statements.
Open

                  if (action.payload.success === true) {
                     toast.success(handler.successMessage, { id: handler.toastId });
                  } else if (action.payload.success === false) {
                     toast.error(formatErrorMessage(action.payload.error), { id: handler.toastId });
                  } else {
Severity: Major
Found in src/Web/WebSPA/Client/src/store/notifier/create-middleware.ts - About 45 mins to fix

    Function updateLocalDevices has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function* updateLocalDevices({ payload }: PayloadAction<InputDeviceDto[]>) {
       const deviceSettings: StriveSettings = yield select((state: RootState) => state.settings.obj);
    
       for (const producerDevice of ProducerDevices) {
          const device = deviceSettings[producerDevice].device;
    Severity: Minor
    Found in src/Web/WebSPA/Client/src/features/settings/sagas.ts - About 45 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 useBottomScrollTrigger has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function useBottomScrollTrigger(props: UseScrollTriggerOptions) {
       return useScrollTrigger({
          ...props,
          getTrigger: (store: any, options: any) => {
             const { disableHysteresis = false, threshold = 100, target } = options;
    Severity: Minor
    Found in src/Web/WebSPA/Client/src/hooks/useBottomScrollTrigger.ts - About 45 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 NumericAnswerForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function NumericAnswerForm({
       poll: { poll, answer },
       footerPortalRef,
       onSubmit,
    }: PollAnswerFormProps<NumericAnswer>) {

    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 AudioSettingsTest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function AudioSettingsTest() {
       const classes = useStyles();
       const { t } = useTranslation();
    
       const myId = useMyParticipantId();

    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 mapToViewModels has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function mapToViewModels(layers: PermissionLayer[]): PermissionLayerViewModel[] {
       const appliedValues = new Map<string, string>();
       const result = new Array<PermissionLayerViewModel>();
    
       for (const layer of _(layers)

    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 updateEquipment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function* updateEquipment() {
       const equipment: SynchronizedEquipment | null = yield select((state: RootState) => state.media.equipment);
       const deviceSettings: StriveSettings = yield select((state: RootState) => state.settings.obj);
    
       for (const producerDevice of ProducerDevices) {
    Severity: Minor
    Found in src/Web/WebSPA/Client/src/features/settings/sagas.ts - About 45 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 generateGrid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function generateGrid(
       itemsCount: number,
       itemMaxWidth: number,
       boundingBox: Size,
       spacing: number,
    Severity: Minor
    Found in src/Web/WebSPA/Client/src/features/scenes/calculations.ts - About 45 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 removeParticipant has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

       public async removeParticipant(participantId: string): Promise<SuccessOrError> {
          logger.info('removeParticipant() | participantId: %s', participantId);
    
          const participant = this.participants.get(participantId);
          if (!participant) return { success: false, error: errors.participantNotFound(participantId) };
    Severity: Minor
    Found in src/Services/SFU/src/lib/conference/conference.ts - About 45 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 verifyProducerSource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

       private verifyProducerSource(kind: MediaKind, source: ProducerSource): boolean {
          if (source === 'mic' && kind === 'audio') return true;
          if (source === 'screen' && kind === 'video') return true;
          if (source === 'webcam' && kind === 'video') return true;
    
    
    Severity: Minor
    Found in src/Services/SFU/src/lib/conference/conference.ts - About 45 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 compareArrays has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function compareArrays<T>(a1?: T[], a2?: T[]) {
       if (!a1 && !a2) return true;
       if (!a1 || !a2) return false;
    
       if (a1.length !== a2.length) return false;
    Severity: Minor
    Found in src/Web/WebSPA/Client/src/utils/array-utils.ts - About 45 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 RenderWhiteboard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function RenderWhiteboard({ scene, dimensions }: RenderSceneProps<WhiteboardScene>) {
       const whiteboard = useSelector((state: RootState) => selectWhiteboard(state, scene.id));
       const dispatch = useDispatch();
       const myId = useMyParticipantId();
       const paricipants = useSelector(selectParticipantsOfCurrentRoom);

    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