RubyLouvre/anu

View on GitHub

Showing 880 of 880 total issues

File ReactElementValidator-test.internal.js has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open


let PropTypes;
let ReactFeatureFlags;
let React;
let ReactDOM;
Severity: Minor
Found in packages/core/__tests__/ReactElementValidator-test.internal.js - About 4 hrs to fix

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

      it("返回false的组件不生成节点", () => {
        const container = document.createElement('container');
        class Empty1 extends React.Component {
          constructor(props) {
            super(props);
    Severity: Major
    Found in packages/render/dom/__tests__/ReactMount-test.js and 1 other location - About 4 hrs to fix
    packages/render/dom/__tests__/ReactMount-test.js on lines 447..462

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

    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("返回true的组件不生成节点", () => {
        const container = document.createElement('container');
        class Empty2 extends React.Component {
          constructor(props) {
            super(props);
    Severity: Major
    Found in packages/render/dom/__tests__/ReactMount-test.js and 1 other location - About 4 hrs to fix
    packages/render/dom/__tests__/ReactMount-test.js on lines 415..430

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

    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

        ReactDOM.unstable_batchedUpdates(function() {
          instance.setState({x: 1});
          child.setState({y: 2});
          expect(instance.state.x).toBe(0);
          expect(child.state.y).toBe(0);
    Severity: Major
    Found in packages/render/dom/__tests__/ReactUpdates-test.js and 1 other location - About 4 hrs to fix
    packages/render/dom/__tests__/ReactUpdates-test.js on lines 208..215

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

    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('should warn if uncontrolled checkbox (checked is null) switches to controlled', () => {
        const stub = <input type="checkbox" checked={null} />;
        const container = document.createElement('div');
        ReactDOM.render(stub, container);
        expect(() =>
    Severity: Major
    Found in packages/render/dom/__tests__/ReactDOMInput-test.js and 1 other location - About 4 hrs to fix
    packages/render/dom/__tests__/ReactDOMInput-test.js on lines 1225..1238

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

    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('should warn if controlled radio switches to uncontrolled (checked is undefined)', () => {
        const stub = <input type="radio" checked={true} onChange={emptyFunction} />;
        const container = document.createElement('div');
        ReactDOM.render(stub, container);
        expect(() => ReactDOM.render(<input type="radio" />, container)).toWarnDev(
    Severity: Major
    Found in packages/render/dom/__tests__/ReactDOMInput-test.js and 1 other location - About 4 hrs to fix
    packages/render/dom/__tests__/ReactDOMInput-test.js on lines 1083..1098

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

    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('should warn if uncontrolled radio (checked is null) switches to controlled', () => {
        const stub = <input type="radio" checked={null} />;
        const container = document.createElement('div');
        ReactDOM.render(stub, container);
        expect(() =>
    Severity: Major
    Found in packages/render/dom/__tests__/ReactDOMInput-test.js and 1 other location - About 4 hrs to fix
    packages/render/dom/__tests__/ReactDOMInput-test.js on lines 1152..1165

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

    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

        ReactDOM.unstable_batchedUpdates(function() {
          child.setState({y: 2});
          instance.setState({x: 1});
          expect(instance.state.x).toBe(0);
          expect(child.state.y).toBe(0);
    Severity: Major
    Found in packages/render/dom/__tests__/ReactUpdates-test.js and 1 other location - About 4 hrs to fix
    packages/render/dom/__tests__/ReactUpdates-test.js on lines 155..162

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

    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('should warn if controlled checkbox switches to uncontrolled (checked is undefined)', () => {
        const stub = (
          <input type="checkbox" checked={true} onChange={emptyFunction} />
        );
        const container = document.createElement('div');
    Severity: Major
    Found in packages/render/dom/__tests__/ReactDOMInput-test.js and 1 other location - About 4 hrs to fix
    packages/render/dom/__tests__/ReactDOMInput-test.js on lines 1167..1178

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

    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 event.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { document, modern, contains } from './browser';
    import { isFn, noop, toLowerCase } from 'react-core/util';
    import { Renderer } from 'react-core/createRenderer';
    import { enqueueDuplex } from './duplex';
    export let rform = /textarea|input|select|option/i;
    Severity: Minor
    Found in packages/render/dom/event.js - About 4 hrs to fix

      InnerAudioContext has 35 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class InnerAudioContext {
          constructor(id, opts) {
              this.audioEl = this.init(id, opts);
              this._isPaused = false;
          }
      Severity: Minor
      Found in packages/render/miniapp/apiForH5/audio.js - About 4 hrs to fix

        Function createStore has 111 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createStore(reducer, preloadedState, enhancer) {
          var _ref2;
        
          if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
            enhancer = preloadedState;
        Severity: Major
        Found in lib/ReduxIE.js - About 4 hrs to fix

          Function collectPaths has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          function collectPaths(begin, end, unique) {
              let paths = [];
              let node = begin;
              //先判定路径上有绑定事件没有
              while (node && node.nodeType == 1) {
          Severity: Minor
          Found in packages/render/dom/event.js - About 4 hrs 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

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

            it('should warn if state is not initialized before getDerivedStateFromProps', () => {
              class MyComponent extends React.Component {
                static getDerivedStateFromProps() {
                  return null;
                }
          packages/render/dom/__tests__/ReactComponentLifeCycle-test.js on lines 1144..1162

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

          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('should warn if getSnapshotBeforeUpdate is defined with no componentDidUpdate', () => {
              class MyComponent extends React.Component {
                getSnapshotBeforeUpdate() {
                  return null;
                }
          packages/render/dom/__tests__/ReactComponentLifeCycle-test.js on lines 905..923

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

          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 resolve has 107 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function resolve(child, context) {
              while (isValidElement(child)) {
                  // Safe because we just checked it's an element.
                  let element = child;
                  let Component = element.type;
          Severity: Major
          Found in packages/render/server/Renderer.js - About 4 hrs to fix

            File ReactCompositeComponentState-test.js has 344 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            'use strict';
            
            let React;
            let ReactDOM;
            
            
            Severity: Minor
            Found in packages/render/dom/__tests__/ReactCompositeComponentState-test.js - About 4 hrs to fix

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

                      class Component extends React.Component {
                          state = { updated: false };
              
                          UNSAFE_componentWillReceiveProps(props) {
                              expect(props.update).toBe(1);
              packages/render/dom/__tests__/ReactCompositeComponent-test.js on lines 1136..1150

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

              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

                      class Component extends React.Component {
                          state = { updated: false };
              
                          UNSAFE_componentWillReceiveProps(props) {
                              expect(props.update).toBe(1);
              packages/render/dom/__tests__/ReactCompositeComponent-test.js on lines 1106..1120

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

              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('should warn if uncontrolled radio (checked is undefined) switches to controlled', () => {
                  const stub = <input type="radio" />;
                  const container = document.createElement('div');
                  ReactDOM.render(stub, container);
                  expect(() =>
              Severity: Major
              Found in packages/render/dom/__tests__/ReactDOMInput-test.js and 1 other location - About 4 hrs to fix
              packages/render/dom/__tests__/ReactDOMInput-test.js on lines 1137..1150

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

              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