concord-consortium/lara

View on GitHub

Showing 830 of 830 total issues

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

export const Add = (props: IAddProps) => {
  const height = props.height ? props.height : kDefaultHeight;
  const width = props.width ? props.width : kDefaultWidth;

  return(
Severity: Major
Found in lara-typescript/src/shared/components/icons/add-icon.tsx and 1 other location - About 6 hrs to fix
lara-typescript/src/shared/components/icons/copy-icon.tsx on lines 11..32

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 168.

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

  function messageListener(message) {
    // Anyone can send us a message. Only pay attention to messages from parent.
    if (message.source !== window.parent) return;
    var messageData = message.data;
    if (typeof messageData === 'string') messageData = JSON.parse(messageData);
Severity: Major
Found in public/demo-interactives/iframe-phone.js and 1 other location - About 6 hrs to fix
app/assets/javascripts/iframe-phone.js on lines 71..88

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 165.

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

    function messageListener(message) {
      // Anyone can send us a message. Only pay attention to messages from parent.
      if (message.source !== window.parent) return;
      var messageData = message.data;
      if (typeof messageData === 'string') messageData = JSON.parse(messageData);
Severity: Major
Found in app/assets/javascripts/iframe-phone.js and 1 other location - About 6 hrs to fix
public/demo-interactives/iframe-phone.js on lines 61..78

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 165.

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

    it("can move a section ahead within the same page", () => {
      const pages = makePages(3);
      const destination: ISectionDestination = {
        destPageId: pages[0].id,
        relativeLocation: RelativeLocation.Before,
lara-typescript/src/section-authoring/util/move-utils.spec.ts on lines 76..87

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 163.

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

    it("can move a section back within the same page using Before", () => {
      const pages = makePages(3);
      const destination: ISectionDestination = {
        destPageId: pages[0].id,
        relativeLocation: RelativeLocation.Before,
lara-typescript/src/section-authoring/util/move-utils.spec.ts 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 163.

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

      it("it doesn't remove container from the DOM if removeOnClose is equal to false", () => {
        const content = $("<div id='test-dialog'>Test dialog</div>")[0];
        const onRemoveCallback = jest.fn();
        Popup.addPopup({ content, removeOnClose: false, onRemove: onRemoveCallback });
        expect($("body").find("#test-dialog").length).toEqual(1);
Severity: Major
Found in lara-typescript/src/plugin-api/popup.spec.ts and 1 other location - About 6 hrs to fix
lara-typescript/src/plugin-api/popup.spec.ts on lines 25..33

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 160.

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

      it("it removes container from the DOM if removeOnClose is equal to true and calls onRemove", () => {
        const content = $("<div id='test-dialog'>Test dialog</div>")[0];
        const onRemoveCallback = jest.fn();
        Popup.addPopup({ content, removeOnClose: true, onRemove: onRemoveCallback });
        expect($("body").find("#test-dialog").length).toEqual(1);
Severity: Major
Found in lara-typescript/src/plugin-api/popup.spec.ts and 1 other location - About 6 hrs to fix
lara-typescript/src/plugin-api/popup.spec.ts on lines 35..43

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 160.

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

File eventemitter2.js has 427 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * EventEmitter2
 * https://github.com/hij1nx/EventEmitter2
 *
 * Copyright (c) 2013 hij1nx
Severity: Minor
Found in app/assets/javascripts/eventemitter2.js - About 6 hrs to fix

    Function bindMethods has 156 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                function bindMethods(table){
                    var c = table.config,
                        $table = c.$table;
                    // apply easy methods that trigger bound events
                    $table
    Severity: Major
    Found in app/assets/javascripts/tablesorter.js - About 6 hrs to fix

      Method generate has 152 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.generate(arg_block_buckets)
          bucket_columns = arg_block_buckets[:columns].map &:to_sym
          bucket_rows = arg_block_buckets[:rows]
          bucket_row_indices = indices_by_element(bucket_columns)
      
      
      Severity: Major
      Found in app/services/c_rater/argumentation_blocks_report.rb - About 6 hrs to fix

        File shutterbug.js has 417 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        (function webpackUniversalModuleDefinition(root, factory) {
          if(typeof exports === 'object' && typeof module === 'object')
            module.exports = factory(require("jquery"));
          else if(typeof define === 'function' && define.amd)
            define(["jquery"], factory);
        Severity: Minor
        Found in app/assets/javascripts/shutterbug.js - About 6 hrs to fix

          Function ManagedInteractiveAuthoring has 149 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const ManagedInteractiveAuthoring: React.FC<Props> = (props) => {
            const {
              libraryInteractive,
              managedInteractive,
              defaultClickToPlayPrompt,

            Function getLibraryInteractives has 149 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const getLibraryInteractives = () => {
              const libraryInteractives: ILibraryInteractive[] = [
                {
                  id: 1,
                  serializeable_id: "LibraryInteractive_1",
            Severity: Major
            Found in lara-typescript/src/section-authoring/api/mock-api-provider.ts - About 5 hrs to fix

              Function load has 148 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function load () {
                      var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
              
                      active = true;
              
              
              Severity: Major
              Found in app/assets/javascripts/jquery.colorbox.js - About 5 hrs to fix

                Function AuthoringSection has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                Open

                export const AuthoringSection: React.FC<ISectionProps> = ({
                  id,
                  can_collapse_small,
                  updateFunction,
                  layout: initLayout = defaultLayout,

                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

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

                  function receiveMessage(message) {
                    var messageData;
                    if (message.source === getTargetWindow() && (targetOrigin === '*' || message.origin === targetOrigin)) {
                      messageData = message.data;
                      if (typeof messageData === 'string') {
                Severity: Major
                Found in public/demo-interactives/iframe-phone.js and 1 other location - About 5 hrs to fix
                app/assets/javascripts/iframe-phone.js on lines 347..360

                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 148.

                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

                    function receiveMessage(message) {
                      var messageData;
                      if (message.source === getTargetWindow() && (targetOrigin === '*' || message.origin === targetOrigin)) {
                        messageData = message.data;
                        if (typeof messageData === 'string') {
                Severity: Major
                Found in app/assets/javascripts/iframe-phone.js and 1 other location - About 5 hrs to fix
                public/demo-interactives/iframe-phone.js on lines 331..344

                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 148.

                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 3 locations. Consider refactoring.
                Open

                  it("supports interactive state observing", () => {
                    const listener = jest.fn();
                    api.addInteractiveStateListener(listener);
                    getClient().managedState.interactiveState = {foo: 123};
                    expect(listener).toHaveBeenCalledWith({foo: 123});
                Severity: Major
                Found in lara-typescript/src/interactive-api-client/api.spec.ts and 2 other locations - About 5 hrs to fix
                lara-typescript/src/interactive-api-client/api.spec.ts on lines 241..251
                lara-typescript/src/interactive-api-client/api.spec.ts on lines 253..263

                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 148.

                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 3 locations. Consider refactoring.
                Open

                  it("supports global interactive state observing", () => {
                    const listener = jest.fn();
                    api.addGlobalInteractiveStateListener(listener);
                    getClient().managedState.globalInteractiveState = {foo: 123};
                    expect(listener).toHaveBeenCalledWith({foo: 123});
                Severity: Major
                Found in lara-typescript/src/interactive-api-client/api.spec.ts and 2 other locations - About 5 hrs to fix
                lara-typescript/src/interactive-api-client/api.spec.ts on lines 229..239
                lara-typescript/src/interactive-api-client/api.spec.ts on lines 241..251

                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 148.

                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 3 locations. Consider refactoring.
                Open

                  it("supports authored state observing", () => {
                    const listener = jest.fn();
                    api.addAuthoredStateListener(listener);
                    getClient().managedState.authoredState = {foo: 123};
                    expect(listener).toHaveBeenCalledWith({foo: 123});
                Severity: Major
                Found in lara-typescript/src/interactive-api-client/api.spec.ts and 2 other locations - About 5 hrs to fix
                lara-typescript/src/interactive-api-client/api.spec.ts on lines 229..239
                lara-typescript/src/interactive-api-client/api.spec.ts on lines 253..263

                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 148.

                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

                Severity
                Category
                Status
                Source
                Language