RubyLouvre/anu

View on GitHub

Showing 880 of 880 total issues

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

    return {
        brand: md.mobile(),
        model: md.phone(),
        pixelRatio: '',
        screenWidth: window.screen.width,
Severity: Major
Found in packages/render/miniapp/apiForH5/systemInfo.js and 1 other location - About 6 hrs to fix
packages/render/miniapp/apiForH5/systemInfo.js on lines 15..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 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

            const res = {
                brand: md.mobile(),
                model: md.phone(),
                pixelRatio: '',
                screenWidth: window.screen.width,
Severity: Major
Found in packages/render/miniapp/apiForH5/systemInfo.js and 1 other location - About 6 hrs to fix
packages/render/miniapp/apiForH5/systemInfo.js on lines 48..67

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

Function more has 163 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export var more = function(api) {
    return {
        // 交互
        showModal: function _(a) {
            a.cancelButtonText = a.cancelText;
Severity: Major
Found in packages/render/miniapp/apiForAlipay/index.js - About 6 hrs to fix

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

        if (__DEV__) {
          expect(() => {
            ReactTestUtils.renderIntoDocument(
              <Wrapper>
                <span key={0} />
    Severity: Major
    Found in packages/render/dom/__tests__/ReactComponent-test.js and 1 other location - About 6 hrs to fix
    packages/render/dom/__tests__/ReactComponent-test.js on lines 44..62

    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

        if (__DEV__) {
          expect(() => {
            ReactTestUtils.renderIntoDocument(
              <Wrapper>
                <span key={0} />
    Severity: Major
    Found in packages/render/dom/__tests__/ReactComponent-test.js and 1 other location - About 6 hrs to fix
    packages/render/dom/__tests__/ReactComponent-test.js on lines 77..95

    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("should warn about `setState` on not-yet-mounted components", () => {
            class MyComponent extends React.Component {
                constructor(props) {
                    super(props);
                    this.setState();
    packages/render/dom/__tests__/ReactCompositeComponent-test.js on lines 218..240

    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("should warn about `forceUpdate` on not-yet-mounted components", () => {
            class MyComponent extends React.Component {
                constructor(props) {
                    super(props);
                    this.forceUpdate();
    packages/render/dom/__tests__/ReactCompositeComponent-test.js on lines 242..264

    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

        function renderInputWithStringThenWithNull() {
          class Input extends React.Component {
            state = {value: 'first'};
            render() {
              return (
    Severity: Major
    Found in packages/render/dom/__tests__/ReactDOMInput-test.js and 1 other location - About 6 hrs to fix
    packages/render/dom/__tests__/ReactDOMInput-test.js on lines 1470..1487

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

    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 renderInputWithStringThenWithUndefined() {
          class Input extends React.Component {
            state = {value: 'first'};
            render() {
              return (
    Severity: Major
    Found in packages/render/dom/__tests__/ReactDOMInput-test.js and 1 other location - About 6 hrs to fix
    packages/render/dom/__tests__/ReactDOMInput-test.js on lines 1504..1521

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

    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('updates the value on radio buttons from "" to 0', function() {
        const container = document.createElement('div');
        ReactDOM.render(
          <input type="radio" value="" onChange={function() {}} />,
          container,
    Severity: Major
    Found in packages/render/dom/__tests__/ReactDOMInput-test.js and 1 other location - About 6 hrs to fix
    packages/render/dom/__tests__/ReactDOMInput-test.js on lines 273..285

    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('updates the value on checkboxes from "" to 0', function() {
        const container = document.createElement('div');
        ReactDOM.render(
          <input type="checkbox" value="" onChange={function() {}} />,
          container,
    Severity: Major
    Found in packages/render/dom/__tests__/ReactDOMInput-test.js and 1 other location - About 6 hrs to fix
    packages/render/dom/__tests__/ReactDOMInput-test.js on lines 259..271

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

    import { extend, typeNumber, isFn, gDSFP, gSBU } from 'react-core/util';
    import { fiberizeChildren } from 'react-core/createElement';
    import { AnuPortal } from 'react-core/createPortal';
    
    import { Renderer } from 'react-core/createRenderer';
    Severity: Minor
    Found in packages/fiber/beginWork.js - About 6 hrs to fix

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

      function collectMixins(mixins) {
          let keyed = {};
      
          for (let i = 0; i < mixins.length; i++) {
              let mixin = mixins[i];
      Severity: Major
      Found in packages/core/createClass.js and 1 other location - About 5 hrs to fix
      lib/createClass.js on lines 75..89

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

      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 allow setting `value` to `false`', () => {
          const container = document.createElement('div');
          let stub = <input type="text" value="yolo" onChange={emptyFunction} />;
          const node = ReactDOM.render(stub, container);
      
      
      Severity: Major
      Found in packages/render/dom/__tests__/ReactDOMInput-test.js and 1 other location - About 5 hrs to fix
      packages/render/dom/__tests__/ReactDOMInput-test.js on lines 480..492

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

      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 collectMixins(mixins) {
          var keyed = {};
          for (var i = 0; i < mixins.length; i++) {
              var mixin = mixins[i];
              if (mixin.mixins) {
      Severity: Major
      Found in lib/createClass.js and 1 other location - About 5 hrs to fix
      packages/core/createClass.js on lines 25..42

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

      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 allow setting `value` to `true`', () => {
          const container = document.createElement('div');
          let stub = <input type="text" value="yolo" onChange={emptyFunction} />;
          const node = ReactDOM.render(stub, container);
      
      
      Severity: Major
      Found in packages/render/dom/__tests__/ReactDOMInput-test.js and 1 other location - About 5 hrs to fix
      packages/render/dom/__tests__/ReactDOMInput-test.js on lines 494..506

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

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

          function proxyClass(InitialComponent) {
              var existingProxy = findProxy(InitialComponent);
              if (existingProxy) {
                  return existingProxy;
              }
      Severity: Major
      Found in lib/ReactProxy.js - About 5 hrs to fix

        Function render has 141 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            render(child, context, parentNamespace) {
                var t  = typeNumber(child)
                if (t === 3 || t === 4) {
                    const text = '' + child;
                    if (text === '') {
        Severity: Major
        Found in packages/render/server/Renderer.js - About 5 hrs to fix

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

          /**
           * Copyright (c) 2013-present, Facebook, Inc.
           *
           * This source code is licensed under the MIT license found in the
           * LICENSE file in the root directory of this source tree.
          Severity: Minor
          Found in packages/core/__tests__/ReactElement-test.js - About 5 hrs to fix

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

                    function assertCalls() {
                        expect(callback.calls.count()).toBe(6);
                        expect(callback).toHaveBeenCalledWith(zero, 0);
                        expect(callback).toHaveBeenCalledWith(one, 1);
                        expect(callback).toHaveBeenCalledWith(two, 2);
            Severity: Major
            Found in packages/core/__tests__/ReactChildren-test.js and 1 other location - About 5 hrs to fix
            packages/core/__tests__/ReactChildren-test.js on lines 184..193

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

            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